diff options
182 files changed, 9360 insertions, 20359 deletions
diff --git a/.gitignore b/.gitignore index 5d351af62c0..f5a0abcfe4b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ autom4te.cache aclocal.m4 config.log config.status +cscope* @@ -14,27 +14,25 @@ default: $(TOP)/configs/current doxygen: - (cd doxygen ; make) ; \ + cd doxygen && $(MAKE) clean: - @for dir in $(SUBDIRS) ; do \ + -@touch $(TOP)/configs/current + -@for dir in $(SUBDIRS) ; do \ if [ -d $$dir ] ; then \ (cd $$dir && $(MAKE) clean) ; \ fi \ done + -@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current -realclean: - touch $(TOP)/configs/current - $(MAKE) clean +realclean: clean -rm -rf lib* -rm -f $(TOP)/configs/current -rm -f $(TOP)/configs/autoconf -rm -rf autom4te.cache - -rm -f `find . -name \*.o` - -rm -f `find . -name \*.a` - -rm -f `find . -name \*.so` - -rm -f `find . -name depend` + -find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \ + -name depend -o -name depend.bak ')' -exec rm -f '{}' ';' @@ -50,21 +48,20 @@ install: linux-directfb-install: cd src/mesa/drivers/directfb && $(MAKE) install -# Xserver GLcore module -glcore: - cd src/mesa/drivers/xorg ; $(MAKE) - -glcore-install: - cd src/mesa/drivers/xorg ; $(MAKE) install +.PHONY: default doxygen clean realclean install linux-directfb-install # If there's no current configuration file $(TOP)/configs/current: @echo @echo @echo "Please choose a configuration from the following list:" - @ls -1 $(TOP)/configs | grep -v "current\|default\|CVS" + @ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*" @echo @echo "Then type 'make <config>' (ex: 'make linux-x86')" + @echo + @echo "Or, run './configure' then 'make'" + @echo "See './configure --help' for details" + @echo @echo "(ignore the following error message)" @exit 1 @@ -177,15 +174,16 @@ ultrix-gcc: # Rules for making release tarballs -DIRECTORY = Mesa-7.1pre -LIB_NAME = MesaLib-7.1pre -DEMO_NAME = MesaDemos-7.1pre -GLUT_NAME = MesaGLUT-7.1pre +DIRECTORY = Mesa-7.1-rc1 +LIB_NAME = MesaLib-7.1-rc1 +DEMO_NAME = MesaDemos-7.1-rc1 +GLUT_NAME = MesaGLUT-7.1-rc1 MAIN_FILES = \ $(DIRECTORY)/Makefile* \ $(DIRECTORY)/configure \ $(DIRECTORY)/configure.ac \ + $(DIRECTORY)/acinclude.m4 \ $(DIRECTORY)/aclocal.m4 \ $(DIRECTORY)/descrip.mms \ $(DIRECTORY)/mms-config. \ @@ -450,9 +448,9 @@ ACLOCAL = aclocal ACLOCAL_FLAGS = AUTOCONF = autoconf AC_FLAGS = -aclocal.m4: configure.ac +aclocal.m4: configure.ac acinclude.m4 $(ACLOCAL) $(ACLOCAL_FLAGS) -configure: configure.ac aclocal.m4 +configure: configure.ac aclocal.m4 acinclude.m4 $(AUTOCONF) $(AC_FLAGS) rm_depend: @@ -531,3 +529,6 @@ md5: @-md5sum $(GLUT_NAME).tar.gz @-md5sum $(GLUT_NAME).tar.bz2 @-md5sum $(GLUT_NAME).zip + +.PHONY: tarballs rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 \ + glut_bz2 lib_zip demo_zip glut_zip md5 diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000000..a5b389d5dad --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,119 @@ +# A few convenience macros for Mesa, mostly to keep all the platform +# specifics out of configure.ac. + +# MESA_PIC_FLAGS() +# +# Find out whether to build PIC code using the option --enable-pic and +# the configure enable_static/enable_shared settings. If PIC is needed, +# figure out the necessary flags for the platform and compiler. +# +# The platform checks have been shamelessly taken from libtool and +# stripped down to just what's needed for Mesa. See _LT_COMPILER_PIC in +# /usr/share/aclocal/libtool.m4 or +# http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=blob;f=libltdl/m4/libtool.m4;hb=HEAD +# +AC_DEFUN([MESA_PIC_FLAGS], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_ARG_VAR([PIC_FLAGS], [compiler flags for PIC code]) +AC_ARG_ENABLE([pic], + [AS_HELP_STRING([--disable-pic], + [compile PIC objects @<:@default=enabled for shared builds + on supported platforms@:>@])], + [enable_pic="$enableval" + test "x$enable_pic" = x && enable_pic=auto], + [enable_pic=auto]) +# disable PIC by default for static builds +if test "$enable_pic" = auto && test "$enable_static" = yes; then + enable_pic=no +fi +# if PIC hasn't been explicitly disabled, try to figure out the flags +if test "$enable_pic" != no; then + AC_MSG_CHECKING([for $CC option to produce PIC]) + # allow the user's flags to override + if test "x$PIC_FLAGS" = x; then + # see if we're using GCC + if test "x$GCC" = xyes; then + case "$host_os" in + aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*) + # PIC is the default for these OSes. + ;; + mingw*|os2*|pw32*) + # This hack is so that the source file can tell whether + # it is being built for inclusion in a dll (and should + # export symbols for example). + PIC_FLAGS="-DDLL_EXPORT" + ;; + darwin*|rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + PIC_FLAGS="-fno-common" + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, + # but not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + PIC_FLAGS="-fPIC" + ;; + esac + ;; + *) + # Everyone else on GCC uses -fPIC + PIC_FLAGS="-fPIC" + ;; + esac + else # !GCC + case "$host_os" in + hpux9*|hpux10*|hpux11*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, + # but not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + PIC_FLAGS="+Z" + ;; + esac + ;; + linux*|k*bsd*-gnu) + case `basename "$CC"` in + icc*|ecc*|ifort*) + PIC_FLAGS="-KPIC" + ;; + pgcc*|pgf77*|pgf90*|pgf95*) + # Portland Group compilers (*not* the Pentium gcc + # compiler, which looks to be a dead project) + PIC_FLAGS="-fpic" + ;; + ccc*) + # All Alpha code is PIC. + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + PIC_FLAGS="-qpic" + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*|*Sun\ F*) + # Sun C 5.9 or Sun Fortran + PIC_FLAGS="-KPIC" + ;; + esac + esac + ;; + solaris*) + PIC_FLAGS="-KPIC" + ;; + sunos4*) + PIC_FLAGS="-PIC" + ;; + esac + fi # GCC + fi # PIC_FLAGS + AC_MSG_RESULT([$PIC_FLAGS]) +fi +AC_SUBST([PIC_FLAGS]) +])# MESA_PIC_FLAGS diff --git a/bin/version.mk b/bin/version.mk new file mode 100755 index 00000000000..ab20d79daee --- /dev/null +++ b/bin/version.mk @@ -0,0 +1,17 @@ +#!/usr/bin/make -sf +# Print the various Mesa version fields. This is mostly used to add the +# version to configure. + +# This reflects that this script is usually called from the toplevel +TOP = . + +include $(TOP)/configs/default + +version: + @echo $(MESA_VERSION) +major: + @echo $(MESA_MAJOR) +minor: + @echo $(MESA_MINOR) +tiny: + @echo $(MESA_TINY) diff --git a/configs/autoconf.in b/configs/autoconf.in index 07fe055cbb6..9a70ec1fabb 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -78,9 +78,6 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \ $(EXTRA_LIB_PATH) @GLW_LIB_DEPS@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@ -# GLcore dependencies -GLCORE_LIB_DEPS = $(EXTRA_LIB_PATH) @GLCORE_LIB_DEPS@ - # DRI dependencies DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ diff --git a/configs/default b/configs/default index 9705d6b78c0..37b693932d6 100644 --- a/configs/default +++ b/configs/default @@ -11,6 +11,7 @@ CONFIG_NAME = default MESA_MAJOR=7 MESA_MINOR=1 MESA_TINY=0 +MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) # external projects. This should be useless now that we use libdrm. DRM_SOURCE_PATH=$(TOP)/../drm @@ -81,10 +82,9 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11 APP_LIB_DEPS = -lm - # Installation directories (for make install) INSTALL_DIR = /usr/local -DRI_DRIVER_INSTALL_DIR = /usr/X11R6/lib/modules/dri +DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/$(LIB_DIR)/dri # Where libGL will look for DRI hardware drivers DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) diff --git a/configs/freebsd-dri b/configs/freebsd-dri index bb8fb4a3b4a..9d9215483d9 100644 --- a/configs/freebsd-dri +++ b/configs/freebsd-dri @@ -34,7 +34,6 @@ LIBDRM_LIB = `pkg-config --libs libdrm` DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB) GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ -lm -pthread $(LIBDRM_LIB) -GLCORE_LIB_DEPS = -lm -pthread GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11 diff --git a/configs/linux-dri b/configs/linux-dri index b4889d0176d..8c325c7d345 100644 --- a/configs/linux-dri +++ b/configs/linux-dri @@ -48,7 +48,6 @@ LIBDRM_LIB = `pkg-config --libs libdrm` DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ -lm -lpthread -ldl $(LIBDRM_LIB) -GLCORE_LIB_DEPS = -lm -lpthread -ldl # This is now 0 by default since it seems to confuse the hell out of people diff --git a/configure.ac b/configure.ac index 672bab85c18..a73c754dfdf 100644 --- a/configure.ac +++ b/configure.ac @@ -1,23 +1,33 @@ dnl Process this file with autoconf to create configure. -AC_PREREQ(2.59) - -dnl Versioning -dnl Make version number available to autoconf and configure -m4_define([mesa_version],[7.1.0]) +AC_PREREQ([2.59]) + +dnl Versioning - scrape the version from configs/default +m4_define([mesa_version], + [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])]) +m4_ifval(mesa_version,[],[ + m4_errprint([Error: Failed to get the Mesa version from the output of + running `make -f bin/version.mk version' +]) + m4_exit([1]) +]) -AC_INIT([Mesa],[mesa_version()], +AC_INIT([Mesa],[mesa_version], [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) -AC_CONFIG_AUX_DIR(bin) +AC_CONFIG_AUX_DIR([bin]) AC_CANONICAL_HOST +dnl Versions for external dependencies +LIBDRM_REQUIRED=2.3.1 +DRI2PROTO_REQUIRED=1.1 + dnl Check for progs AC_PROG_CPP AC_PROG_CC AC_PROG_CXX -AC_CHECK_PROGS(MAKE, [gmake make]) -AC_PATH_PROG(MKDEP, makedepend) -AC_PATH_PROG(SED, sed) +AC_CHECK_PROGS([MAKE], [gmake make]) +AC_PATH_PROG([MKDEP], [makedepend]) +AC_PATH_PROG([SED], [sed]) MKDEP_OPTIONS=-fdepend dnl Ask gcc where it's keeping its secret headers @@ -27,15 +37,15 @@ if test "x$GCC" = xyes; then MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES" fi fi -AC_SUBST(MKDEP_OPTIONS) +AC_SUBST([MKDEP_OPTIONS]) dnl Check to see if dlopen is in default libraries (like Solaris, which dnl has it in libc), or if libdl is needed to get it. AC_CHECK_FUNC([dlopen], [], - AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl")) + [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])]) dnl Make sure the pkg-config macros are defined -m4_ifdef([PKG_PROG_PKG_CONFIG],,[ +m4_ifdef([PKG_PROG_PKG_CONFIG],[],[ m4_errprint([Error: Could not locate the pkg-config autoconf macros. These are usually located in /usr/share/aclocal/pkg.m4. If your macros are in a different location, try setting the environment @@ -48,21 +58,21 @@ PKG_PROG_PKG_CONFIG() dnl LIB_DIR - library basename LIB_DIR=`echo $libdir | $SED 's%.*/%%'` -AC_SUBST(LIB_DIR) +AC_SUBST([LIB_DIR]) dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later _SAVE_LDFLAGS="$LDFLAGS" -AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker]) -AC_SUBST(EXTRA_LIB_PATH) +AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker]) +AC_SUBST([EXTRA_LIB_PATH]) dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later _SAVE_CPPFLAGS="$CPPFLAGS" -AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers]) -AC_SUBST(X11_INCLUDES) +AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers]) +AC_SUBST([X11_INCLUDES]) dnl Compiler macros DEFINES="" -AC_SUBST(DEFINES) +AC_SUBST([DEFINES]) case "$host_os" in linux*) if test "x$GCC" = xyes; then @@ -87,21 +97,21 @@ if test "x$GXX" = xyes; then fi dnl These should be unnecessary, but let the user set them if they want -AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler. +AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler. Default is to use CFLAGS.]) -AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the +AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the compiler. Default is to use CFLAGS.]) -AC_SUBST(OPT_FLAGS) -AC_SUBST(ARCH_FLAGS) +AC_SUBST([OPT_FLAGS]) +AC_SUBST([ARCH_FLAGS]) dnl dnl Hacks to enable 32 or 64 bit build dnl -AC_ARG_ENABLE(32-bit, +AC_ARG_ENABLE([32-bit], [AS_HELP_STRING([--enable-32-bit], [build 32-bit libraries @<:@default=auto@:>@])], - enable_32bit="$enableval", - enable_32bit=auto + [enable_32bit="$enableval"], + [enable_32bit=auto] ) if test "x$enable_32bit" = xyes; then if test "x$GCC" = xyes; then @@ -111,11 +121,11 @@ if test "x$enable_32bit" = xyes; then CXXFLAGS="$CXXFLAGS -m32" fi fi -AC_ARG_ENABLE(64-bit, +AC_ARG_ENABLE([64-bit], [AS_HELP_STRING([--enable-64-bit], [build 64-bit libraries @<:@default=auto@:>@])], - enable_64bit="$enableval", - enable_64bit=auto + [enable_64bit="$enableval"], + [enable_64bit=auto] ) if test "x$enable_64bit" = xyes; then if test "x$GCC" = xyes; then @@ -129,11 +139,11 @@ fi dnl dnl shared/static libraries, mimic libtool options dnl -AC_ARG_ENABLE(static, +AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static], [build static libraries @<:@default=disabled@:>@])], - enable_static="$enableval", - enable_static=no + [enable_static="$enableval"], + [enable_static=no] ) case "x$enable_static" in xyes|xno ) ;; @@ -142,11 +152,11 @@ x ) enable_static=no ;; AC_MSG_ERROR([Static library option '$enable_static' is not a valid]) ;; esac -AC_ARG_ENABLE(shared, +AC_ARG_ENABLE([shared], [AS_HELP_STRING([--disable-shared], [build shared libraries @<:@default=enabled@:>@])], - enable_shared="$enableval", - enable_shared=yes + [enable_shared="$enableval"], + [enable_shared=yes] ) case "x$enable_shared" in xyes|xno ) ;; @@ -173,20 +183,20 @@ esac dnl dnl mklib options dnl -AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib]) +AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib]) if test "$enable_static" = yes; then MKLIB_OPTIONS="$MKLIB_OPTIONS -static" fi -AC_SUBST(MKLIB_OPTIONS) +AC_SUBST([MKLIB_OPTIONS]) dnl dnl other compiler options dnl -AC_ARG_ENABLE(debug, +AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [use debug compiler flags and macros @<:@default=disabled@:>@])], - enable_debug="$enableval", - enable_debug=no + [enable_debug="$enableval"], + [enable_debug=no] ) if test "x$enable_debug" = xyes; then DEFINES="$DEFINES -DDEBUG" @@ -197,13 +207,6 @@ if test "x$enable_debug" = xyes; then CXXFLAGS="$CXXFLAGS -g" fi fi -dnl These will be used near the end in the arch specific options -AC_ARG_ENABLE(asm, - [AS_HELP_STRING([--disable-asm], - [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], - enable_asm="$enableval", - enable_asm=yes -) dnl dnl library names @@ -221,11 +224,11 @@ else GLW_LIB_NAME='lib$(GLW_LIB).so' OSMESA_LIB_NAME='lib$(OSMESA_LIB).so' fi -AC_SUBST(GL_LIB_NAME) -AC_SUBST(GLU_LIB_NAME) -AC_SUBST(GLUT_LIB_NAME) -AC_SUBST(GLW_LIB_NAME) -AC_SUBST(OSMESA_LIB_NAME) +AC_SUBST([GL_LIB_NAME]) +AC_SUBST([GLU_LIB_NAME]) +AC_SUBST([GLUT_LIB_NAME]) +AC_SUBST([GLW_LIB_NAME]) +AC_SUBST([OSMESA_LIB_NAME]) dnl dnl Driver configuration. Options are xlib, dri and osmesa right now. @@ -246,11 +249,11 @@ freebsd* | dragonfly*) ;; esac -AC_ARG_WITH(driver, +AC_ARG_WITH([driver], [AS_HELP_STRING([--with-driver=DRIVER], [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])], - mesa_driver="$withval", - mesa_driver="$default_driver") + [mesa_driver="$withval"], + [mesa_driver="$default_driver"]) dnl Check for valid option case "x$mesa_driver" in xxlib|xdri|xosmesa) @@ -279,10 +282,10 @@ osmesa) DRIVER_DIRS="osmesa" ;; esac -AC_SUBST(SRC_DIRS) -AC_SUBST(GLU_DIRS) -AC_SUBST(DRIVER_DIRS) -AC_SUBST(WINDOW_SYSTEM) +AC_SUBST([SRC_DIRS]) +AC_SUBST([GLU_DIRS]) +AC_SUBST([DRIVER_DIRS]) +AC_SUBST([WINDOW_SYSTEM]) dnl dnl User supplied program configuration @@ -292,12 +295,12 @@ if test -d "$srcdir/progs/demos"; then else default_demos=no fi -AC_ARG_WITH(demos, +AC_ARG_WITH([demos], [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@], [optional comma delimited demo directories to build @<:@default=auto if source available@:>@])], - with_demos="$withval", - with_demos="$default_demos") + [with_demos="$withval"], + [with_demos="$default_demos"]) if test "x$with_demos" = x; then with_demos=no fi @@ -324,20 +327,18 @@ yes) esac dnl -dnl Find out if X is available. The variables have_x or no_x will be -dnl set and used later in the driver setups +dnl Find out if X is available. The variable have_x is set if libX11 is +dnl to mimic AC_PATH_XTRA. dnl if test -n "$PKG_CONFIG"; then AC_MSG_CHECKING([pkg-config files for X11 are available]) - if $PKG_CONFIG --exists x11; then + PKG_CHECK_EXISTS([x11],[ x11_pkgconfig=yes have_x=yes - AC_MSG_RESULT(yes) - else + ],[ x11_pkgconfig=no - no_x=yes - AC_MSG_RESULT(no) - fi + ]) + AC_MSG_RESULT([$x11_pkgconfig]) else x11_pkgconfig=no fi @@ -355,13 +356,29 @@ xlib|dri) ;; esac +dnl XCB - this is only used for GLX right now +AC_ARG_ENABLE([xcb], + [AS_HELP_STRING([--enable-xcb], + [use XCB for GLX @<:@default=disabled@:>@])], + [enable_xcb="$enableval"], + [enable_xcb=no]) +if test "x$enable_xcb" = xyes; then + DEFINES="$DEFINES -DUSE_XCB" +else + enable_xcb=no +fi + # SELinux awareness. -AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux], [Build SELinux-aware Mesa (default: disabled)]), [MESA_SELINUX=$enableval], [MESA_SELINUX=no]) +AC_ARG_ENABLE([selinux], + [AS_HELP_STRING([--enable-selinux], + [Build SELinux-aware Mesa (default: disabled)])], + [MESA_SELINUX="$enableval"], + [MESA_SELINUX=no]) if test "x$enable_selinux" = "xyes"; then - AC_CHECK_HEADER(selinux/selinux.h,, - AC_MSG_ERROR([SELinux headers not found])) - AC_CHECK_LIB(selinux,is_selinux_enabled,, - AC_MSG_ERROR([SELinux library not found])) + AC_CHECK_HEADER([selinux/selinux.h],[], + [AC_MSG_ERROR([SELinux headers not found])]) + AC_CHECK_LIB([selinux],[is_selinux_enabled],[], + [AC_MSG_ERROR([SELinux library not found])]) SELINUX_LIBS="-lselinux" DEFINES="$DEFINES -DMESA_SELINUX" fi @@ -372,7 +389,7 @@ dnl case "$mesa_driver" in xlib) if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES(XLIBGL, x11 xext) + PKG_CHECK_MODULES([XLIBGL], [x11 xext]) X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" GL_LIB_DEPS="$XLIBGL_LIBS" else @@ -381,7 +398,6 @@ xlib) GL_LIB_DEPS="$X_LIBS -lX11 -lXext" fi GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread" - GLCORE_LIB_DEPS="" # if static, move the external libraries to the programs # and empty the libraries for libGL @@ -397,32 +413,42 @@ dri) fi # Check for libdrm - PKG_CHECK_MODULES(LIBDRM, libdrm) - PKG_CHECK_MODULES(DRI2PROTO, dri2proto >= 1.1) + PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) + PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) # find the DRI deps for libGL if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes) + # add xcb modules if necessary + dri_modules="x11 xext xxf86vm xdamage xfixes" + if test "$enable_xcb" = yes; then + dri_modules="$dri_modules x11-xcb xcb-glx" + fi + + PKG_CHECK_MODULES([DRIGL], [$dri_modules]) X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" GL_LIB_DEPS="$DRIGL_LIBS" else # should check these... X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" + + # XCB can only be used from pkg-config + if test "$enable_xcb" = yes; then + PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx]) + X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS" + GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS" + fi fi # need DRM libs, -lpthread, etc. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" - GLCORE_LIB_DEPS="-lm -lpthread $DLOPEN_LIBS" ;; osmesa) # No libGL for osmesa GL_LIB_DEPS="" - GLCORE_LIB_DEPS="" ;; esac -AC_SUBST(GL_LIB_DEPS) -AC_SUBST(GLCORE_LIB_DEPS) +AC_SUBST([GL_LIB_DEPS]) dnl dnl More X11 setup @@ -434,31 +460,44 @@ fi dnl dnl More DRI setup dnl -AC_ARG_ENABLE(glx-tls, +AC_ARG_ENABLE([glx-tls], [AS_HELP_STRING([--enable-glx-tls], [enable TLS support in GLX @<:@default=disabled@:>@])], - GLX_USE_TLS="$enableval", - GLX_USE_TLS=no) + [GLX_USE_TLS="$enableval"], + [GLX_USE_TLS=no]) dnl Directory for DRI drivers -AC_ARG_WITH(dri-driverdir, +AC_ARG_WITH([dri-driverdir], [AS_HELP_STRING([--with-dri-driverdir=DIR], - [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])], - DRI_DRIVER_INSTALL_DIR="$withval", - DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri') -AC_SUBST(DRI_DRIVER_INSTALL_DIR) + [directory for the DRI drivers @<:@${libdir}/dri@:>@])], + [DRI_DRIVER_INSTALL_DIR="$withval"], + [DRI_DRIVER_INSTALL_DIR='${libdir}/dri']) +AC_SUBST([DRI_DRIVER_INSTALL_DIR]) dnl Direct rendering or just indirect rendering -AC_ARG_ENABLE(driglx-direct, +AC_ARG_ENABLE([driglx-direct], [AS_HELP_STRING([--disable-driglx-direct], [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])], - driglx_direct="$enableval", - driglx_direct="yes") + [driglx_direct="$enableval"], + [driglx_direct="yes"]) +dnl ttm support +AC_ARG_ENABLE([ttm-api], + [AS_HELP_STRING([--enable-ttm-api], + [enable TTM API users])], + [ttmapi="$enableval"], + [ttmapi="no"]) + +if test "x$ttmapi" = "xyes"; then + save_CFLAGS=$CFLAGS + CFLAGS=$LIBDRM_CFLAGS + AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"]) + CFLAGS=$save_CFLAGS +fi dnl Which drivers to build - default is chosen by platform -AC_ARG_WITH(dri-drivers, +AC_ARG_WITH([dri-drivers], [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@], [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])], - with_dri_drivers="$withval", - with_dri_drivers=yes) + [with_dri_drivers="$withval"], + [with_dri_drivers=yes]) if test "x$with_dri_drivers" = x; then with_dri_drivers=no fi @@ -481,7 +520,7 @@ esac dnl Just default to no EGL for now USING_EGL=0 -AC_SUBST(USING_EGL) +AC_SUBST([USING_EGL]) dnl Set DRI_DIRS, DEFINES and LIB_DEPS if test "$mesa_driver" = dri; then @@ -490,6 +529,10 @@ if test "$mesa_driver" = dri; then DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" fi + if test "x$ttmapi" = xyes; then + DEFINES="$DEFINES -DTTM_API" + fi + if test "x$USING_EGL" = x1; then PROGRAM_DIRS="egl" fi @@ -511,14 +554,14 @@ if test "$mesa_driver" = dri; then # be used. if test "x$DRI_DIRS" = x; then DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \ - savage tdfx unichrome" + savage tdfx unichrome swrast" fi ;; powerpc*) # Build only the drivers for cards that exist on PowerPC. # At some point MGA will be added, but not yet. if test "x$DRI_DIRS" = x; then - DRI_DIRS="mach64 r128 r200 r300 radeon tdfx" + DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast" fi ;; esac @@ -538,7 +581,7 @@ if test "$mesa_driver" = dri; then # to use the new interface. if test "x$DRI_DIRS" = x; then DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \ - unichrome savage sis" + unichrome savage sis swrast" fi ;; esac @@ -546,7 +589,7 @@ if test "$mesa_driver" = dri; then # default drivers if test "x$DRI_DIRS" = x; then DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \ - savage sis tdfx trident unichrome ffb" + savage sis tdfx trident unichrome ffb swrast" fi DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'` @@ -554,23 +597,24 @@ if test "$mesa_driver" = dri; then # Check for expat EXPAT_INCLUDES="" EXPAT_LIB=-lexpat - AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR], - [expat install directory]),[ + AC_ARG_WITH([expat], + [AS_HELP_STRING([--with-expat=DIR], + [expat install directory])],[ EXPAT_INCLUDES="-I$withval/include" CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES" LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR" EXPAT_LIB="-L$withval/$LIB_DIR -lexpat" ]) - AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.])) - AC_CHECK_LIB(expat, XML_ParserCreate,, - AC_MSG_ERROR([Expat required for DRI.])) + AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])]) + AC_CHECK_LIB([expat],[XML_ParserCreate],[], + [AC_MSG_ERROR([Expat required for DRI.])]) # put all the necessary libs together DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS" fi -AC_SUBST(DRI_DIRS) -AC_SUBST(EXPAT_INCLUDES) -AC_SUBST(DRI_LIB_DEPS) +AC_SUBST([DRI_DIRS]) +AC_SUBST([EXPAT_INCLUDES]) +AC_SUBST([DRI_LIB_DEPS]) dnl dnl OSMesa configuration @@ -580,11 +624,11 @@ if test "$mesa_driver" = xlib; then else default_gl_osmesa=no fi -AC_ARG_ENABLE(gl-osmesa, +AC_ARG_ENABLE([gl-osmesa], [AS_HELP_STRING([--enable-gl-osmesa], [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])], - gl_osmesa="$enableval", - gl_osmesa="$default_gl_osmesa") + [gl_osmesa="$enableval"], + [gl_osmesa="$default_gl_osmesa"]) if test "x$gl_osmesa" = xyes; then if test "$mesa_driver" = osmesa; then AC_MSG_ERROR([libGL is not available for OSMesa driver]) @@ -594,11 +638,11 @@ if test "x$gl_osmesa" = xyes; then fi dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...) -AC_ARG_WITH(osmesa-bits, +AC_ARG_WITH([osmesa-bits], [AS_HELP_STRING([--with-osmesa-bits=BITS], [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])], - osmesa_bits="$withval", - osmesa_bits=8) + [osmesa_bits="$withval"], + [osmesa_bits=8]) if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver]) osmesa_bits=8 @@ -615,7 +659,7 @@ x16|x32) AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option]) ;; esac -AC_SUBST(OSMESA_LIB) +AC_SUBST([OSMESA_LIB]) case "$mesa_driver" in osmesa) @@ -638,17 +682,17 @@ osmesa) fi ;; esac -AC_SUBST(OSMESA_LIB_DEPS) -AC_SUBST(OSMESA_MESA_DEPS) +AC_SUBST([OSMESA_LIB_DEPS]) +AC_SUBST([OSMESA_MESA_DEPS]) dnl dnl GLU configuration dnl -AC_ARG_ENABLE(glu, +AC_ARG_ENABLE([glu], [AS_HELP_STRING([--disable-glu], [enable OpenGL Utility library @<:@default=enabled@:>@])], - enable_glu="$enableval", - enable_glu=yes) + [enable_glu="$enableval"], + [enable_glu=yes]) if test "x$enable_glu" = xyes; then SRC_DIRS="$SRC_DIRS glu" @@ -681,17 +725,17 @@ if test "x$enable_glu" = xyes; then ;; esac fi -AC_SUBST(GLU_LIB_DEPS) -AC_SUBST(GLU_MESA_DEPS) +AC_SUBST([GLU_LIB_DEPS]) +AC_SUBST([GLU_MESA_DEPS]) dnl dnl GLw configuration dnl -AC_ARG_ENABLE(glw, +AC_ARG_ENABLE([glw], [AS_HELP_STRING([--disable-glw], [enable Xt/Motif widget library @<:@default=enabled@:>@])], - enable_glw="$enableval", - enable_glw=yes) + [enable_glw="$enableval"], + [enable_glw=yes]) dnl Don't build GLw on osmesa if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then AC_MSG_WARN([Disabling GLw since the driver is OSMesa]) @@ -700,7 +744,7 @@ fi if test "x$enable_glw" = xyes; then SRC_DIRS="$SRC_DIRS glw" if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES(GLW, x11 xt) + PKG_CHECK_MODULES([GLW],[x11 xt]) GLW_LIB_DEPS="$GLW_LIBS" else # should check these... @@ -716,8 +760,8 @@ if test "x$enable_glw" = xyes; then GLW_MESA_DEPS="" fi fi -AC_SUBST(GLW_LIB_DEPS) -AC_SUBST(GLW_MESA_DEPS) +AC_SUBST([GLW_LIB_DEPS]) +AC_SUBST([GLW_MESA_DEPS]) dnl dnl GLUT configuration @@ -727,11 +771,11 @@ if test -f "$srcdir/include/GL/glut.h"; then else default_glut=no fi -AC_ARG_ENABLE(glut, +AC_ARG_ENABLE([glut], [AS_HELP_STRING([--disable-glut], [enable GLUT library @<:@default=enabled if source available@:>@])], - enable_glut="$enableval", - enable_glut="$default_glut") + [enable_glut="$enableval"], + [enable_glut="$default_glut"]) dnl Can't build glut if GLU not available if test "x$enable_glu$enable_glut" = xnoyes; then @@ -751,7 +795,7 @@ if test "x$enable_glut" = xyes; then GLUT_CFLAGS="-fexceptions" fi if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES(GLUT, x11 xmu xi) + PKG_CHECK_MODULES([GLUT],[x11 xmu xi]) GLUT_LIB_DEPS="$GLUT_LIBS" else # should check these... @@ -773,9 +817,9 @@ if test "x$enable_glut" = xyes; then GLUT_MESA_DEPS="" fi fi -AC_SUBST(GLUT_LIB_DEPS) -AC_SUBST(GLUT_MESA_DEPS) -AC_SUBST(GLUT_CFLAGS) +AC_SUBST([GLUT_LIB_DEPS]) +AC_SUBST([GLUT_MESA_DEPS]) +AC_SUBST([GLUT_CFLAGS]) dnl dnl Program library dependencies @@ -785,65 +829,89 @@ dnl if test "x$APP_LIB_DEPS" = x; then APP_LIB_DEPS="-lm" fi -AC_SUBST(APP_LIB_DEPS) -AC_SUBST(PROGRAM_DIRS) +AC_SUBST([APP_LIB_DEPS]) +AC_SUBST([PROGRAM_DIRS]) +dnl dnl Arch/platform-specific settings -PIC_FLAGS="" +dnl +AC_ARG_ENABLE([asm], + [AS_HELP_STRING([--disable-asm], + [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], + [enable_asm="$enableval"], + [enable_asm=yes] +) +asm_arch="" ASM_FLAGS="" ASM_SOURCES="" ASM_API="" -AC_SUBST(PIC_FLAGS) -AC_SUBST(ASM_FLAGS) -AC_SUBST(ASM_SOURCES) -AC_SUBST(ASM_API) -case "$host_os" in -linux*) - PIC_FLAGS="-fPIC" +AC_MSG_CHECKING([whether to enable assembly]) +test "x$enable_asm" = xno && AC_MSG_RESULT([no]) +# disable if cross compiling on x86/x86_64 since we must run gen_matypes +if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then case "$host_cpu" in - i*86) - if test "x$enable_asm" = xyes; then - ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" - ASM_SOURCES='$(X86_SOURCES)' - ASM_API='$(X86_API)' - fi + i?86 | x86_64) + enable_asm=no + AC_MSG_RESULT([no, cross compiling]) + ;; + esac +fi +# check for supported arches +if test "x$enable_asm" = xyes; then + case "$host_cpu" in + i?86) + case "$host_os" in + linux* | freebsd* | dragonfly*) + test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 + ;; + esac ;; x86_64) - if test "x$enable_asm" = xyes; then - ASM_FLAGS="-DUSE_X86_64_ASM" - ASM_SOURCES='$(X86-64_SOURCES)' - ASM_API='$(X86-64_API)' - fi + case "$host_os" in + linux* | freebsd* | dragonfly*) + test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 + ;; + esac ;; powerpc) - if test "x$enable_asm" = xyes; then - ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" - ASM_SOURCES='$(PPC_SOURCES)' - fi + case "$host_os" in + linux*) + asm_arch=ppc + ;; + esac ;; esac - ;; -freebsd* | dragonfly*) - PIC_FLAGS="-fPIC" - case "$host_cpu" in - i*86) - PIC_FLAGS="" - if test "x$enable_asm" = xyes; then - ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" - ASM_SOURCES='$(X86_SOURCES)' - ASM_API='$(X86_API)' - fi + + case "$asm_arch" in + x86) + ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" + ASM_SOURCES='$(X86_SOURCES)' + ASM_API='$(X86_API)' + AC_MSG_RESULT([yes, x86]) ;; x86_64) - if test "x$enable_asm" = xyes; then - ASM_FLAGS="-DUSE_X86_64_ASM" - ASM_SOURCES='$(X86-64_SOURCES)' - ASM_API='$(X86-64_API)' - fi + ASM_FLAGS="-DUSE_X86_64_ASM" + ASM_SOURCES='$(X86-64_SOURCES)' + ASM_API='$(X86-64_API)' + AC_MSG_RESULT([yes, x86_64]) + ;; + ppc) + ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" + ASM_SOURCES='$(PPC_SOURCES)' + AC_MSG_RESULT([yes, ppc]) + ;; + *) + AC_MSG_RESULT([no, platform not supported]) ;; esac - ;; -esac +fi +AC_SUBST([ASM_FLAGS]) +AC_SUBST([ASM_SOURCES]) +AC_SUBST([ASM_API]) + +dnl PIC code macro +MESA_PIC_FLAGS + dnl Restore LDFLAGS and CPPFLAGS LDFLAGS="$_SAVE_LDFLAGS" @@ -851,13 +919,16 @@ CPPFLAGS="$_SAVE_CPPFLAGS" dnl Substitute the config AC_CONFIG_FILES([configs/autoconf]) -AC_OUTPUT dnl Replace the configs/current symlink +AC_CONFIG_COMMANDS([configs],[ if test -f configs/current || test -L configs/current; then rm -f configs/current fi ln -s autoconf configs/current +]) + +AC_OUTPUT dnl dnl Output some configuration info for the user @@ -880,6 +951,7 @@ if test "$mesa_driver" = dri; then dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` echo " DRI drivers: $dri_dirs" echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" + echo " TTM API support: $ttmapi" fi dnl Libraries diff --git a/docs/autoconf.html b/docs/autoconf.html index d0f91558b7d..837c92f4e29 100644 --- a/docs/autoconf.html +++ b/docs/autoconf.html @@ -178,8 +178,7 @@ drivers. <ul> <li><code>--with-dri-driverdir=DIR</code> - This option specifies the location the DRI drivers will be installed to and the location libGL -will search for DRI drivers. The default is -<code>/usr/X11R6/lib/modules/dri</code>. +will search for DRI drivers. The default is <code>${libdir}/dri</code>. </li> <li><code>--with-dri-drivers=DRIVER,DRIVER,...</code> - This option allows a specific set of DRI drivers to be built. For example, diff --git a/docs/devinfo.html b/docs/devinfo.html index 1f54a92d0f5..3cebf5f36db 100644 --- a/docs/devinfo.html +++ b/docs/devinfo.html @@ -136,11 +136,11 @@ Update the docs/VERSIONS file too. <p> Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in -configs/default and configure.ac. +configs/default. </p> <p> -Make sure the values in src/mesa/main/version.h is correct. +Make sure the values in src/mesa/main/version.h are correct. </p> <p> diff --git a/docs/install.html b/docs/install.html index 10688d8ca8a..30565a1dc4f 100644 --- a/docs/install.html +++ b/docs/install.html @@ -21,16 +21,53 @@ <a name="unix-x11"> <H2>1. Unix/X11 Compilation and Installation</H1> -<h3>1.1 Compilation</h3> + +<h3>1.1 Prerequisites for DRI and Hardware Acceleration</h3> + +<p> +To build Mesa with DRI-based hardware acceleration you must first have +the right version of DRM. +</p> + +<p> +For Mesa 7.1 a particular snapshot of +<a href="http://dri.freedesktop.org/libdrm/">DRM</a> from git is required: +</p> + +<pre> +git-clone git://anongit.freedesktop.org/git/mesa/drm +git-checkout (XXXX HASH ID TBD) +</pre> +</li> + +<p> +You should also be using Xorg server version 1.4 +</p> + + + +<h3>1.2 Autoconf Compilation</h3> + +<p> +Mesa may be <a href="autoconf.html">built using autoconf</a>. +This should work well on most GNU-based systems. +When that fails, the traditional Mesa build system is available. + + + +<h3>1.3 Traditional Compilation</h3> + +<p> +The traditional Mesa build system is based on a collection of pre-defined +system configurations. +</p> +<p> +To see the list of configurations, type <b>make</b> alone. +Then choose a configuration from the list and type <b>make configname</b>. +</p> <p> -Mesa is built by reading Makefile stubs from the configs directory. -There are configurations for many Unix variants and different Mesa -options. Type <b>make</b> from the top-level directory to see a list of -supported system configurations. Alternatively, an autoconf system can -be used to create a Makefile stub for your system. See the <a -href="autoconf.html">autoconf instructions</a> for more details. Mesa -may be compiled in several ways using the predefined configurations: +Mesa may be built in several different ways using the predefined configurations: </p> <ul> <li><b><em>Stand-alone/Xlib mode</em></b> - Mesa will be compiled as @@ -55,43 +92,6 @@ accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built. The libGL.so library will support the GLX extension and will load/use the DRI hardware drivers. -<p> -<b>Prerequisites:</b> -</p> - -<ol> - -<li> -<p> -For Mesa 7.0.2 <a href="http://dri.freedesktop.org/libdrm/"> -DRM version 2.3</a> is required. -</p> -<p> -To check if you already have it, run: -<br> -<code>pkg-config --modversion libdrm</code> -</p> -<p> -You can download and install a <a href="http://dri.freedesktop.org/libdrm/"> -tarball release</a> or get the code from git with: -<br> -<code>git clone git://anongit.freedesktop.org/git/mesa/drm</code> -<br> -Then revert to the drm-2.3.0 tag with: -<br> -<code>git-reset --hard drm-2.3.0</code> -</p> -</li> - -<li> -Relatively recent -<a href="http://freedesktop.org/wiki/Software_2fXserver" target="_parent"> -X.org</a> release. -Mesa depends on a number of X header and library files. -</li> - -</ol> - <p> Build Mesa and the DRI hardware drivers by running @@ -104,8 +104,13 @@ There are also <code>linux-dri-x86</code>, <code>linux-dri-x86-64</code>, and <code>linux-ppc</code> configurations which are optimized for those architectures. </p> +<p> +Make sure you have the prerequisite versions of DRM and Xserver mentioned +above. +</p> </li> + </ul> @@ -115,7 +120,7 @@ Later, if you want to rebuild for a different configuration run </p> -<h3>1.2 The libraries</h3> +<h3>1.4 The libraries</h3> <p> When compilation has finished, look in the top-level <code>lib/</code> @@ -156,15 +161,15 @@ lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSM If you built the DRI hardware drivers, you'll also see the DRI drivers: </p> <pre> --rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so* --rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so* --rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so* --rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so* +-rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so +-rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so +-rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so +-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so -rwxr-xr-x 1 brian users 11320803 Jul 21 12:11 mach64_dri.so -rwxr-xr-x 1 brian users 11418014 Jul 21 12:12 mga_dri.so -rwxr-xr-x 1 brian users 11064426 Jul 21 12:12 r128_dri.so -rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so --rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so* +-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so -rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so -rwxr-xr-x 1 brian users 11232304 Jul 21 12:13 s3v_dri.so -rwxr-xr-x 1 brian users 11062970 Jul 21 12:13 savage_dri.so @@ -175,7 +180,7 @@ If you built the DRI hardware drivers, you'll also see the DRI drivers: </pre> -<h3>1.3 Running the demos</h3> +<h3>1.5 Running the demos</h3> <p> If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or @@ -184,18 +189,15 @@ bunch of demonstration programs. </p> <p> -Before running a demo, you may have to set an environment variable -(such as <b>LD_LIBRARY_PATH</b> on Linux) to indicate where the -libraries are located. For example: +Before running a demo, you'll probably have to set two environment variables +to indicate where the libraries are located. For example: <p> <blockquote> -<b>cd</b> into the Mesa <b>lib/</b> directory. -<br> -<b>setenv LD_LIBRARY_PATH ${cwd}</b> (if using csh or tcsh shell) +<b>cd lib/</b> <br> -or, +<b>export LD_LIBRARY_PATH=${PWD}</b> <br> -<b>export LD_LIBRARY_PATH=${PWD}</b> (if using bash or sh shell) +<b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers) </blockquote> <p> @@ -253,7 +255,7 @@ Retrace your steps if this doesn't look right. </p> -<H3>1.4 Installing the header and library files</H3> +<H3>1.6 Installing the header and library files</H3> <p> The standard location for the OpenGL header files on Unix-type systems is @@ -293,7 +295,7 @@ This is a handy way to compare multiple OpenGL implementations. </p> -<H3>1.5 pkg-config support</H3> +<H3>1.7 Building OpenGL Programs With pkg-config</H3> <p> Running <code>make install</code> will install package configuration files diff --git a/docs/relnotes-7.1.html b/docs/relnotes-7.1.html index 39745937482..5a9a044ce2b 100644 --- a/docs/relnotes-7.1.html +++ b/docs/relnotes-7.1.html @@ -8,10 +8,13 @@ <body bgcolor="#eeeeee"> -<H1>Mesa 7.1 Release Notes / (<em>in progress</em>)</H1> +<H1>Mesa 7.1 Release Notes / May XX, 2008</H1> <p> Mesa 7.1 is a new development release. +There have been many internal code changes since Mesa 7.0.x. +It should be relatively stable, but those who are especially concerned about +stability should wait for Mesa 7.2. </p> @@ -23,21 +26,13 @@ TBD <h2>New features</h2> <ul> +<li>autoconf-based configuration +<li>Reduced dependencies between X server and Mesa <li>GL_EXT_texture_from_pixmap extension for Xlib driver <li>Support for the GL shading language with i965 driver (implemented by Intel) </ul> -<h2>Bug fixes</h2> -<ul> -</ul> - - -<h2>Internal code changes</h2> -<ul> -</ul> - - <h2>To Do (someday) items</h2> <ul> <li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy(). diff --git a/doxygen/Makefile b/doxygen/Makefile index d8dd555b05e..15ade4043b8 100644 --- a/doxygen/Makefile +++ b/doxygen/Makefile @@ -29,5 +29,5 @@ subset: $(SUBSET:.doxy=.tag) $(foreach FILE,$(SUBSET),doxygen $(FILE);) clean: - rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=) - rm -rf *.tag + -rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=) + -rm -rf *.tag diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 1bfb5efb2c8..033d7a4ae44 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -67,6 +67,7 @@ typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtens typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension; typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension; +typedef struct __DRIswrastExtensionRec __DRIswrastExtension; /*@}*/ @@ -256,6 +257,7 @@ typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension; typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension; typedef struct __DRIdamageExtensionRec __DRIdamageExtension; typedef struct __DRIloaderExtensionRec __DRIloaderExtension; +typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension; /** @@ -357,6 +359,40 @@ struct __DRIloaderExtensionRec { int num_rects, void *loaderPrivate); }; +#define __DRI_SWRAST_IMAGE_OP_DRAW 1 +#define __DRI_SWRAST_IMAGE_OP_CLEAR 2 +#define __DRI_SWRAST_IMAGE_OP_SWAP 3 + +/** + * SWRast Loader extension. + */ +#define __DRI_SWRAST_LOADER "DRI_SWRastLoader" +#define __DRI_SWRAST_LOADER_VERSION 1 +struct __DRIswrastLoaderExtensionRec { + __DRIextension base; + + /* + * Drawable position and size + */ + void (*getDrawableInfo)(__DRIdrawable *drawable, + int *x, int *y, int *width, int *height, + void *loaderPrivate); + + /** + * Put image to drawable + */ + void (*putImage)(__DRIdrawable *drawable, int op, + int x, int y, int width, int height, char *data, + void *loaderPrivate); + + /** + * Get image from drawable + */ + void (*getImage)(__DRIdrawable *drawable, + int x, int y, int width, int height, char *data, + void *loaderPrivate); +}; + /** * The remaining extensions describe driver extensions, immediately * available interfaces provided by the driver. To start using the @@ -569,4 +605,25 @@ struct __DRIlegacyExtensionRec { void *loaderPrivate); }; +/** + * This extension provides alternative screen, drawable and context + * constructors for swrast DRI functionality. This is used in + * conjunction with the core extension. + */ +#define __DRI_SWRAST "DRI_SWRast" +#define __DRI_SWRAST_VERSION 1 + +struct __DRIswrastExtensionRec { + __DRIextension base; + + __DRIscreen *(*createNewScreen)(int screen, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, + void *loaderPrivate); + + __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, + const __DRIconfig *config, + void *loaderPrivate); +}; + #endif diff --git a/include/GL/internal/glcore.h b/include/GL/internal/glcore.h index ae1955a77dd..1bb63c1aee6 100644 --- a/include/GL/internal/glcore.h +++ b/include/GL/internal/glcore.h @@ -181,77 +181,4 @@ typedef struct __GLcontextModesRec { #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 - -/************************************************************************/ - -#ifdef _NEED_GL_CORE_IF - -/** - * The GLcore interface (a subset of the XMesa interface) - */ -#define __GL_CORE "GL_Core" - -typedef struct __GLcoreModuleRec { - /* - * XMesaVisual - */ - XMesaVisual (*XMesaCreateVisual)( ScreenPtr display, - VisualPtr visinfo, - GLboolean rgb_flag, - GLboolean alpha_flag, - GLboolean db_flag, - GLboolean stereo_flag, - GLboolean ximage_flag, - GLint depth_size, - GLint stencil_size, - GLint accum_red_size, - GLint accum_green_size, - GLint accum_blue_size, - GLint accum_alpha_size, - GLint num_samples, - GLint level, - GLint visualCaveat ); - - void (*XMesaDestroyVisual)( XMesaVisual v ); - - /* - * XMesaBuffer - */ - XMesaBuffer (*XMesaCreateWindowBuffer)( XMesaVisual v, - WindowPtr w ); - - XMesaBuffer (*XMesaCreatePixmapBuffer)( XMesaVisual v, - PixmapPtr p, - ColormapPtr cmap ); - - void (*XMesaDestroyBuffer)( XMesaBuffer b ); - - void (*XMesaSwapBuffers)( XMesaBuffer b ); - - void (*XMesaResizeBuffers)( XMesaBuffer b ); - - /* - * XMesaContext - */ - XMesaContext (*XMesaCreateContext)( XMesaVisual v, - XMesaContext share_list ); - - void (*XMesaDestroyContext)( XMesaContext c ); - - GLboolean (*XMesaCopyContext)( XMesaContext src, - XMesaContext dst, - GLuint mask ); - - GLboolean (*XMesaMakeCurrent2)( XMesaContext c, - XMesaBuffer drawBuffer, - XMesaBuffer readBuffer ); - - GLboolean (*XMesaForceCurrent)( XMesaContext c ); - - GLboolean (*XMesaLoseCurrent)( XMesaContext c ); - -} __GLcoreModule; - -#endif /* _NEED_GL_CORE_IF */ - #endif /* __gl_core_h_ */ diff --git a/include/GL/wmesa.h b/include/GL/wmesa.h index 1c959a6792c..f5f4f273ba9 100644 --- a/include/GL/wmesa.h +++ b/include/GL/wmesa.h @@ -130,7 +130,7 @@ extern void WMesaPaletteChange(HPALETTE Pal); extern void WMesaMove(void); - +void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx); #ifdef __cplusplus } diff --git a/progs/Makefile b/progs/Makefile index 5e705efa7ee..c99f4eebcc1 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -25,7 +25,7 @@ subdirs: install: clean: - @for dir in $(SUBDIRS) tests ; do \ + -@for dir in $(SUBDIRS) tests ; do \ if [ -d $$dir ] ; then \ (cd $$dir && $(MAKE) clean) ; \ fi \ diff --git a/progs/beos/Makefile b/progs/beos/Makefile index 491e8e442d1..0dc4cdce632 100644 --- a/progs/beos/Makefile +++ b/progs/beos/Makefile @@ -19,8 +19,8 @@ INCLUDES = -I. -I- -I../../include default: demo sample GLInfo clean: - rm -f demo sample GLInfo - rm -f *.o + -rm -f demo sample GLInfo + -rm -f *.o demo: demo.o $(LD) demo.o $(LDFLAGS) $(LIBS) -o $@ diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 01b76ad1050..7fde77f0b41 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -11,9 +11,11 @@ OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS) OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS) -LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) +LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \ + $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) -lX11 -lXi -lXmu +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ + $(APP_LIB_DEPS) PROGS = \ arbfplight \ diff --git a/progs/egl/Makefile b/progs/egl/Makefile index 07215604d3b..416d2c04b22 100644 --- a/progs/egl/Makefile +++ b/progs/egl/Makefile @@ -60,6 +60,6 @@ eglgears.o: eglgears.c $(HEADERS) clean: - rm -f *.o *~ - rm -f *.so - rm -f $(PROGRAMS) + -rm -f *.o *~ + -rm -f *.so + -rm -f $(PROGRAMS) diff --git a/progs/fbdev/Makefile b/progs/fbdev/Makefile index 56daf56f8a7..39401243e50 100644 --- a/progs/fbdev/Makefile +++ b/progs/fbdev/Makefile @@ -37,8 +37,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) default: depend $(PROGS) clean: - rm -f $(PROGS) - rm -f *.o + -rm -f $(PROGS) + -rm -f *.o depend: $(SOURCES) diff --git a/progs/fp/Makefile b/progs/fp/Makefile index a395b734ef6..09f22d1a7b5 100644 --- a/progs/fp/Makefile +++ b/progs/fp/Makefile @@ -86,9 +86,9 @@ UTIL_FILES = readtex.h readtex.c default: $(UTIL_FILES) $(PROGS) clean: - rm -f $(PROGS) - rm -f *.o - rm -f getproclist.h + -rm -f $(PROGS) + -rm -f *.o + -rm -f getproclist.h # auto code generation diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index ff8fbeb99bb..e3f205cdb92 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -15,6 +15,7 @@ PROGS = \ bump \ deriv \ mandelbrot \ + multitex \ noise \ points \ texdemo1 \ @@ -102,6 +103,13 @@ mandelbrot: mandelbrot.o shaderutil.o $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) mandelbrot.o shaderutil.o $(LIBS) -o $@ +multitex.o: multitex.c extfuncs.h readtex.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) multitex.c + +multitex: multitex.o readtex.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) multitex.o readtex.o shaderutil.o $(LIBS) -o $@ + + noise.o: noise.c extfuncs.h shaderutil.h $(CC) -c -I$(INCDIR) $(CFLAGS) noise.c diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c new file mode 100644 index 00000000000..5574ed4139f --- /dev/null +++ b/progs/glsl/multitex.c @@ -0,0 +1,285 @@ +/** + * Test multi-texturing with GL shading language. + * + * Copyright (C) 2008 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. + */ + + + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "GL/glut.h" +#include "readtex.h" +#include "extfuncs.h" +#include "shaderutil.h" + +static const char *Demo = "multitex"; + +static const char *VertFile = "multitex.vert.txt"; +static const char *FragFile = "multitex.frag.txt"; + +static const char *TexFiles[2] = + { + "../images/tile.rgb", + "../images/tree2.rgba" + }; + + +static GLuint Program; + +static GLfloat Xrot = -90.0, Yrot = .0, Zrot = 0.0; +static GLfloat EyeDist = 10; +static GLboolean Anim = GL_TRUE; + + +/* value[0] = tex unit */ +static struct uniform_info Uniforms[] = { + { "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 }, + { "tex2", 1, GL_INT, { 1, 0, 0, 0 }, -1 }, + END_OF_UNIFORMS +}; + + +static void +DrawPolygon(GLfloat size) +{ + glPushMatrix(); + glRotatef(90, 1, 0, 0); + glNormal3f(0, 0, 1); + glBegin(GL_POLYGON); + + glMultiTexCoord2f(GL_TEXTURE0, 0, 0); + glMultiTexCoord2f(GL_TEXTURE1, 0, 0); + glVertex2f(-size, -size); + + glMultiTexCoord2f(GL_TEXTURE0, 2, 0); + glMultiTexCoord2f(GL_TEXTURE1, 1, 0); + glVertex2f( size, -size); + + glMultiTexCoord2f(GL_TEXTURE0, 2, 2); + glMultiTexCoord2f(GL_TEXTURE1, 1, 1); + glVertex2f( size, size); + + glMultiTexCoord2f(GL_TEXTURE0, 0, 2); + glMultiTexCoord2f(GL_TEXTURE1, 0, 1); + glVertex2f(-size, size); + + glEnd(); + glPopMatrix(); +} + + +static void +draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); /* modelview matrix */ + glTranslatef(0.0, 0.0, -EyeDist); + glRotatef(Zrot, 0, 0, 1); + glRotatef(Yrot, 0, 1, 0); + glRotatef(Xrot, 1, 0, 0); + + DrawPolygon(3.0); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void +idle(void) +{ + GLfloat t = 0.05 * glutGet(GLUT_ELAPSED_TIME); + Yrot = t; + glutPostRedisplay(); +} + + +static void +key(unsigned char k, int x, int y) +{ + (void) x; + (void) y; + switch (k) { + case ' ': + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc(idle); + else + glutIdleFunc(NULL); + break; + case 'z': + EyeDist -= 0.5; + if (EyeDist < 3.0) + EyeDist = 3.0; + break; + case 'Z': + EyeDist += 0.5; + if (EyeDist > 90.0) + EyeDist = 90; + break; + case 27: + exit(0); + } + glutPostRedisplay(); +} + + +static void +specialkey(int key, int x, int y) +{ + GLfloat step = 2.0; + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + Xrot += step; + break; + case GLUT_KEY_DOWN: + Xrot -= step; + break; + case GLUT_KEY_LEFT: + Yrot -= step; + break; + case GLUT_KEY_RIGHT: + Yrot += step; + break; + } + glutPostRedisplay(); +} + + +/* new window size or exposure */ +static void +Reshape(int width, int height) +{ + GLfloat ar = (float) width / (float) height; + glViewport(0, 0, (GLint)width, (GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-2.0*ar, 2.0*ar, -2.0, 2.0, 4.0, 100.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + + +static void +InitTextures(void) +{ + GLenum filter = GL_LINEAR; + int i; + + for (i = 0; i < 2; i++) { + GLint imgWidth, imgHeight; + GLenum imgFormat; + GLubyte *image = NULL; + + image = LoadRGBImage(TexFiles[i], &imgWidth, &imgHeight, &imgFormat); + if (!image) { + printf("Couldn't read %s\n", TexFiles[i]); + exit(0); + } + + glActiveTexture(GL_TEXTURE0 + i); + glBindTexture(GL_TEXTURE_2D, 42 + i); + gluBuild2DMipmaps(GL_TEXTURE_2D, 4, imgWidth, imgHeight, + imgFormat, GL_UNSIGNED_BYTE, image); + free(image); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); + } +} + + +static GLuint +CreateProgram(const char *vertProgFile, const char *fragProgFile, + struct uniform_info *uniforms) +{ + GLuint fragShader, vertShader, program; + + vertShader = CompileShaderFile(GL_VERTEX_SHADER, vertProgFile); + fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile); + assert(vertShader); + program = LinkShaders(vertShader, fragShader); + + glUseProgram_func(program); + + InitUniforms(program, uniforms); + + return program; +} + + +static void +InitPrograms(void) +{ + Program = CreateProgram(VertFile, FragFile, Uniforms); +} + + +static void +InitGL(void) +{ + const char *version = (const char *) glGetString(GL_VERSION); + + if (version[0] != '2' || version[1] != '.') { + printf("Warning: this program expects OpenGL 2.0\n"); + /*exit(1);*/ + } + printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); + + GetExtensionFuncs(); + + InitTextures(); + InitPrograms(); + + glEnable(GL_DEPTH_TEST); + + glClearColor(.6, .6, .9, 0); + glColor3f(1.0, 1.0, 1.0); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowSize(500, 400); + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + glutCreateWindow(Demo); + glutReshapeFunc(Reshape); + glutKeyboardFunc(key); + glutSpecialFunc(specialkey); + glutDisplayFunc(draw); + if (Anim) + glutIdleFunc(idle); + InitGL(); + glutMainLoop(); + return 0; +} diff --git a/progs/glsl/multitex.frag.txt b/progs/glsl/multitex.frag.txt new file mode 100644 index 00000000000..86045306af2 --- /dev/null +++ b/progs/glsl/multitex.frag.txt @@ -0,0 +1,15 @@ +// Multi-texture fragment shader +// Brian Paul + +// Composite second texture over first. +// We're assuming the 2nd texture has a meaningful alpha channel. + +uniform sampler2D tex1; +uniform sampler2D tex2; + +void main() +{ + vec4 t1 = texture2D(tex1, gl_TexCoord[0].xy, 0.0); + vec4 t2 = texture2D(tex2, gl_TexCoord[1].xy, 0.0); + gl_FragColor = mix(t1, t2, t2.w); +} diff --git a/progs/glsl/multitex.vert.txt b/progs/glsl/multitex.vert.txt new file mode 100644 index 00000000000..5518ca1ddd8 --- /dev/null +++ b/progs/glsl/multitex.vert.txt @@ -0,0 +1,10 @@ +// Multi-texture vertex shader +// Brian Paul + + +void main() +{ + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[1] = gl_MultiTexCoord1; + gl_Position = ftransform(); +} diff --git a/progs/miniglx/Makefile b/progs/miniglx/Makefile index 5d0c8eae64f..d5258b0a966 100644 --- a/progs/miniglx/Makefile +++ b/progs/miniglx/Makefile @@ -43,8 +43,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS default: depend $(PROGS) clean: - rm -f $(PROGS) - rm -f *.o + -rm -f $(PROGS) + -rm -f *.o depend: $(SOURCES) diff --git a/progs/slang/Makefile b/progs/slang/Makefile index ea1e9b6afdd..c93caeab619 100644 --- a/progs/slang/Makefile +++ b/progs/slang/Makefile @@ -24,7 +24,7 @@ tests: default ! ./cltest 2> /dev/null | (grep -e ^[*][*][*]) clean: - rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest + -rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest # # executables diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 116a19b1f5b..cf8e0bfc1e5 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -99,9 +99,9 @@ UTIL_FILES = readtex.h readtex.c default: $(UTIL_FILES) $(PROGS) clean: - rm -f $(PROGS) - rm -f *.o - rm -f getproclist.h + -rm -f $(PROGS) + -rm -f *.o + -rm -f getproclist.h ##### RULES ##### diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c index 18f28972b6e..5283c7e1fd6 100644 --- a/progs/tests/fbotest2.c +++ b/progs/tests/fbotest2.c @@ -68,6 +68,7 @@ Display( void ) /* draw to window */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ glWindowPos2iARB(0, 0); glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); diff --git a/progs/tests/mipmap_limits.c b/progs/tests/mipmap_limits.c index d6d6e467b0f..8bdad826f7c 100644 --- a/progs/tests/mipmap_limits.c +++ b/progs/tests/mipmap_limits.c @@ -59,6 +59,18 @@ static GLfloat LodBias = 0.0; static GLboolean NearestFilter = GL_TRUE; +static void +InitValues(void) +{ + BaseLevel = 0; + MaxLevel = 8; + MinLod = -1; + MaxLod = 9; + LodBias = 0.0; + NearestFilter = GL_TRUE; +} + + static void MakeImage(int level, int width, int height, const GLubyte color[4]) { const int makeStripes = 0; @@ -108,6 +120,8 @@ static void makeImages(void) static void myinit(void) { + InitValues(); + glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glShadeModel(GL_FLAT); @@ -125,7 +139,7 @@ static void myinit(void) static void display(void) { GLfloat tcm = 4.0; - printf("BASE_LEVEL = %d MAX_LEVEL = %d MIN_LOD = %f MAX_LOD = %f Bias = %.2g filter = %s\n", + printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n", BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, NearestFilter ? "NEAREST" : "LINEAR"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); @@ -214,6 +228,9 @@ key(unsigned char k, int x, int y) case 'f': NearestFilter = !NearestFilter; break; + case ' ': + InitValues(); + break; case 27: /* Escape */ exit(0); break; @@ -227,12 +244,13 @@ key(unsigned char k, int x, int y) static void usage(void) { printf("usage:\n"); - printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n"); - printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n"); - printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n"); - printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n"); - printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n"); - printf(" f toggle nearest/linear filtering\n"); + printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n"); + printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n"); + printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n"); + printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n"); + printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n"); + printf(" f toggle nearest/linear filtering\n"); + printf(" SPACE reset values\n"); } diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 7610a5df08c..6fa51ce2cfe 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -102,9 +102,9 @@ UTIL_FILES = readtex.h readtex.c default: $(UTIL_FILES) $(PROGS) clean: - rm -f $(PROGS) - rm -f *.o - rm -f getproclist.h + -rm -f $(PROGS) + -rm -f *.o + -rm -f getproclist.h # auto code generation diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c index 58a650b559f..d4a7f08ae34 100644 --- a/progs/trivial/tri.c +++ b/progs/trivial/tri.c @@ -33,6 +33,7 @@ GLenum doubleBuffer; +int win; static void Init(void) { @@ -59,7 +60,8 @@ static void Key(unsigned char key, int x, int y) switch (key) { case 27: - exit(1); + glutDestroyWindow(win); + exit(0); default: return; } @@ -122,7 +124,8 @@ int main(int argc, char **argv) type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; glutInitDisplayMode(type); - if (glutCreateWindow("First Tri") == GL_FALSE) { + win = glutCreateWindow("First Tri"); + if (!win) { exit(1); } diff --git a/progs/vp/Makefile b/progs/vp/Makefile index 3349fd53428..28d63237a45 100644 --- a/progs/vp/Makefile +++ b/progs/vp/Makefile @@ -40,9 +40,9 @@ INCLUDES = -I. -I$(TOP)/include -I../samples default: $(PROGS) clean: - rm -f $(PROGS) - rm -f *.o - rm -f getproclist.h + -rm -f $(PROGS) + -rm -f *.o + -rm -f getproclist.h diff --git a/progs/xdemos/.gitignore b/progs/xdemos/.gitignore index 23e7c3ea182..868249db884 100644 --- a/progs/xdemos/.gitignore +++ b/progs/xdemos/.gitignore @@ -16,6 +16,7 @@ offset overlay pbdemo pbinfo +sharedtex texture_from_pixmap wincopy xdemo diff --git a/progs/xdemos/glthreads.c b/progs/xdemos/glthreads.c index e9c654c649d..4f87ee75d40 100644 --- a/progs/xdemos/glthreads.c +++ b/progs/xdemos/glthreads.c @@ -24,6 +24,7 @@ * This program tests GLX thread safety. * Command line options: * -p Open a display connection for each thread + * -l Enable application-side locking * -n <num threads> Number of threads to create (default is 2) * -display <display name> Specify X display (default is :0.0) * @@ -405,6 +406,19 @@ clean_up(void) } +static void +usage(void) +{ + printf("glthreads: test of GL thread safety (any key = exit)\n"); + printf("Usage:\n"); + printf(" glthreads [options]\n"); + printf("Options:\n"); + printf(" -display DISPLAYNAME Specify display string\n"); + printf(" -n NUMTHREADS Number of threads to create\n"); + printf(" -p Use a separate display connection for each thread\n"); + printf(" -l Use application-side locking\n"); +} + int main(int argc, char *argv[]) @@ -416,9 +430,7 @@ main(int argc, char *argv[]) Status threadStat; if (argc == 1) { - printf("glthreads: test of GL thread safety (any key = exit)\n"); - printf("Usage:\n"); - printf(" glthreads [-display dpyName] [-n numthreads]\n"); + usage(); } else { int i; @@ -442,13 +454,14 @@ main(int argc, char *argv[]) i++; } else { - fprintf(stderr, "glthreads: unexpected flag: %s\n", argv[i]); + usage(); + exit(1); } } } if (Locking) - printf("glthreads: Using explict locks around Xlib calls.\n"); + printf("glthreads: Using explicit locks around Xlib calls.\n"); else printf("glthreads: No explict locking.\n"); diff --git a/src/Makefile b/src/Makefile index f93987e6880..229beeaffa5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -33,7 +33,7 @@ $(TOP)/$(LIB_DIR): clean: - @for dir in $(SUBDIRS) ; do \ + -@for dir in $(SUBDIRS) ; do \ if [ -d $$dir ] ; then \ (cd $$dir && $(MAKE) clean) ; \ fi \ diff --git a/src/egl/Makefile b/src/egl/Makefile index 931e9d0cb86..fb4db8f9b9f 100644 --- a/src/egl/Makefile +++ b/src/egl/Makefile @@ -11,14 +11,14 @@ default: subdirs subdirs: @for dir in $(SUBDIRS) ; do \ if [ -d $$dir ] ; then \ - (cd $$dir ; $(MAKE)) || exit 1 ; \ + (cd $$dir && $(MAKE)) || exit 1 ; \ fi \ done clean: - @for dir in $(SUBDIRS) ; do \ + -@for dir in $(SUBDIRS) ; do \ if [ -d $$dir ] ; then \ - (cd $$dir ; $(MAKE) clean) ; \ + (cd $$dir && $(MAKE) clean) ; \ fi \ done diff --git a/src/egl/drivers/demo/Makefile b/src/egl/drivers/demo/Makefile index ad2ef38a72f..9653c8805cc 100644 --- a/src/egl/drivers/demo/Makefile +++ b/src/egl/drivers/demo/Makefile @@ -27,5 +27,5 @@ $(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS) clean: - rm -f *.o - rm -f *.so + -rm -f *.o + -rm -f *.so diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile index 0214cf65a25..52d46cac564 100644 --- a/src/egl/drivers/dri/Makefile +++ b/src/egl/drivers/dri/Makefile @@ -47,8 +47,8 @@ $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS) clean: - rm -f *.o - rm -f *.so + -rm -f *.o + -rm -f *.so depend: $(SOURCES) $(HEADERS) @ echo "running $(MKDEP)" diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index 2a7046fb145..52e16a76e3a 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -52,8 +52,8 @@ $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) clean: - rm -f *.o *.so* - rm -f core.* + -rm -f *.o *.so* + -rm -f core.* depend: $(SOURCES) $(HEADERS) diff --git a/src/glu/Makefile b/src/glu/Makefile index 836baa684cb..23161b50156 100644 --- a/src/glu/Makefile +++ b/src/glu/Makefile @@ -10,7 +10,7 @@ SUBDIRS = $(GLU_DIRS) default: $(TOP)/configs/current @for dir in $(SUBDIRS) ; do \ - (cd $$dir ; $(MAKE)) ; \ + (cd $$dir && $(MAKE)) || exit 1 ; \ done # GLU pkg-config file @@ -28,6 +28,6 @@ install: glu.pc $(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig clean: - @for dir in $(SUBDIRS) ; do \ - (cd $$dir ; $(MAKE) clean) ; \ + -@for dir in $(SUBDIRS) ; do \ + (cd $$dir && $(MAKE) clean) ; \ done diff --git a/src/glu/mesa/Makefile b/src/glu/mesa/Makefile index fb377555bea..1064bbd2d4f 100644 --- a/src/glu/mesa/Makefile +++ b/src/glu/mesa/Makefile @@ -37,7 +37,7 @@ default: echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \ exit 0 ; \ else \ - $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) ; \ + $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \ fi $(TOP)/$(LIB_DIR): diff --git a/src/glu/sgi/Makefile b/src/glu/sgi/Makefile index bb1c0a8aba5..207247ad87a 100644 --- a/src/glu/sgi/Makefile +++ b/src/glu/sgi/Makefile @@ -128,7 +128,7 @@ default: echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \ exit 0 ; \ else \ - $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) ; \ + $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \ fi $(TOP)/$(LIB_DIR): diff --git a/src/glut/directfb/Makefile b/src/glut/directfb/Makefile index aa77db91c6c..36b0ea34ed5 100644 --- a/src/glut/directfb/Makefile +++ b/src/glut/directfb/Makefile @@ -80,7 +80,7 @@ tags: # Remove .o and backup files clean: depend - -rm -f depend + -rm -f depend depend.bak -rm -f *.o *~ *.o *~ *.so libglut.so.3.7 include depend diff --git a/src/glut/fbdev/Makefile b/src/glut/fbdev/Makefile index 948be0c7ba3..95893b7dd1b 100644 --- a/src/glut/fbdev/Makefile +++ b/src/glut/fbdev/Makefile @@ -87,7 +87,7 @@ tags: # Remove .o and backup files clean: depend - -rm -f depend + -rm -f depend depend.bak -rm -f *.o *~ *.o *~ *.so libglut.so.3.7 include depend diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile index 46185cebbc0..674d5a5dcef 100644 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@ -119,7 +119,7 @@ clean: -rm -f *.lo -rm -f *.la -rm -rf .libs - -rm -rf depend depend.bak + -rm -f depend depend.bak depend: $(SOURCES) diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile index a73198a68cc..d3860503901 100644 --- a/src/glut/mini/Makefile +++ b/src/glut/mini/Makefile @@ -91,7 +91,7 @@ install: glut.pc # Remove .o and backup files clean: depend - -rm -f depend + -rm -f depend depend.bak -rm -f *.o *~ *.o *~ *.so libglut.so.3.7 include depend diff --git a/src/glw/Makefile b/src/glw/Makefile index ce6a30e9de3..88bf99d44f3 100644 --- a/src/glw/Makefile +++ b/src/glw/Makefile @@ -42,7 +42,7 @@ install: glw.pc $(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig clean: - -rm depend depend.bak + -rm -f depend depend.bak -rm -f *.o *~ diff --git a/src/glx/Makefile b/src/glx/Makefile index bd486cf81b3..e0ab4a02401 100644 --- a/src/glx/Makefile +++ b/src/glx/Makefile @@ -4,9 +4,9 @@ include $(TOP)/configs/current default: - cd mini ; $(MAKE) + cd mini && $(MAKE) clean: - cd mini ; $(MAKE) clean + -@cd mini && $(MAKE) clean diff --git a/src/glx/mini/Makefile b/src/glx/mini/Makefile index 7ed2146d562..69c3d683e8c 100644 --- a/src/glx/mini/Makefile +++ b/src/glx/mini/Makefile @@ -83,6 +83,6 @@ install: clean: -rm -f drmtest $(TOP)/$(LIB_DIR)/libGL.so* -rm -f *.o *~ - -rm -f depend + -rm -f depend depend.bak include depend diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile index f12d1f70dc8..894c3cf159e 100644 --- a/src/glx/x11/Makefile +++ b/src/glx/x11/Makefile @@ -85,12 +85,12 @@ tags: etags `find . -name \*.[ch]` `find $(TOP)/include` install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) - make -C $(TOP)/src/mesa install-libgl + $(MAKE) -C $(TOP)/src/mesa install-libgl # Remove .o and backup files clean: -rm -f $(TOP)/$(LIB_DIR)/libGL.so* -rm -f *.o *~ - -rm -f depend + -rm -f depend depend.bak -include depend diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index a58060da3a3..da4824f1725 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -84,7 +84,7 @@ struct __GLXDRIconfigPrivateRec { #ifndef DEFAULT_DRIVER_DIR /* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */ -#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri" +#define DEFAULT_DRIVER_DIR "/usr/local/lib/dri" #endif static void InfoMessageF(const char *f, ...) diff --git a/src/glx/x11/indirect_dispatch.c b/src/glx/x11/indirect_dispatch.c deleted file mode 100644 index 2afd3eb22f8..00000000000 --- a/src/glx/x11/indirect_dispatch.c +++ /dev/null @@ -1,5889 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ - -/* - * (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 - * 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 THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include <X11/Xmd.h> -#include <GL/gl.h> -#include <GL/glxproto.h> -#include <inttypes.h> -#include "indirect_size.h" -#include "indirect_size_get.h" -#include "indirect_dispatch.h" -#include "glxserver.h" -#include "glxbyteorder.h" -#include "indirect_util.h" -#include "singlesize.h" -#include "glapitable.h" -#include "glapi.h" -#include "glthread.h" -#include "dispatch.h" - -#define __GLX_PAD(x) (((x) + 3) & ~3) - -typedef struct { - __GLX_PIXEL_3D_HDR; -} __GLXpixel3DHeader; - -extern GLboolean __glXErrorOccured( void ); -extern void __glXClearErrorOccured( void ); - -static const unsigned dummy_answer[2] = {0, 0}; - -int __glXDisp_NewList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_NewList( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_EndList( GET_DISPATCH(), () ); - error = Success; - } - - return error; -} - -void __glXDisp_CallList(GLbyte * pc) -{ - CALL_CallList( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_CallLists(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - const GLenum type = *(GLenum *)(pc + 4); - const GLvoid * lists = (const GLvoid *)(pc + 8); - - lists = (const GLvoid *) (pc + 8); - - CALL_CallLists( GET_DISPATCH(), ( - n, - type, - lists - ) ); -} - -int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_DeleteLists( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - *(GLsizei *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_GenLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLuint retval; - retval = CALL_GenLists( GET_DISPATCH(), ( - *(GLsizei *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_ListBase(GLbyte * pc) -{ - CALL_ListBase( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Begin(GLbyte * pc) -{ - CALL_Begin( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Bitmap(GLbyte * pc) -{ - const GLubyte * const bitmap = (const GLubyte *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_Bitmap( GET_DISPATCH(), ( - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLfloat *)(pc + 28), - *(GLfloat *)(pc + 32), - *(GLfloat *)(pc + 36), - *(GLfloat *)(pc + 40), - bitmap - ) ); -} - -void __glXDisp_Color3bv(GLbyte * pc) -{ - CALL_Color3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Color3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Color3fv(GLbyte * pc) -{ - CALL_Color3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Color3iv(GLbyte * pc) -{ - CALL_Color3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Color3sv(GLbyte * pc) -{ - CALL_Color3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Color3ubv(GLbyte * pc) -{ - CALL_Color3ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color3uiv(GLbyte * pc) -{ - CALL_Color3uiv( GET_DISPATCH(), ( - (const GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Color3usv(GLbyte * pc) -{ - CALL_Color3usv( GET_DISPATCH(), ( - (const GLushort *)(pc + 0) - ) ); -} - -void __glXDisp_Color4bv(GLbyte * pc) -{ - CALL_Color4bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Color4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Color4fv(GLbyte * pc) -{ - CALL_Color4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Color4iv(GLbyte * pc) -{ - CALL_Color4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Color4sv(GLbyte * pc) -{ - CALL_Color4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Color4ubv(GLbyte * pc) -{ - CALL_Color4ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color4uiv(GLbyte * pc) -{ - CALL_Color4uiv( GET_DISPATCH(), ( - (const GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Color4usv(GLbyte * pc) -{ - CALL_Color4usv( GET_DISPATCH(), ( - (const GLushort *)(pc + 0) - ) ); -} - -void __glXDisp_EdgeFlagv(GLbyte * pc) -{ - CALL_EdgeFlagv( GET_DISPATCH(), ( - (const GLboolean *)(pc + 0) - ) ); -} - -void __glXDisp_End(GLbyte * pc) -{ - CALL_End( GET_DISPATCH(), () ); -} - -void __glXDisp_Indexdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_Indexdv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Indexfv(GLbyte * pc) -{ - CALL_Indexfv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Indexiv(GLbyte * pc) -{ - CALL_Indexiv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Indexsv(GLbyte * pc) -{ - CALL_Indexsv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3bv(GLbyte * pc) -{ - CALL_Normal3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Normal3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3fv(GLbyte * pc) -{ - CALL_Normal3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3iv(GLbyte * pc) -{ - CALL_Normal3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3sv(GLbyte * pc) -{ - CALL_Normal3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_RasterPos2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2fv(GLbyte * pc) -{ - CALL_RasterPos2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2iv(GLbyte * pc) -{ - CALL_RasterPos2iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2sv(GLbyte * pc) -{ - CALL_RasterPos2sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_RasterPos3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3fv(GLbyte * pc) -{ - CALL_RasterPos3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3iv(GLbyte * pc) -{ - CALL_RasterPos3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3sv(GLbyte * pc) -{ - CALL_RasterPos3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_RasterPos4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4fv(GLbyte * pc) -{ - CALL_RasterPos4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4iv(GLbyte * pc) -{ - CALL_RasterPos4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4sv(GLbyte * pc) -{ - CALL_RasterPos4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Rectdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rectdv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0), - (const GLdouble *)(pc + 16) - ) ); -} - -void __glXDisp_Rectfv(GLbyte * pc) -{ - CALL_Rectfv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Rectiv(GLbyte * pc) -{ - CALL_Rectiv( GET_DISPATCH(), ( - (const GLint *)(pc + 0), - (const GLint *)(pc + 8) - ) ); -} - -void __glXDisp_Rectsv(GLbyte * pc) -{ - CALL_Rectsv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_TexCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_TexCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord1fv(GLbyte * pc) -{ - CALL_TexCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord1iv(GLbyte * pc) -{ - CALL_TexCoord1iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord1sv(GLbyte * pc) -{ - CALL_TexCoord1sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2fv(GLbyte * pc) -{ - CALL_TexCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2iv(GLbyte * pc) -{ - CALL_TexCoord2iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2sv(GLbyte * pc) -{ - CALL_TexCoord2sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_TexCoord3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3fv(GLbyte * pc) -{ - CALL_TexCoord3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3iv(GLbyte * pc) -{ - CALL_TexCoord3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3sv(GLbyte * pc) -{ - CALL_TexCoord3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_TexCoord4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4fv(GLbyte * pc) -{ - CALL_TexCoord4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4iv(GLbyte * pc) -{ - CALL_TexCoord4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4sv(GLbyte * pc) -{ - CALL_TexCoord4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_Vertex2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2fv(GLbyte * pc) -{ - CALL_Vertex2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2iv(GLbyte * pc) -{ - CALL_Vertex2iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2sv(GLbyte * pc) -{ - CALL_Vertex2sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Vertex3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3fv(GLbyte * pc) -{ - CALL_Vertex3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3iv(GLbyte * pc) -{ - CALL_Vertex3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3sv(GLbyte * pc) -{ - CALL_Vertex3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Vertex4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4fv(GLbyte * pc) -{ - CALL_Vertex4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4iv(GLbyte * pc) -{ - CALL_Vertex4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4sv(GLbyte * pc) -{ - CALL_Vertex4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_ClipPlane(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_ClipPlane( GET_DISPATCH(), ( - *(GLenum *)(pc + 32), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_ColorMaterial(GLbyte * pc) -{ - CALL_ColorMaterial( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_CullFace(GLbyte * pc) -{ - CALL_CullFace( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Fogf(GLbyte * pc) -{ - CALL_Fogf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_Fogfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLfloat * params; - - params = (const GLfloat *) (pc + 4); - - CALL_Fogfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_Fogi(GLbyte * pc) -{ - CALL_Fogi( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_Fogiv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLint * params; - - params = (const GLint *) (pc + 4); - - CALL_Fogiv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_FrontFace(GLbyte * pc) -{ - CALL_FrontFace( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Hint(GLbyte * pc) -{ - CALL_Hint( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_Lightf(GLbyte * pc) -{ - CALL_Lightf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Lightfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_Lightfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_Lighti(GLbyte * pc) -{ - CALL_Lighti( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_Lightiv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_Lightiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_LightModelf(GLbyte * pc) -{ - CALL_LightModelf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_LightModelfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLfloat * params; - - params = (const GLfloat *) (pc + 4); - - CALL_LightModelfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_LightModeli(GLbyte * pc) -{ - CALL_LightModeli( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_LightModeliv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLint * params; - - params = (const GLint *) (pc + 4); - - CALL_LightModeliv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_LineStipple(GLbyte * pc) -{ - CALL_LineStipple( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLushort *)(pc + 4) - ) ); -} - -void __glXDisp_LineWidth(GLbyte * pc) -{ - CALL_LineWidth( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Materialf(GLbyte * pc) -{ - CALL_Materialf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Materialfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_Materialfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_Materiali(GLbyte * pc) -{ - CALL_Materiali( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_Materialiv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_Materialiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_PointSize(GLbyte * pc) -{ - CALL_PointSize( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_PolygonMode(GLbyte * pc) -{ - CALL_PolygonMode( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_PolygonStipple(GLbyte * pc) -{ - const GLubyte * const mask = (const GLubyte *) (pc + 20); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_PolygonStipple( GET_DISPATCH(), ( - mask - ) ); -} - -void __glXDisp_Scissor(GLbyte * pc) -{ - CALL_Scissor( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12) - ) ); -} - -void __glXDisp_ShadeModel(GLbyte * pc) -{ - CALL_ShadeModel( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_TexParameterf(GLbyte * pc) -{ - CALL_TexParameterf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_TexParameterfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_TexParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexParameteri(GLbyte * pc) -{ - CALL_TexParameteri( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_TexParameteriv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_TexParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexImage1D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLsizei *)(pc + 32), - *(GLint *)(pc + 40), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_TexImage2D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLsizei *)(pc + 32), - *(GLsizei *)(pc + 36), - *(GLint *)(pc + 40), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_TexEnvf(GLbyte * pc) -{ - CALL_TexEnvf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_TexEnvfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_TexEnvfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexEnvi(GLbyte * pc) -{ - CALL_TexEnvi( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_TexEnviv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_TexEnviv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexGend(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexGend( GET_DISPATCH(), ( - *(GLenum *)(pc + 8), - *(GLenum *)(pc + 12), - *(GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexGendv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLdouble * params; - -#ifdef __GLX_ALIGN64 - const GLuint compsize = __glTexGendv_size(pname); - const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - params = (const GLdouble *) (pc + 8); - - CALL_TexGendv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexGenf(GLbyte * pc) -{ - CALL_TexGenf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_TexGenfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_TexGenfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexGeni(GLbyte * pc) -{ - CALL_TexGeni( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_TexGeniv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_TexGeniv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_InitNames(GLbyte * pc) -{ - CALL_InitNames( GET_DISPATCH(), () ); -} - -void __glXDisp_LoadName(GLbyte * pc) -{ - CALL_LoadName( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_PassThrough(GLbyte * pc) -{ - CALL_PassThrough( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_PopName(GLbyte * pc) -{ - CALL_PopName( GET_DISPATCH(), () ); -} - -void __glXDisp_PushName(GLbyte * pc) -{ - CALL_PushName( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_DrawBuffer(GLbyte * pc) -{ - CALL_DrawBuffer( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Clear(GLbyte * pc) -{ - CALL_Clear( GET_DISPATCH(), ( - *(GLbitfield *)(pc + 0) - ) ); -} - -void __glXDisp_ClearAccum(GLbyte * pc) -{ - CALL_ClearAccum( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8), - *(GLfloat *)(pc + 12) - ) ); -} - -void __glXDisp_ClearIndex(GLbyte * pc) -{ - CALL_ClearIndex( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_ClearColor(GLbyte * pc) -{ - CALL_ClearColor( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLclampf *)(pc + 4), - *(GLclampf *)(pc + 8), - *(GLclampf *)(pc + 12) - ) ); -} - -void __glXDisp_ClearStencil(GLbyte * pc) -{ - CALL_ClearStencil( GET_DISPATCH(), ( - *(GLint *)(pc + 0) - ) ); -} - -void __glXDisp_ClearDepth(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_ClearDepth( GET_DISPATCH(), ( - *(GLclampd *)(pc + 0) - ) ); -} - -void __glXDisp_StencilMask(GLbyte * pc) -{ - CALL_StencilMask( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_ColorMask(GLbyte * pc) -{ - CALL_ColorMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0), - *(GLboolean *)(pc + 1), - *(GLboolean *)(pc + 2), - *(GLboolean *)(pc + 3) - ) ); -} - -void __glXDisp_DepthMask(GLbyte * pc) -{ - CALL_DepthMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0) - ) ); -} - -void __glXDisp_IndexMask(GLbyte * pc) -{ - CALL_IndexMask( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Accum(GLbyte * pc) -{ - CALL_Accum( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_Disable(GLbyte * pc) -{ - CALL_Disable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Enable(GLbyte * pc) -{ - CALL_Enable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_PopAttrib(GLbyte * pc) -{ - CALL_PopAttrib( GET_DISPATCH(), () ); -} - -void __glXDisp_PushAttrib(GLbyte * pc) -{ - CALL_PushAttrib( GET_DISPATCH(), ( - *(GLbitfield *)(pc + 0) - ) ); -} - -void __glXDisp_MapGrid1d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MapGrid1d( GET_DISPATCH(), ( - *(GLint *)(pc + 16), - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_MapGrid1f(GLbyte * pc) -{ - CALL_MapGrid1f( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_MapGrid2d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_MapGrid2d( GET_DISPATCH(), ( - *(GLint *)(pc + 32), - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLint *)(pc + 36), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24) - ) ); -} - -void __glXDisp_MapGrid2f(GLbyte * pc) -{ - CALL_MapGrid2f( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8), - *(GLint *)(pc + 12), - *(GLfloat *)(pc + 16), - *(GLfloat *)(pc + 20) - ) ); -} - -void __glXDisp_EvalCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_EvalCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_EvalCoord1fv(GLbyte * pc) -{ - CALL_EvalCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_EvalCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_EvalCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_EvalCoord2fv(GLbyte * pc) -{ - CALL_EvalCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_EvalMesh1(GLbyte * pc) -{ - CALL_EvalMesh1( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_EvalPoint1(GLbyte * pc) -{ - CALL_EvalPoint1( GET_DISPATCH(), ( - *(GLint *)(pc + 0) - ) ); -} - -void __glXDisp_EvalMesh2(GLbyte * pc) -{ - CALL_EvalMesh2( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16) - ) ); -} - -void __glXDisp_EvalPoint2(GLbyte * pc) -{ - CALL_EvalPoint2( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_AlphaFunc(GLbyte * pc) -{ - CALL_AlphaFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLclampf *)(pc + 4) - ) ); -} - -void __glXDisp_BlendFunc(GLbyte * pc) -{ - CALL_BlendFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_LogicOp(GLbyte * pc) -{ - CALL_LogicOp( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_StencilFunc(GLbyte * pc) -{ - CALL_StencilFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLuint *)(pc + 8) - ) ); -} - -void __glXDisp_StencilOp(GLbyte * pc) -{ - CALL_StencilOp( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8) - ) ); -} - -void __glXDisp_DepthFunc(GLbyte * pc) -{ - CALL_DepthFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_PixelZoom(GLbyte * pc) -{ - CALL_PixelZoom( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_PixelTransferf(GLbyte * pc) -{ - CALL_PixelTransferf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_PixelTransferi(GLbyte * pc) -{ - CALL_PixelTransferi( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -int __glXDisp_PixelStoref(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStoref( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStorei( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -void __glXDisp_PixelMapfv(GLbyte * pc) -{ - const GLsizei mapsize = *(GLsizei *)(pc + 4); - - CALL_PixelMapfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - mapsize, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_PixelMapuiv(GLbyte * pc) -{ - const GLsizei mapsize = *(GLsizei *)(pc + 4); - - CALL_PixelMapuiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - mapsize, - (const GLuint *)(pc + 8) - ) ); -} - -void __glXDisp_PixelMapusv(GLbyte * pc) -{ - const GLsizei mapsize = *(GLsizei *)(pc + 4); - - CALL_PixelMapusv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - mapsize, - (const GLushort *)(pc + 8) - ) ); -} - -void __glXDisp_ReadBuffer(GLbyte * pc) -{ - CALL_ReadBuffer( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_CopyPixels(GLbyte * pc) -{ - CALL_CopyPixels( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLenum *)(pc + 16) - ) ); -} - -void __glXDisp_DrawPixels(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 36); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_DrawPixels( GET_DISPATCH(), ( - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLenum *)(pc + 28), - *(GLenum *)(pc + 32), - pixels - ) ); -} - -int __glXDisp_GetBooleanv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetBooleanv_size(pname); - GLboolean answerBuffer[200]; - GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetBooleanv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 1, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLdouble equation[4]; - CALL_GetClipPlane( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - equation - ) ); - __glXSendReply(cl->client, equation, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetDoublev(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetDoublev_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetDoublev( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetError(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_GetError( GET_DISPATCH(), () ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_GetFloatv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetFloatv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetFloatv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetIntegerv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetIntegerv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetIntegerv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetLightfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetLightfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetLightiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = *(GLenum *)(pc + 0); - const GLenum query = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMapdv_size(target,query); - GLdouble answerBuffer[200]; - GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapdv( GET_DISPATCH(), ( - target, - query, - v - ) ); - __glXSendReply(cl->client, v, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = *(GLenum *)(pc + 0); - const GLenum query = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMapfv_size(target,query); - GLfloat answerBuffer[200]; - GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapfv( GET_DISPATCH(), ( - target, - query, - v - ) ); - __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = *(GLenum *)(pc + 0); - const GLenum query = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMapiv_size(target,query); - GLint answerBuffer[200]; - GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapiv( GET_DISPATCH(), ( - target, - query, - v - ) ); - __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMaterialfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMaterialiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetPixelMapfv_size(map); - GLfloat answerBuffer[200]; - GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapfv( GET_DISPATCH(), ( - map, - values - ) ); - __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetPixelMapuiv_size(map); - GLuint answerBuffer[200]; - GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapuiv( GET_DISPATCH(), ( - map, - values - ) ); - __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetPixelMapusv_size(map); - GLushort answerBuffer[200]; - GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapusv( GET_DISPATCH(), ( - map, - values - ) ); - __glXSendReply(cl->client, values, compsize, 2, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexEnvfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnvfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexEnviv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnviv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexGendv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexGendv_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGendv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexGenfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGenfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexGeniv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGeniv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 8); - - const GLuint compsize = __glGetTexLevelParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 8); - - const GLuint compsize = __glGetTexLevelParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsEnabled(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsEnabled( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_IsList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsList( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_DepthRange(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_DepthRange( GET_DISPATCH(), ( - *(GLclampd *)(pc + 0), - *(GLclampd *)(pc + 8) - ) ); -} - -void __glXDisp_Frustum(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Frustum( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24), - *(GLdouble *)(pc + 32), - *(GLdouble *)(pc + 40) - ) ); -} - -void __glXDisp_LoadIdentity(GLbyte * pc) -{ - CALL_LoadIdentity( GET_DISPATCH(), () ); -} - -void __glXDisp_LoadMatrixf(GLbyte * pc) -{ - CALL_LoadMatrixf( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_LoadMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_LoadMatrixd( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MatrixMode(GLbyte * pc) -{ - CALL_MatrixMode( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_MultMatrixf(GLbyte * pc) -{ - CALL_MultMatrixf( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_MultMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_MultMatrixd( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Ortho(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Ortho( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24), - *(GLdouble *)(pc + 32), - *(GLdouble *)(pc + 40) - ) ); -} - -void __glXDisp_PopMatrix(GLbyte * pc) -{ - CALL_PopMatrix( GET_DISPATCH(), () ); -} - -void __glXDisp_PushMatrix(GLbyte * pc) -{ - CALL_PushMatrix( GET_DISPATCH(), () ); -} - -void __glXDisp_Rotated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rotated( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24) - ) ); -} - -void __glXDisp_Rotatef(GLbyte * pc) -{ - CALL_Rotatef( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8), - *(GLfloat *)(pc + 12) - ) ); -} - -void __glXDisp_Scaled(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Scaled( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16) - ) ); -} - -void __glXDisp_Scalef(GLbyte * pc) -{ - CALL_Scalef( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Translated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Translated( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16) - ) ); -} - -void __glXDisp_Translatef(GLbyte * pc) -{ - CALL_Translatef( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Viewport(GLbyte * pc) -{ - CALL_Viewport( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12) - ) ); -} - -void __glXDisp_BindTexture(GLbyte * pc) -{ - CALL_BindTexture( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_Indexubv(GLbyte * pc) -{ - CALL_Indexubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_PolygonOffset(GLbyte * pc) -{ - CALL_PolygonOffset( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - residences - ) ); - __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - residences - ) ); - __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_CopyTexImage1D(GLbyte * pc) -{ - CALL_CopyTexImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLint *)(pc + 24) - ) ); -} - -void __glXDisp_CopyTexImage2D(GLbyte * pc) -{ - CALL_CopyTexImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLint *)(pc + 28) - ) ); -} - -void __glXDisp_CopyTexSubImage1D(GLbyte * pc) -{ - CALL_CopyTexSubImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20) - ) ); -} - -void __glXDisp_CopyTexSubImage2D(GLbyte * pc) -{ - CALL_CopyTexSubImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLint *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLsizei *)(pc + 28) - ) ); -} - -int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_PrioritizeTextures(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_PrioritizeTextures( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - (const GLclampf *)(pc + 4) - ) ); -} - -void __glXDisp_TexSubImage1D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexSubImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLsizei *)(pc + 36), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_TexSubImage2D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexSubImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLint *)(pc + 32), - *(GLsizei *)(pc + 36), - *(GLsizei *)(pc + 40), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_BlendColor(GLbyte * pc) -{ - CALL_BlendColor( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLclampf *)(pc + 4), - *(GLclampf *)(pc + 8), - *(GLclampf *)(pc + 12) - ) ); -} - -void __glXDisp_BlendEquation(GLbyte * pc) -{ - CALL_BlendEquation( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_ColorTable(GLbyte * pc) -{ - const GLvoid * const table = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ColorTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLenum *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 32), - *(GLenum *)(pc + 36), - table - ) ); -} - -void __glXDisp_ColorTableParameterfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_ColorTableParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_ColorTableParameteriv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_ColorTableParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_CopyColorTable(GLbyte * pc) -{ - CALL_CopyColorTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16) - ) ); -} - -int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_ColorSubTable(GLbyte * pc) -{ - const GLvoid * const data = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ColorSubTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 32), - *(GLenum *)(pc + 36), - data - ) ); -} - -void __glXDisp_CopyColorSubTable(GLbyte * pc) -{ - CALL_CopyColorSubTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLsizei *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16) - ) ); -} - -void __glXDisp_ConvolutionFilter1D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ConvolutionFilter1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLenum *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 36), - *(GLenum *)(pc + 40), - image - ) ); -} - -void __glXDisp_ConvolutionFilter2D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ConvolutionFilter2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLenum *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLsizei *)(pc + 32), - *(GLenum *)(pc + 36), - *(GLenum *)(pc + 40), - image - ) ); -} - -void __glXDisp_ConvolutionParameterf(GLbyte * pc) -{ - CALL_ConvolutionParameterf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_ConvolutionParameterfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_ConvolutionParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_ConvolutionParameteri(GLbyte * pc) -{ - CALL_ConvolutionParameteri( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_ConvolutionParameteriv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_ConvolutionParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16) - ) ); -} - -void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLsizei *)(pc + 20) - ) ); -} - -int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_Histogram(GLbyte * pc) -{ - CALL_Histogram( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLsizei *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLboolean *)(pc + 12) - ) ); -} - -void __glXDisp_Minmax(GLbyte * pc) -{ - CALL_Minmax( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLboolean *)(pc + 8) - ) ); -} - -void __glXDisp_ResetHistogram(GLbyte * pc) -{ - CALL_ResetHistogram( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_ResetMinmax(GLbyte * pc) -{ - CALL_ResetMinmax( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_TexImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexImage3D( GET_DISPATCH(), ( - *(GLenum *)(pc + 36), - *(GLint *)(pc + 40), - *(GLint *)(pc + 44), - *(GLsizei *)(pc + 48), - *(GLsizei *)(pc + 52), - *(GLsizei *)(pc + 56), - *(GLint *)(pc + 64), - *(GLenum *)(pc + 68), - *(GLenum *)(pc + 72), - pixels - ) ); -} - -void __glXDisp_TexSubImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 84); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 88); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexSubImage3D( GET_DISPATCH(), ( - *(GLenum *)(pc + 36), - *(GLint *)(pc + 40), - *(GLint *)(pc + 44), - *(GLint *)(pc + 48), - *(GLint *)(pc + 52), - *(GLsizei *)(pc + 60), - *(GLsizei *)(pc + 64), - *(GLsizei *)(pc + 68), - *(GLenum *)(pc + 76), - *(GLenum *)(pc + 80), - pixels - ) ); -} - -void __glXDisp_CopyTexSubImage3D(GLbyte * pc) -{ - CALL_CopyTexSubImage3D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLint *)(pc + 20), - *(GLint *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLsizei *)(pc + 32) - ) ); -} - -void __glXDisp_ActiveTextureARB(GLbyte * pc) -{ - CALL_ActiveTextureARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_MultiTexCoord1dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 8), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord1fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord1ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord1svARB(GLbyte * pc) -{ - CALL_MultiTexCoord1svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MultiTexCoord2dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 16), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord2fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord2ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord2svARB(GLbyte * pc) -{ - CALL_MultiTexCoord2svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_MultiTexCoord3dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 24), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord3fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord3ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord3svARB(GLbyte * pc) -{ - CALL_MultiTexCoord3svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_MultiTexCoord4dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 32), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord4fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord4ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord4svARB(GLbyte * pc) -{ - CALL_MultiTexCoord4svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_SampleCoverageARB(GLbyte * pc) -{ - CALL_SampleCoverageARB( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDisp_CompressedTexImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 20); - - CALL_CompressedTexImage1DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLint *)(pc + 16), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDisp_CompressedTexImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 24); - - CALL_CompressedTexImage2DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLint *)(pc + 20), - imageSize, - (const GLvoid *)(pc + 28) - ) ); -} - -void __glXDisp_CompressedTexImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 28); - - CALL_CompressedTexImage3DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLint *)(pc + 24), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 20); - - CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLenum *)(pc + 16), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 28); - - CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLenum *)(pc + 24), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 36); - - CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 32), - imageSize, - (const GLvoid *)(pc + 40) - ) ); -} - -int __glXDisp_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetProgramivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribdvARB_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribfvARB_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramStringARB(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 8); - - CALL_ProgramStringARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - len, - (const GLvoid *)(pc + 12) - ) ); -} - -void __glXDisp_VertexAttrib1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1fvARB(GLbyte * pc) -{ - CALL_VertexAttrib1fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1svARB(GLbyte * pc) -{ - CALL_VertexAttrib1svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2fvARB(GLbyte * pc) -{ - CALL_VertexAttrib2fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2svARB(GLbyte * pc) -{ - CALL_VertexAttrib2svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3fvARB(GLbyte * pc) -{ - CALL_VertexAttrib3fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3svARB(GLbyte * pc) -{ - CALL_VertexAttrib3svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NbvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NsvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NubvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NuivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NusvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLushort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4bvARB(GLbyte * pc) -{ - CALL_VertexAttrib4bvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4fvARB(GLbyte * pc) -{ - CALL_VertexAttrib4fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4ivARB(GLbyte * pc) -{ - CALL_VertexAttrib4ivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4svARB(GLbyte * pc) -{ - CALL_VertexAttrib4svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4ubvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4uivARB(GLbyte * pc) -{ - CALL_VertexAttrib4uivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4usvARB(GLbyte * pc) -{ - CALL_VertexAttrib4usvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLushort *)(pc + 4) - ) ); -} - -void __glXDisp_BeginQueryARB(GLbyte * pc) -{ - CALL_BeginQueryARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -int __glXDisp_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteQueriesARB( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -void __glXDisp_EndQueryARB(GLbyte * pc) -{ - CALL_EndQueryARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -int __glXDisp_GenQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenQueriesARB( GET_DISPATCH(), ( - n, - ids - ) ); - __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetQueryObjectivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetQueryObjectuivARB_size(pname); - GLuint answerBuffer[200]; - GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectuivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetQueryivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetQueryivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsQueryARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsQueryARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_DrawBuffersARB(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DrawBuffersARB( GET_DISPATCH(), ( - n, - (const GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_SampleMaskSGIS(GLbyte * pc) -{ - CALL_SampleMaskSGIS( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDisp_SamplePatternSGIS(GLbyte * pc) -{ - CALL_SamplePatternSGIS( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_PointParameterfEXT(GLbyte * pc) -{ - CALL_PointParameterfEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_PointParameterfvEXT(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLfloat * params; - - params = (const GLfloat *) (pc + 4); - - CALL_PointParameterfvEXT( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3bvEXT( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_SecondaryColor3dvEXT( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3fvEXT( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ivEXT( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3svEXT(GLbyte * pc) -{ - CALL_SecondaryColor3svEXT( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3uivEXT( GET_DISPATCH(), ( - (const GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3usvEXT( GET_DISPATCH(), ( - (const GLushort *)(pc + 0) - ) ); -} - -void __glXDisp_FogCoorddvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_FogCoorddvEXT( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_FogCoordfvEXT(GLbyte * pc) -{ - CALL_FogCoordfvEXT( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc) -{ - CALL_BlendFuncSeparateEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLenum *)(pc + 12) - ) ); -} - -void __glXDisp_WindowPos3fvMESA(GLbyte * pc) -{ - CALL_WindowPos3fvMESA( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -int __glXDisp_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - residences - ) ); - __glXSendReply(cl->client, residences, n, 1, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_BindProgramNV(GLbyte * pc) -{ - CALL_BindProgramNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -int __glXDisp_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -void __glXDisp_ExecuteProgramNV(GLbyte * pc) -{ - CALL_ExecuteProgramNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLfloat *)(pc + 8) - ) ); -} - -int __glXDisp_GenProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenProgramsNV( GET_DISPATCH(), ( - n, - programs - ) ); - __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramParameterdvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramParameterfvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetProgramivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetTrackMatrixivNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribdvNV_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribfvNV_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsProgramNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsProgramNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_LoadProgramNV(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 8); - - CALL_LoadProgramNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - len, - (const GLubyte *)(pc + 12) - ) ); -} - -void __glXDisp_ProgramParameters4dvNV(GLbyte * pc) -{ - const GLuint num = *(GLuint *)(pc + 8); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramParameters4dvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - num, - (const GLdouble *)(pc + 12) - ) ); -} - -void __glXDisp_ProgramParameters4fvNV(GLbyte * pc) -{ - const GLuint num = *(GLuint *)(pc + 8); - - CALL_ProgramParameters4fvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - num, - (const GLfloat *)(pc + 12) - ) ); -} - -void __glXDisp_RequestResidentProgramsNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_RequestResidentProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_TrackMatrixNV(GLbyte * pc) -{ - CALL_TrackMatrixNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLenum *)(pc + 12) - ) ); -} - -void __glXDisp_VertexAttrib1dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1fvNV(GLbyte * pc) -{ - CALL_VertexAttrib1fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1svNV(GLbyte * pc) -{ - CALL_VertexAttrib1svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2fvNV(GLbyte * pc) -{ - CALL_VertexAttrib2fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2svNV(GLbyte * pc) -{ - CALL_VertexAttrib2svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3fvNV(GLbyte * pc) -{ - CALL_VertexAttrib3fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3svNV(GLbyte * pc) -{ - CALL_VertexAttrib3svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4fvNV(GLbyte * pc) -{ - CALL_VertexAttrib4fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4svNV(GLbyte * pc) -{ - CALL_VertexAttrib4svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc) -{ - CALL_VertexAttrib4ubvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttribs1dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs1dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs1fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs1fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs1svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs1svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs2dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs2dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs2fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs2fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs2svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs2svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs3dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs3dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs3fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs3fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs3svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs3svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs4dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs4fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs4svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs4ubvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLubyte *)(pc + 8) - ) ); -} - -void __glXDisp_PointParameteriNV(GLbyte * pc) -{ - CALL_PointParameteriNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_PointParameterivNV(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLint * params; - - params = (const GLint *) (pc + 4); - - CALL_PointParameterivNV( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc) -{ - CALL_ActiveStencilFaceEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -int __glXDisp_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = *(GLsizei *)(pc + 4); - - GLdouble params[4]; - CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - len, - (const GLubyte *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = *(GLsizei *)(pc + 4); - - GLfloat params[4]; - CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - len, - (const GLubyte *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 36); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 44 + __GLX_PAD(len) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 32), - len, - (const GLubyte *)(pc + 40), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 4); - - CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - len, - (const GLubyte *)(pc + 24), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc) -{ - CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_BindFramebufferEXT(GLbyte * pc) -{ - CALL_BindFramebufferEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_BindRenderbufferEXT(GLbyte * pc) -{ - CALL_BindRenderbufferEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -int __glXDisp_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteFramebuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc) -{ - CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12) - ) ); -} - -void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture1DEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12), - *(GLint *)(pc + 16) - ) ); -} - -void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture2DEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12), - *(GLint *)(pc + 16) - ) ); -} - -void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture3DEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLint *)(pc + 20) - ) ); -} - -int __glXDisp_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenFramebuffersEXT( GET_DISPATCH(), ( - n, - framebuffers - ) ); - __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenRenderbuffersEXT( GET_DISPATCH(), ( - n, - renderbuffers - ) ); - __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_GenerateMipmapEXT(GLbyte * pc) -{ - CALL_GenerateMipmapEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -int __glXDisp_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsFramebufferEXT( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_RenderbufferStorageEXT(GLbyte * pc) -{ - CALL_RenderbufferStorageEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12) - ) ); -} - diff --git a/src/glx/x11/indirect_dispatch.h b/src/glx/x11/indirect_dispatch.h deleted file mode 100644 index e81c382f0a1..00000000000 --- a/src/glx/x11/indirect_dispatch.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ - -/* - * (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 - * 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 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. - */ - -#if !defined( _INDIRECT_DISPATCH_H_ ) -# define _INDIRECT_DISPATCH_H_ - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define HIDDEN __attribute__((visibility("hidden"))) -# else -# define HIDDEN -# endif -struct __GLXclientStateRec; - -extern HIDDEN void __glXDisp_MapGrid1d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid1d(GLbyte * pc); -extern HIDDEN void __glXDisp_MapGrid1f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid1f(GLbyte * pc); -extern HIDDEN int __glXDisp_NewList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_NewList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LoadIdentity(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadIdentity(GLbyte * pc); -extern HIDDEN void __glXDisp_SampleCoverageARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SampleCoverageARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDisp_BeginQueryARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BeginQueryARB(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_PointParameteriNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameteriNV(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1iv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4sv(GLbyte * pc); -extern HIDDEN void __glXDisp_ActiveTextureARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Histogram(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Histogram(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc); -extern HIDDEN void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color3uiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3uiv(GLbyte * pc); -extern HIDDEN int __glXDisp_IsEnabled(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsEnabled(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalCoord2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord2fv(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Indexubv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexubv(GLbyte * pc); -extern HIDDEN int __glXDisp_Render(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_Render(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexImage3D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexImage3D(GLbyte * pc); -extern HIDDEN int __glXDisp_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color3ubv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3ubv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Vertex3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModeliv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModeliv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs1dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3bv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3bv(GLbyte * pc); -extern HIDDEN int __glXDisp_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDisp_BlendColor(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendColor(GLbyte * pc); -extern HIDDEN void __glXDisp_Scalef(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Scalef(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3iv(GLbyte * pc); -extern HIDDEN void __glXDisp_PassThrough(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PassThrough(GLbyte * pc); -extern HIDDEN void __glXDisp_Viewport(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Viewport(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_DepthRange(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DepthRange(GLbyte * pc); -extern HIDDEN void __glXDisp_ResetHistogram(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ResetHistogram(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PointParameterfEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameterfEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexImage3DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3iv(GLbyte * pc); -extern HIDDEN int __glXDisp_CopyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CopyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_PointSize(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointSize(GLbyte * pc); -extern HIDDEN void __glXDisp_PopName(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PopName(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4sv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LineStipple(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LineStipple(GLbyte * pc); -extern HIDDEN void __glXDisp_TexEnvi(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnvi(GLbyte * pc); -extern HIDDEN int __glXDisp_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttribs3dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModeli(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModeli(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Scaled(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Scaled(GLbyte * pc); -extern HIDDEN void __glXDisp_CallLists(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CallLists(GLbyte * pc); -extern HIDDEN void __glXDisp_AlphaFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_AlphaFunc(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Rotated(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc); -extern HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexParameterf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc); -extern HIDDEN void __glXDisp_TexParameteri(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameteri(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_DrawPixels(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawPixels(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_GenerateMipmapEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GenLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MapGrid2d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid2d(GLbyte * pc); -extern HIDDEN void __glXDisp_MapGrid2f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid2f(GLbyte * pc); -extern HIDDEN void __glXDisp_Scissor(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Scissor(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogf(GLbyte * pc); -extern HIDDEN void __glXDisp_TexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4usv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4usv(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogi(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogi(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3iv(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3usv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc); -extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3bv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3bv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RenderbufferStorageEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorTable(GLbyte * pc); -extern HIDDEN void __glXDisp_Accum(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Accum(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexImage(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexImage(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ConvolutionFilter2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc); -extern HIDDEN int __glXDisp_Finish(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_Finish(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ClearStencil(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2fv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4fv(GLbyte * pc); -extern HIDDEN void __glXDisp_ClearIndex(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc); -extern HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc); -extern HIDDEN void __glXDisp_PushMatrix(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LoadProgramNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadProgramNV(GLbyte * pc); -extern HIDDEN int __glXDisp_EndList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_EndList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalMesh2(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalMesh2(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4fv(GLbyte * pc); -extern HIDDEN int __glXDisp_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Normal3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_End(GLbyte * pc); -extern HIDDEN void __glXDispSwap_End(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs2dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_BindTexture(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindTexture(GLbyte * pc); -extern HIDDEN void __glXDisp_TexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGenfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGenfv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4bvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_BlendEquation(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendEquation(GLbyte * pc); -extern HIDDEN int __glXDisp_GetError(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetError(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexCoord3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Indexdv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexdv(GLbyte * pc); -extern HIDDEN void __glXDisp_PushName(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PushName(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc); -extern HIDDEN void __glXDisp_DepthMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_StencilOp(GLbyte * pc); -extern HIDDEN void __glXDispSwap_StencilOp(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord3svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexEnvfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnvfv(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryServerString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryServerString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LoadMatrixf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadMatrixf(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4bv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4bv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DeleteLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LogicOp(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LogicOp(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4fv(GLbyte * pc); -extern HIDDEN int __glXDisp_WaitX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_WaitX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4ubv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4ubv(GLbyte * pc); -extern HIDDEN void __glXDisp_DrawBuffer(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawBuffer(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2fv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1sv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGeniv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGeniv(GLbyte * pc); -extern HIDDEN void __glXDisp_DepthFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DepthFunc(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelMapusv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelMapusv(GLbyte * pc); -extern HIDDEN void __glXDisp_PointParameterivNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameterivNV(GLbyte * pc); -extern HIDDEN void __glXDisp_BlendFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendFunc(GLbyte * pc); -extern HIDDEN int __glXDisp_WaitGL(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_WaitGL(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_Flush(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_Flush(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color4uiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4uiv(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3sv(GLbyte * pc); -extern HIDDEN void __glXDisp_BindFramebufferEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindFramebufferEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_PushAttrib(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameteriv(GLbyte * pc); -extern HIDDEN void __glXDisp_WindowPos3fvMESA(GLbyte * pc); -extern HIDDEN void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexSubImage3D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc); -extern HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Indexiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc); -extern HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Frustum(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Frustum(GLbyte * pc); -extern HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexEnvf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnvf(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ClearAccum(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearAccum(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryVersion(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryVersion(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorTableParameteriv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_Lightfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lightfv(GLbyte * pc); -extern HIDDEN void __glXDisp_ClearDepth(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearDepth(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4fv(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Lightiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lightiv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib2dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Rectdv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectdv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Materialiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materialiv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_PolygonMode(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PolygonMode(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsQueryARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsQueryARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexGeni(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGeni(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGenf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGenf(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGend(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGend(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib2svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4sv(GLbyte * pc); -extern HIDDEN int __glXDisp_IsProgramNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsProgramNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PixelZoom(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelZoom(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorTableParameterfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorTableParameterfv(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelMapuiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelMapuiv(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc); -extern HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMapdv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SamplePatternSGIS(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SamplePatternSGIS(GLbyte * pc); -extern HIDDEN int __glXDisp_PixelStoref(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_PixelStoref(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PrioritizeTextures(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PrioritizeTextures(GLbyte * pc); -extern HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorMaterial(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorMaterial(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc); -extern HIDDEN int __glXDisp_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc); -extern HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos2iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2iv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_FrontFace(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FrontFace(GLbyte * pc); -extern HIDDEN int __glXDisp_RenderLarge(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_RenderLarge(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc); -extern HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Lightf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lightf(GLbyte * pc); -extern HIDDEN void __glXDisp_MatrixMode(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MatrixMode(GLbyte * pc); -extern HIDDEN void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Lighti(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lighti(GLbyte * pc); -extern HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetDoublev(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetDoublev(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultMatrixd(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultMatrixd(GLbyte * pc); -extern HIDDEN void __glXDisp_MultMatrixf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultMatrixf(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TrackMatrixNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TrackMatrixNV(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4sv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ClearColor(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearColor(GLbyte * pc); -extern HIDDEN int __glXDisp_IsDirect(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsDirect(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexEnviv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnviv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexSubImage3D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexSubImage3D(GLbyte * pc); -extern HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Bitmap(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Vertex2sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2sv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib3svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SeparableFilter2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SeparableFilter2D(GLbyte * pc); -extern HIDDEN void __glXDisp_Map1d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map1d(GLbyte * pc); -extern HIDDEN void __glXDisp_Map1f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map1f(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramParameters4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelTransferi(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelTransferi(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Clear(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Clear(GLbyte * pc); -extern HIDDEN void __glXDisp_ReadBuffer(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ReadBuffer(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameteri(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameteri(GLbyte * pc); -extern HIDDEN void __glXDisp_Ortho(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Ortho(GLbyte * pc); -extern HIDDEN void __glXDisp_ListBase(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ListBase(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameterf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc); -extern HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_CallList(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CallList(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Rectiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2fv(GLbyte * pc); -extern HIDDEN void __glXDisp_BindRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc); -extern HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EvalMesh1(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalMesh1(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex2iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LineWidth(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LineWidth(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGendv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc); -extern HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc); -extern HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_UseXFont(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_UseXFont(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ShadeModel(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ShadeModel(GLbyte * pc); -extern HIDDEN void __glXDisp_Materialfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materialfv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_FogCoordfvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FogCoordfvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_DrawArrays(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawArrays(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Rotatef(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramParameters4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalPoint2(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalPoint2(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc); -extern HIDDEN void __glXDisp_PopMatrix(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc); -extern HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Map2d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map2d(GLbyte * pc); -extern HIDDEN void __glXDisp_Map2f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map2f(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Materialf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materialf(GLbyte * pc); -extern HIDDEN void __glXDisp_Materiali(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materiali(GLbyte * pc); -extern HIDDEN void __glXDisp_Indexsv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexsv(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord4svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModelfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModelfv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2dv(GLbyte * pc); -extern HIDDEN int __glXDisp_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EvalCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Translated(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Translated(GLbyte * pc); -extern HIDDEN void __glXDisp_Translatef(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Translatef(GLbyte * pc); -extern HIDDEN void __glXDisp_StencilMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_StencilMask(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetLightiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetLightiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc); -extern HIDDEN void __glXDisp_LoadName(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadName(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_CullFace(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CullFace(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_StencilFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_StencilFunc(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyPixels(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyPixels(GLbyte * pc); -extern HIDDEN void __glXDisp_Rectsv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectsv(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc); -extern HIDDEN void __glXDisp_TexParameterfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameterfv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4uivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ClipPlane(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Indexfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexfv(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SecondaryColor3svEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_IndexMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_IndexMask(GLbyte * pc); -extern HIDDEN void __glXDisp_BindProgramNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindProgramNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetFloatv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFloatv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexCoord3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3sv(GLbyte * pc); -extern HIDDEN void __glXDisp_PopAttrib(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PopAttrib(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogfv(GLbyte * pc); -extern HIDDEN void __glXDisp_InitNames(GLbyte * pc); -extern HIDDEN void __glXDispSwap_InitNames(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3sv(GLbyte * pc); -extern HIDDEN void __glXDisp_Minmax(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Minmax(GLbyte * pc); -extern HIDDEN void __glXDisp_FogCoorddvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FogCoorddvEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Hint(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Hint(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc); -extern HIDDEN int __glXDisp_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_CopyColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexCoord4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Begin(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Begin(GLbyte * pc); -extern HIDDEN int __glXDisp_ClientInfo(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ClientInfo(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Rectfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectfv(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModelf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModelf(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetLightfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetLightfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Disable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Disable(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ColorMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorMask(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4iv(GLbyte * pc); -extern HIDDEN void __glXDisp_Enable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Enable(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3fv(GLbyte * pc); -extern HIDDEN int __glXDisp_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc); - -# undef HIDDEN - -#endif /* !defined( _INDIRECT_DISPATCH_H_ ) */ diff --git a/src/glx/x11/indirect_dispatch_swap.c b/src/glx/x11/indirect_dispatch_swap.c deleted file mode 100644 index f137cbe98ad..00000000000 --- a/src/glx/x11/indirect_dispatch_swap.c +++ /dev/null @@ -1,6051 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ - -/* - * (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 - * 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 THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include <X11/Xmd.h> -#include <GL/gl.h> -#include <GL/glxproto.h> -#include <inttypes.h> -#include "indirect_size.h" -#include "indirect_size_get.h" -#include "indirect_dispatch.h" -#include "glxserver.h" -#include "glxbyteorder.h" -#include "indirect_util.h" -#include "singlesize.h" -#include "glapitable.h" -#include "glapi.h" -#include "glthread.h" -#include "dispatch.h" - -#define __GLX_PAD(x) (((x) + 3) & ~3) - -typedef struct { - __GLX_PIXEL_3D_HDR; -} __GLXpixel3DHeader; - -extern GLboolean __glXErrorOccured( void ); -extern void __glXClearErrorOccured( void ); - -static const unsigned dummy_answer[2] = {0, 0}; - -static GLsizei -bswap_CARD32( const void * src ) -{ - union { uint32_t dst; GLsizei ret; } x; - x.dst = bswap_32( *(uint32_t *) src ); - return x.ret; -} - -static GLshort -bswap_CARD16( const void * src ) -{ - union { uint16_t dst; GLshort ret; } x; - x.dst = bswap_16( *(uint16_t *) src ); - return x.ret; -} - -static GLenum -bswap_ENUM( const void * src ) -{ - union { uint32_t dst; GLenum ret; } x; - x.dst = bswap_32( *(uint32_t *) src ); - return x.ret; -} - -static GLdouble -bswap_FLOAT64( const void * src ) -{ - union { uint64_t dst; GLdouble ret; } x; - x.dst = bswap_64( *(uint64_t *) src ); - return x.ret; -} - -static GLfloat -bswap_FLOAT32( const void * src ) -{ - union { uint32_t dst; GLfloat ret; } x; - x.dst = bswap_32( *(uint32_t *) src ); - return x.ret; -} - -static void * -bswap_16_array( uint16_t * src, unsigned count ) -{ - unsigned i; - - for ( i = 0 ; i < count ; i++ ) { - uint16_t temp = bswap_16( src[i] ); - src[i] = temp; - } - - return src; -} - -static void * -bswap_32_array( uint32_t * src, unsigned count ) -{ - unsigned i; - - for ( i = 0 ; i < count ; i++ ) { - uint32_t temp = bswap_32( src[i] ); - src[i] = temp; - } - - return src; -} - -static void * -bswap_64_array( uint64_t * src, unsigned count ) -{ - unsigned i; - - for ( i = 0 ; i < count ; i++ ) { - uint64_t temp = bswap_64( src[i] ); - src[i] = temp; - } - - return src; -} - -int __glXDispSwap_NewList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_NewList( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_EndList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_EndList( GET_DISPATCH(), () ); - error = Success; - } - - return error; -} - -void __glXDispSwap_CallList(GLbyte * pc) -{ - CALL_CallList( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_CallLists(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - const GLenum type = (GLenum )bswap_ENUM ( pc + 4 ); - const GLvoid * lists; - - switch(type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - case GL_2_BYTES: - case GL_3_BYTES: - case GL_4_BYTES: - lists = (const GLvoid *) (pc + 8); break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - lists = (const GLvoid *) bswap_16_array( (uint16_t *) (pc + 8), n ); break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - lists = (const GLvoid *) bswap_32_array( (uint32_t *) (pc + 8), n ); break; - default: - return; - } - - CALL_CallLists( GET_DISPATCH(), ( - n, - type, - lists - ) ); -} - -int __glXDispSwap_DeleteLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_DeleteLists( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (GLsizei )bswap_CARD32 ( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLuint retval; - retval = CALL_GenLists( GET_DISPATCH(), ( - (GLsizei )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_ListBase(GLbyte * pc) -{ - CALL_ListBase( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Begin(GLbyte * pc) -{ - CALL_Begin( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Bitmap(GLbyte * pc) -{ - const GLubyte * const bitmap = (const GLubyte *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_Bitmap( GET_DISPATCH(), ( - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLfloat )bswap_FLOAT32( pc + 28 ), - (GLfloat )bswap_FLOAT32( pc + 32 ), - (GLfloat )bswap_FLOAT32( pc + 36 ), - (GLfloat )bswap_FLOAT32( pc + 40 ), - bitmap - ) ); -} - -void __glXDispSwap_Color3bv(GLbyte * pc) -{ - CALL_Color3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Color3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3fv(GLbyte * pc) -{ - CALL_Color3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3iv(GLbyte * pc) -{ - CALL_Color3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3sv(GLbyte * pc) -{ - CALL_Color3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3ubv(GLbyte * pc) -{ - CALL_Color3ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color3uiv(GLbyte * pc) -{ - CALL_Color3uiv( GET_DISPATCH(), ( - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3usv(GLbyte * pc) -{ - CALL_Color3usv( GET_DISPATCH(), ( - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color4bv(GLbyte * pc) -{ - CALL_Color4bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Color4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4fv(GLbyte * pc) -{ - CALL_Color4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4iv(GLbyte * pc) -{ - CALL_Color4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4sv(GLbyte * pc) -{ - CALL_Color4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4ubv(GLbyte * pc) -{ - CALL_Color4ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color4uiv(GLbyte * pc) -{ - CALL_Color4uiv( GET_DISPATCH(), ( - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4usv(GLbyte * pc) -{ - CALL_Color4usv( GET_DISPATCH(), ( - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_EdgeFlagv(GLbyte * pc) -{ - CALL_EdgeFlagv( GET_DISPATCH(), ( - (const GLboolean *)(pc + 0) - ) ); -} - -void __glXDispSwap_End(GLbyte * pc) -{ - CALL_End( GET_DISPATCH(), () ); -} - -void __glXDispSwap_Indexdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_Indexdv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Indexfv(GLbyte * pc) -{ - CALL_Indexfv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Indexiv(GLbyte * pc) -{ - CALL_Indexiv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Indexsv(GLbyte * pc) -{ - CALL_Indexsv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Normal3bv(GLbyte * pc) -{ - CALL_Normal3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Normal3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Normal3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Normal3fv(GLbyte * pc) -{ - CALL_Normal3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Normal3iv(GLbyte * pc) -{ - CALL_Normal3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Normal3sv(GLbyte * pc) -{ - CALL_Normal3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_RasterPos2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos2fv(GLbyte * pc) -{ - CALL_RasterPos2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos2iv(GLbyte * pc) -{ - CALL_RasterPos2iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos2sv(GLbyte * pc) -{ - CALL_RasterPos2sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_RasterPos3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos3fv(GLbyte * pc) -{ - CALL_RasterPos3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos3iv(GLbyte * pc) -{ - CALL_RasterPos3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos3sv(GLbyte * pc) -{ - CALL_RasterPos3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_RasterPos4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_RasterPos4fv(GLbyte * pc) -{ - CALL_RasterPos4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_RasterPos4iv(GLbyte * pc) -{ - CALL_RasterPos4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_RasterPos4sv(GLbyte * pc) -{ - CALL_RasterPos4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Rectdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rectdv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 16), 2 ) - ) ); -} - -void __glXDispSwap_Rectfv(GLbyte * pc) -{ - CALL_Rectfv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 2 ) - ) ); -} - -void __glXDispSwap_Rectiv(GLbyte * pc) -{ - CALL_Rectiv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 8), 2 ) - ) ); -} - -void __glXDispSwap_Rectsv(GLbyte * pc) -{ - CALL_Rectsv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_TexCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord1fv(GLbyte * pc) -{ - CALL_TexCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord1iv(GLbyte * pc) -{ - CALL_TexCoord1iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord1sv(GLbyte * pc) -{ - CALL_TexCoord1sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord2fv(GLbyte * pc) -{ - CALL_TexCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord2iv(GLbyte * pc) -{ - CALL_TexCoord2iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord2sv(GLbyte * pc) -{ - CALL_TexCoord2sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_TexCoord3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord3fv(GLbyte * pc) -{ - CALL_TexCoord3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord3iv(GLbyte * pc) -{ - CALL_TexCoord3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord3sv(GLbyte * pc) -{ - CALL_TexCoord3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_TexCoord4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_TexCoord4fv(GLbyte * pc) -{ - CALL_TexCoord4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_TexCoord4iv(GLbyte * pc) -{ - CALL_TexCoord4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_TexCoord4sv(GLbyte * pc) -{ - CALL_TexCoord4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_Vertex2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex2fv(GLbyte * pc) -{ - CALL_Vertex2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex2iv(GLbyte * pc) -{ - CALL_Vertex2iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex2sv(GLbyte * pc) -{ - CALL_Vertex2sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Vertex3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex3fv(GLbyte * pc) -{ - CALL_Vertex3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex3iv(GLbyte * pc) -{ - CALL_Vertex3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex3sv(GLbyte * pc) -{ - CALL_Vertex3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Vertex4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex4fv(GLbyte * pc) -{ - CALL_Vertex4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex4iv(GLbyte * pc) -{ - CALL_Vertex4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex4sv(GLbyte * pc) -{ - CALL_Vertex4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_ClipPlane(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_ClipPlane( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 32 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_ColorMaterial(GLbyte * pc) -{ - CALL_ColorMaterial( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_CullFace(GLbyte * pc) -{ - CALL_CullFace( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Fogf(GLbyte * pc) -{ - CALL_Fogf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_Fogfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glFogfv_size(pname) ); - - CALL_Fogfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_Fogi(GLbyte * pc) -{ - CALL_Fogi( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_Fogiv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glFogiv_size(pname) ); - - CALL_Fogiv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_FrontFace(GLbyte * pc) -{ - CALL_FrontFace( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Hint(GLbyte * pc) -{ - CALL_Hint( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_Lightf(GLbyte * pc) -{ - CALL_Lightf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Lightfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glLightfv_size(pname) ); - - CALL_Lightfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_Lighti(GLbyte * pc) -{ - CALL_Lighti( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_Lightiv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glLightiv_size(pname) ); - - CALL_Lightiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_LightModelf(GLbyte * pc) -{ - CALL_LightModelf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_LightModelfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModelfv_size(pname) ); - - CALL_LightModelfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_LightModeli(GLbyte * pc) -{ - CALL_LightModeli( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_LightModeliv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModeliv_size(pname) ); - - CALL_LightModeliv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_LineStipple(GLbyte * pc) -{ - CALL_LineStipple( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLushort)bswap_CARD16 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_LineWidth(GLbyte * pc) -{ - CALL_LineWidth( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_Materialf(GLbyte * pc) -{ - CALL_Materialf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Materialfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialfv_size(pname) ); - - CALL_Materialfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_Materiali(GLbyte * pc) -{ - CALL_Materiali( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_Materialiv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialiv_size(pname) ); - - CALL_Materialiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_PointSize(GLbyte * pc) -{ - CALL_PointSize( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_PolygonMode(GLbyte * pc) -{ - CALL_PolygonMode( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_PolygonStipple(GLbyte * pc) -{ - const GLubyte * const mask = (const GLubyte *) (pc + 20); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_PolygonStipple( GET_DISPATCH(), ( - mask - ) ); -} - -void __glXDispSwap_Scissor(GLbyte * pc) -{ - CALL_Scissor( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ) - ) ); -} - -void __glXDispSwap_ShadeModel(GLbyte * pc) -{ - CALL_ShadeModel( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_TexParameterf(GLbyte * pc) -{ - CALL_TexParameterf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexParameterfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameterfv_size(pname) ); - - CALL_TexParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexParameteri(GLbyte * pc) -{ - CALL_TexParameteri( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexParameteriv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameteriv_size(pname) ); - - CALL_TexParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexImage1D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_TexImage2D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ), - (GLsizei )bswap_CARD32 ( pc + 36 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_TexEnvf(GLbyte * pc) -{ - CALL_TexEnvf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexEnvfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnvfv_size(pname) ); - - CALL_TexEnvfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexEnvi(GLbyte * pc) -{ - CALL_TexEnvi( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexEnviv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnviv_size(pname) ); - - CALL_TexEnviv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexGend(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexGend( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 8 ), - (GLenum )bswap_ENUM ( pc + 12 ), - (GLdouble)bswap_FLOAT64( pc + 0 ) - ) ); -} - -void __glXDispSwap_TexGendv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLdouble * params; - -#ifdef __GLX_ALIGN64 - const GLuint compsize = __glTexGendv_size(pname); - const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - params = (const GLdouble *) bswap_64_array( (uint64_t *) (pc + 8), __glTexGendv_size(pname) ); - - CALL_TexGendv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexGenf(GLbyte * pc) -{ - CALL_TexGenf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexGenfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGenfv_size(pname) ); - - CALL_TexGenfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexGeni(GLbyte * pc) -{ - CALL_TexGeni( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexGeniv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGeniv_size(pname) ); - - CALL_TexGeniv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_InitNames(GLbyte * pc) -{ - CALL_InitNames( GET_DISPATCH(), () ); -} - -void __glXDispSwap_LoadName(GLbyte * pc) -{ - CALL_LoadName( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PassThrough(GLbyte * pc) -{ - CALL_PassThrough( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_PopName(GLbyte * pc) -{ - CALL_PopName( GET_DISPATCH(), () ); -} - -void __glXDispSwap_PushName(GLbyte * pc) -{ - CALL_PushName( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_DrawBuffer(GLbyte * pc) -{ - CALL_DrawBuffer( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Clear(GLbyte * pc) -{ - CALL_Clear( GET_DISPATCH(), ( - (GLbitfield)bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ClearAccum(GLbyte * pc) -{ - CALL_ClearAccum( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ), - (GLfloat )bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_ClearIndex(GLbyte * pc) -{ - CALL_ClearIndex( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_ClearColor(GLbyte * pc) -{ - CALL_ClearColor( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - (GLclampf)bswap_FLOAT32( pc + 4 ), - (GLclampf)bswap_FLOAT32( pc + 8 ), - (GLclampf)bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_ClearStencil(GLbyte * pc) -{ - CALL_ClearStencil( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ClearDepth(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_ClearDepth( GET_DISPATCH(), ( - (GLclampd)bswap_FLOAT64( pc + 0 ) - ) ); -} - -void __glXDispSwap_StencilMask(GLbyte * pc) -{ - CALL_StencilMask( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ColorMask(GLbyte * pc) -{ - CALL_ColorMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0), - *(GLboolean *)(pc + 1), - *(GLboolean *)(pc + 2), - *(GLboolean *)(pc + 3) - ) ); -} - -void __glXDispSwap_DepthMask(GLbyte * pc) -{ - CALL_DepthMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0) - ) ); -} - -void __glXDispSwap_IndexMask(GLbyte * pc) -{ - CALL_IndexMask( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Accum(GLbyte * pc) -{ - CALL_Accum( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_Disable(GLbyte * pc) -{ - CALL_Disable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Enable(GLbyte * pc) -{ - CALL_Enable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PopAttrib(GLbyte * pc) -{ - CALL_PopAttrib( GET_DISPATCH(), () ); -} - -void __glXDispSwap_PushAttrib(GLbyte * pc) -{ - CALL_PushAttrib( GET_DISPATCH(), ( - (GLbitfield)bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_MapGrid1d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MapGrid1d( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ) - ) ); -} - -void __glXDispSwap_MapGrid1f(GLbyte * pc) -{ - CALL_MapGrid1f( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_MapGrid2d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_MapGrid2d( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 32 ), - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 36 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ) - ) ); -} - -void __glXDispSwap_MapGrid2f(GLbyte * pc) -{ - CALL_MapGrid2f( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLfloat )bswap_FLOAT32( pc + 16 ), - (GLfloat )bswap_FLOAT32( pc + 20 ) - ) ); -} - -void __glXDispSwap_EvalCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_EvalCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_EvalCoord1fv(GLbyte * pc) -{ - CALL_EvalCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_EvalCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_EvalCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_EvalCoord2fv(GLbyte * pc) -{ - CALL_EvalCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_EvalMesh1(GLbyte * pc) -{ - CALL_EvalMesh1( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_EvalPoint1(GLbyte * pc) -{ - CALL_EvalPoint1( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_EvalMesh2(GLbyte * pc) -{ - CALL_EvalMesh2( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_EvalPoint2(GLbyte * pc) -{ - CALL_EvalPoint2( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_AlphaFunc(GLbyte * pc) -{ - CALL_AlphaFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLclampf)bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_BlendFunc(GLbyte * pc) -{ - CALL_BlendFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_LogicOp(GLbyte * pc) -{ - CALL_LogicOp( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_StencilFunc(GLbyte * pc) -{ - CALL_StencilFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLuint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_StencilOp(GLbyte * pc) -{ - CALL_StencilOp( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ) - ) ); -} - -void __glXDispSwap_DepthFunc(GLbyte * pc) -{ - CALL_DepthFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PixelZoom(GLbyte * pc) -{ - CALL_PixelZoom( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_PixelTransferf(GLbyte * pc) -{ - CALL_PixelTransferf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_PixelTransferi(GLbyte * pc) -{ - CALL_PixelTransferi( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_PixelStoref(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStoref( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_PixelStorei(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStorei( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -void __glXDispSwap_PixelMapfv(GLbyte * pc) -{ - const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_PixelMapfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - mapsize, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_PixelMapuiv(GLbyte * pc) -{ - const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_PixelMapuiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - mapsize, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_PixelMapusv(GLbyte * pc) -{ - const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_PixelMapusv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - mapsize, - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_ReadBuffer(GLbyte * pc) -{ - CALL_ReadBuffer( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_CopyPixels(GLbyte * pc) -{ - CALL_CopyPixels( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLenum )bswap_ENUM ( pc + 16 ) - ) ); -} - -void __glXDispSwap_DrawPixels(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 36); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_DrawPixels( GET_DISPATCH(), ( - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLenum )bswap_ENUM ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - pixels - ) ); -} - -int __glXDispSwap_GetBooleanv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetBooleanv_size(pname); - GLboolean answerBuffer[200]; - GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetBooleanv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReplySwap(cl->client, params, compsize, 1, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLdouble equation[4]; - CALL_GetClipPlane( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - equation - ) ); - (void) bswap_64_array( (uint64_t *) equation, 4 ); - __glXSendReplySwap(cl->client, equation, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetDoublev(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetDoublev_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetDoublev( GET_DISPATCH(), ( - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetError(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_GetError( GET_DISPATCH(), () ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetFloatv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetFloatv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetFloatv( GET_DISPATCH(), ( - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetIntegerv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetIntegerv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetIntegerv( GET_DISPATCH(), ( - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetLightfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetLightfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetLightiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); - const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMapdv_size(target,query); - GLdouble answerBuffer[200]; - GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapdv( GET_DISPATCH(), ( - target, - query, - v - ) ); - (void) bswap_64_array( (uint64_t *) v, compsize ); - __glXSendReplySwap(cl->client, v, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); - const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMapfv_size(target,query); - GLfloat answerBuffer[200]; - GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapfv( GET_DISPATCH(), ( - target, - query, - v - ) ); - (void) bswap_32_array( (uint32_t *) v, compsize ); - __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); - const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMapiv_size(target,query); - GLint answerBuffer[200]; - GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapiv( GET_DISPATCH(), ( - target, - query, - v - ) ); - (void) bswap_32_array( (uint32_t *) v, compsize ); - __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMaterialfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMaterialiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetPixelMapfv_size(map); - GLfloat answerBuffer[200]; - GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapfv( GET_DISPATCH(), ( - map, - values - ) ); - (void) bswap_32_array( (uint32_t *) values, compsize ); - __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetPixelMapuiv_size(map); - GLuint answerBuffer[200]; - GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapuiv( GET_DISPATCH(), ( - map, - values - ) ); - (void) bswap_32_array( (uint32_t *) values, compsize ); - __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetPixelMapusv_size(map); - GLushort answerBuffer[200]; - GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapusv( GET_DISPATCH(), ( - map, - values - ) ); - (void) bswap_16_array( (uint16_t *) values, compsize ); - __glXSendReplySwap(cl->client, values, compsize, 2, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexEnvfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnvfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexEnviv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnviv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexGendv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexGendv_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGendv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexGenfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGenfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexGeniv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGeniv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 ); - - const GLuint compsize = __glGetTexLevelParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 ); - - const GLuint compsize = __glGetTexLevelParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsEnabled(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsEnabled( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsList( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_DepthRange(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_DepthRange( GET_DISPATCH(), ( - (GLclampd)bswap_FLOAT64( pc + 0 ), - (GLclampd)bswap_FLOAT64( pc + 8 ) - ) ); -} - -void __glXDispSwap_Frustum(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Frustum( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ), - (GLdouble)bswap_FLOAT64( pc + 32 ), - (GLdouble)bswap_FLOAT64( pc + 40 ) - ) ); -} - -void __glXDispSwap_LoadIdentity(GLbyte * pc) -{ - CALL_LoadIdentity( GET_DISPATCH(), () ); -} - -void __glXDispSwap_LoadMatrixf(GLbyte * pc) -{ - CALL_LoadMatrixf( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_LoadMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_LoadMatrixd( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_MatrixMode(GLbyte * pc) -{ - CALL_MatrixMode( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_MultMatrixf(GLbyte * pc) -{ - CALL_MultMatrixf( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_MultMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_MultMatrixd( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_Ortho(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Ortho( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ), - (GLdouble)bswap_FLOAT64( pc + 32 ), - (GLdouble)bswap_FLOAT64( pc + 40 ) - ) ); -} - -void __glXDispSwap_PopMatrix(GLbyte * pc) -{ - CALL_PopMatrix( GET_DISPATCH(), () ); -} - -void __glXDispSwap_PushMatrix(GLbyte * pc) -{ - CALL_PushMatrix( GET_DISPATCH(), () ); -} - -void __glXDispSwap_Rotated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rotated( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ) - ) ); -} - -void __glXDispSwap_Rotatef(GLbyte * pc) -{ - CALL_Rotatef( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ), - (GLfloat )bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_Scaled(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Scaled( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ) - ) ); -} - -void __glXDispSwap_Scalef(GLbyte * pc) -{ - CALL_Scalef( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Translated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Translated( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ) - ) ); -} - -void __glXDispSwap_Translatef(GLbyte * pc) -{ - CALL_Translatef( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Viewport(GLbyte * pc) -{ - CALL_Viewport( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ) - ) ); -} - -void __glXDispSwap_BindTexture(GLbyte * pc) -{ - CALL_BindTexture( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_Indexubv(GLbyte * pc) -{ - CALL_Indexubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_PolygonOffset(GLbyte * pc) -{ - CALL_PolygonOffset( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - residences - ) ); - __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - residences - ) ); - __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_CopyTexImage1D(GLbyte * pc) -{ - CALL_CopyTexImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ) - ) ); -} - -void __glXDispSwap_CopyTexImage2D(GLbyte * pc) -{ - CALL_CopyTexImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ) - ) ); -} - -void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc) -{ - CALL_CopyTexSubImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ) - ) ); -} - -void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc) -{ - CALL_CopyTexSubImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ) - ) ); -} - -int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - (void) bswap_32_array( (uint32_t *) textures, n ); - __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - (void) bswap_32_array( (uint32_t *) textures, n ); - __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_PrioritizeTextures(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_PrioritizeTextures( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - (const GLclampf *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_TexSubImage1D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexSubImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 36 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_TexSubImage2D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexSubImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLint )bswap_CARD32 ( pc + 32 ), - (GLsizei )bswap_CARD32 ( pc + 36 ), - (GLsizei )bswap_CARD32 ( pc + 40 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_BlendColor(GLbyte * pc) -{ - CALL_BlendColor( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - (GLclampf)bswap_FLOAT32( pc + 4 ), - (GLclampf)bswap_FLOAT32( pc + 8 ), - (GLclampf)bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_BlendEquation(GLbyte * pc) -{ - CALL_BlendEquation( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ColorTable(GLbyte * pc) -{ - const GLvoid * const table = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ColorTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - (GLenum )bswap_ENUM ( pc + 36 ), - table - ) ); -} - -void __glXDispSwap_ColorTableParameterfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameterfv_size(pname) ); - - CALL_ColorTableParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_ColorTableParameteriv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameteriv_size(pname) ); - - CALL_ColorTableParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_CopyColorTable(GLbyte * pc) -{ - CALL_CopyColorTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ) - ) ); -} - -int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_ColorSubTable(GLbyte * pc) -{ - const GLvoid * const data = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ColorSubTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - (GLenum )bswap_ENUM ( pc + 36 ), - data - ) ); -} - -void __glXDispSwap_CopyColorSubTable(GLbyte * pc) -{ - CALL_CopyColorSubTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLsizei )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ConvolutionFilter1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 36 ), - (GLenum )bswap_ENUM ( pc + 40 ), - image - ) ); -} - -void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ConvolutionFilter2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ), - (GLenum )bswap_ENUM ( pc + 36 ), - (GLenum )bswap_ENUM ( pc + 40 ), - image - ) ); -} - -void __glXDispSwap_ConvolutionParameterf(GLbyte * pc) -{ - CALL_ConvolutionParameterf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameterfv_size(pname) ); - - CALL_ConvolutionParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_ConvolutionParameteri(GLbyte * pc) -{ - CALL_ConvolutionParameteri( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameteriv_size(pname) ); - - CALL_ConvolutionParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ) - ) ); -} - -int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_Histogram(GLbyte * pc) -{ - CALL_Histogram( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLsizei )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - *(GLboolean *)(pc + 12) - ) ); -} - -void __glXDispSwap_Minmax(GLbyte * pc) -{ - CALL_Minmax( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - *(GLboolean *)(pc + 8) - ) ); -} - -void __glXDispSwap_ResetHistogram(GLbyte * pc) -{ - CALL_ResetHistogram( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ResetMinmax(GLbyte * pc) -{ - CALL_ResetMinmax( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_TexImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexImage3D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 36 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLint )bswap_CARD32 ( pc + 44 ), - (GLsizei )bswap_CARD32 ( pc + 48 ), - (GLsizei )bswap_CARD32 ( pc + 52 ), - (GLsizei )bswap_CARD32 ( pc + 56 ), - (GLint )bswap_CARD32 ( pc + 64 ), - (GLenum )bswap_ENUM ( pc + 68 ), - (GLenum )bswap_ENUM ( pc + 72 ), - pixels - ) ); -} - -void __glXDispSwap_TexSubImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 84); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 88); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexSubImage3D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 36 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLint )bswap_CARD32 ( pc + 44 ), - (GLint )bswap_CARD32 ( pc + 48 ), - (GLint )bswap_CARD32 ( pc + 52 ), - (GLsizei )bswap_CARD32 ( pc + 60 ), - (GLsizei )bswap_CARD32 ( pc + 64 ), - (GLsizei )bswap_CARD32 ( pc + 68 ), - (GLenum )bswap_ENUM ( pc + 76 ), - (GLenum )bswap_ENUM ( pc + 80 ), - pixels - ) ); -} - -void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc) -{ - CALL_CopyTexSubImage3D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ) - ) ); -} - -void __glXDispSwap_ActiveTextureARB(GLbyte * pc) -{ - CALL_ActiveTextureARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_MultiTexCoord1dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 8 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord1fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord1ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc) -{ - CALL_MultiTexCoord1svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MultiTexCoord2dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 16 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord2fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord2ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc) -{ - CALL_MultiTexCoord2svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_MultiTexCoord3dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 24 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord3fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord3ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc) -{ - CALL_MultiTexCoord3svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_MultiTexCoord4dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 32 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord4fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord4ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc) -{ - CALL_MultiTexCoord4svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_SampleCoverageARB(GLbyte * pc) -{ - CALL_SampleCoverageARB( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 ); - - CALL_CompressedTexImage1DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 24 ); - - CALL_CompressedTexImage2DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ), - imageSize, - (const GLvoid *)(pc + 28) - ) ); -} - -void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 ); - - CALL_CompressedTexImage3DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 ); - - CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLenum )bswap_ENUM ( pc + 16 ), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 ); - - CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 36 ); - - CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - imageSize, - (const GLvoid *)(pc + 40) - ) ); -} - -int __glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetProgramivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribdvARB_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribfvARB_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramStringARB(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 ); - - CALL_ProgramStringARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - len, - (const GLvoid *)(pc + 12) - ) ); -} - -void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc) -{ - CALL_VertexAttrib1fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc) -{ - CALL_VertexAttrib1svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc) -{ - CALL_VertexAttrib2fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc) -{ - CALL_VertexAttrib2svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc) -{ - CALL_VertexAttrib3fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc) -{ - CALL_VertexAttrib3svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NbvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NsvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NubvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NuivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NusvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc) -{ - CALL_VertexAttrib4bvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc) -{ - CALL_VertexAttrib4fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc) -{ - CALL_VertexAttrib4ivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc) -{ - CALL_VertexAttrib4svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4ubvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc) -{ - CALL_VertexAttrib4uivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc) -{ - CALL_VertexAttrib4usvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_BeginQueryARB(GLbyte * pc) -{ - CALL_BeginQueryARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteQueriesARB( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -void __glXDispSwap_EndQueryARB(GLbyte * pc) -{ - CALL_EndQueryARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -int __glXDispSwap_GenQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenQueriesARB( GET_DISPATCH(), ( - n, - ids - ) ); - (void) bswap_32_array( (uint32_t *) ids, n ); - __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetQueryObjectivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetQueryObjectuivARB_size(pname); - GLuint answerBuffer[200]; - GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectuivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetQueryivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetQueryivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsQueryARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsQueryARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_DrawBuffersARB(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DrawBuffersARB( GET_DISPATCH(), ( - n, - (const GLenum *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_SampleMaskSGIS(GLbyte * pc) -{ - CALL_SampleMaskSGIS( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDispSwap_SamplePatternSGIS(GLbyte * pc) -{ - CALL_SamplePatternSGIS( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PointParameterfEXT(GLbyte * pc) -{ - CALL_PointParameterfEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_PointParameterfvEXT(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterfvEXT_size(pname) ); - - CALL_PointParameterfvEXT( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3bvEXT( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_SecondaryColor3dvEXT( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3fvEXT( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ivEXT( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc) -{ - CALL_SecondaryColor3svEXT( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3uivEXT( GET_DISPATCH(), ( - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3usvEXT( GET_DISPATCH(), ( - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_FogCoorddvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_FogCoorddvEXT( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_FogCoordfvEXT(GLbyte * pc) -{ - CALL_FogCoordfvEXT( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc) -{ - CALL_BlendFuncSeparateEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLenum )bswap_ENUM ( pc + 12 ) - ) ); -} - -void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc) -{ - CALL_WindowPos3fvMESA( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -int __glXDispSwap_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - residences - ) ); - __glXSendReplySwap(cl->client, residences, n, 1, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_BindProgramNV(GLbyte * pc) -{ - CALL_BindProgramNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -void __glXDispSwap_ExecuteProgramNV(GLbyte * pc) -{ - CALL_ExecuteProgramNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -int __glXDispSwap_GenProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenProgramsNV( GET_DISPATCH(), ( - n, - programs - ) ); - (void) bswap_32_array( (uint32_t *) programs, n ); - __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramParameterdvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramParameterfvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetProgramivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetTrackMatrixivNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 1 ); - __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribdvNV_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribfvNV_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsProgramNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsProgramNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_LoadProgramNV(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 ); - - CALL_LoadProgramNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - len, - (const GLubyte *)(pc + 12) - ) ); -} - -void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc) -{ - const GLuint num = (GLuint )bswap_CARD32 ( pc + 8 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramParameters4dvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - num, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 12), 0 ) - ) ); -} - -void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc) -{ - const GLuint num = (GLuint )bswap_CARD32 ( pc + 8 ); - - CALL_ProgramParameters4fvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - num, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 12), 0 ) - ) ); -} - -void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_RequestResidentProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_TrackMatrixNV(GLbyte * pc) -{ - CALL_TrackMatrixNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLenum )bswap_ENUM ( pc + 12 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc) -{ - CALL_VertexAttrib1fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc) -{ - CALL_VertexAttrib1svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc) -{ - CALL_VertexAttrib2fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc) -{ - CALL_VertexAttrib2svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc) -{ - CALL_VertexAttrib3fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc) -{ - CALL_VertexAttrib3svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc) -{ - CALL_VertexAttrib4fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc) -{ - CALL_VertexAttrib4svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc) -{ - CALL_VertexAttrib4ubvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs1dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs1fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs1svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs2dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs2fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs2svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs3dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs3fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs3svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs4dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs4fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs4svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs4ubvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLubyte *)(pc + 8) - ) ); -} - -void __glXDispSwap_PointParameteriNV(GLbyte * pc) -{ - CALL_PointParameteriNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_PointParameterivNV(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterivNV_size(pname) ); - - CALL_PointParameterivNV( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc) -{ - CALL_ActiveStencilFaceEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -int __glXDispSwap_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); - - GLdouble params[4]; - CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - len, - (const GLubyte *)(pc + 8), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); - - GLfloat params[4]; - CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - len, - (const GLubyte *)(pc + 8), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 36 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 44 + __GLX_PAD(len) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 32 ), - len, - (const GLubyte *)(pc + 40), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - len, - (const GLubyte *)(pc + 24), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc) -{ - CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_BindFramebufferEXT(GLbyte * pc) -{ - CALL_BindFramebufferEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc) -{ - CALL_BindRenderbufferEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteFramebuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc) -{ - CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ) - ) ); -} - -void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture1DEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture2DEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture3DEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ) - ) ); -} - -int __glXDispSwap_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenFramebuffersEXT( GET_DISPATCH(), ( - n, - framebuffers - ) ); - (void) bswap_32_array( (uint32_t *) framebuffers, n ); - __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenRenderbuffersEXT( GET_DISPATCH(), ( - n, - renderbuffers - ) ); - (void) bswap_32_array( (uint32_t *) renderbuffers, n ); - __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc) -{ - CALL_GenerateMipmapEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 1 ); - __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 1 ); - __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsFramebufferEXT( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc) -{ - CALL_RenderbufferStorageEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ) - ) ); -} - diff --git a/src/glx/x11/indirect_reqsize.c b/src/glx/x11/indirect_reqsize.c deleted file mode 100644 index 954eecd9729..00000000000 --- a/src/glx/x11/indirect_reqsize.c +++ /dev/null @@ -1,832 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (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 - * 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 THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -#include <GL/gl.h> -#include "glxserver.h" -#include "glxbyteorder.h" -#include "indirect_size.h" -#include "indirect_reqsize.h" - -#define __GLX_PAD(x) (((x) + 3) & ~3) - -#if defined(__CYGWIN__) || defined(__MINGW32__) -# undef HAVE_ALIAS -#endif -#ifdef HAVE_ALIAS -# define ALIAS2(from,to) \ - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ - __attribute__ ((alias( # to ))); -# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize ) -#else -# define ALIAS(from,to) \ - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ - { return __glX ## to ## ReqSize( pc, swap ); } -#endif - - -int -__glXCallListsReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 0); - GLenum type = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - n = bswap_32(n); - type = bswap_32(type); - } - - compsize = __glCallLists_size(type); - return __GLX_PAD((compsize * n)); -} - -int -__glXBitmapReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLsizei width = *(GLsizei *) (pc + 20); - GLsizei height = *(GLsizei *) (pc + 24); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - width = bswap_32(width); - height = bswap_32(height); - } - - return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXFogfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glFogfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXLightfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glLightfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXLightModelfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glLightModelfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXMaterialfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glMaterialfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - } - - return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexParameterfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXTexImage1DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 32); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexImage2DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 32); - GLsizei height = *(GLsizei *) (pc + 36); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexEnvfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXTexGendvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexGendv_size(pname); - return __GLX_PAD((compsize * 8)); -} - -int -__glXTexGenfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexGenfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei mapsize = *(GLsizei *) (pc + 4); - - if (swap) { - mapsize = bswap_32(mapsize); - } - - return __GLX_PAD((mapsize * 4)); -} - -int -__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei mapsize = *(GLsizei *) (pc + 4); - - if (swap) { - mapsize = bswap_32(mapsize); - } - - return __GLX_PAD((mapsize * 2)); -} - -int -__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLsizei width = *(GLsizei *) (pc + 20); - GLsizei height = *(GLsizei *) (pc + 24); - GLenum format = *(GLenum *) (pc + 28); - GLenum type = *(GLenum *) (pc + 32); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, 0, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 0); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 4) + (n * 4)); -} - -int -__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 36); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 36); - GLsizei height = *(GLsizei *) (pc + 40); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXColorTableReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 28); - GLenum format = *(GLenum *) (pc + 32); - GLenum type = *(GLenum *) (pc + 36); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glColorTableParameterfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXColorSubTableReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei count = *(GLsizei *) (pc + 28); - GLenum format = *(GLenum *) (pc + 32); - GLenum type = *(GLenum *) (pc + 36); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - count = bswap_32(count); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, count, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 28); - GLenum format = *(GLenum *) (pc + 36); - GLenum type = *(GLenum *) (pc + 40); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 28); - GLsizei height = *(GLsizei *) (pc + 32); - GLenum format = *(GLenum *) (pc + 36); - GLenum type = *(GLenum *) (pc + 40); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glConvolutionParameterfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXTexImage3DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = *(GLint *) (pc + 8); - GLint skip_rows = *(GLint *) (pc + 16); - GLint skip_images = *(GLint *) (pc + 20); - GLint alignment = *(GLint *) (pc + 32); - GLenum target = *(GLenum *) (pc + 36); - GLsizei width = *(GLsizei *) (pc + 48); - GLsizei height = *(GLsizei *) (pc + 52); - GLsizei depth = *(GLsizei *) (pc + 56); - GLenum format = *(GLenum *) (pc + 68); - GLenum type = *(GLenum *) (pc + 72); - - if (swap) { - row_length = bswap_32(row_length); - image_height = bswap_32(image_height); - skip_rows = bswap_32(skip_rows); - skip_images = bswap_32(skip_images); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - depth = bswap_32(depth); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, depth, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = *(GLint *) (pc + 8); - GLint skip_rows = *(GLint *) (pc + 16); - GLint skip_images = *(GLint *) (pc + 20); - GLint alignment = *(GLint *) (pc + 32); - GLenum target = *(GLenum *) (pc + 36); - GLsizei width = *(GLsizei *) (pc + 60); - GLsizei height = *(GLsizei *) (pc + 64); - GLsizei depth = *(GLsizei *) (pc + 68); - GLenum format = *(GLenum *) (pc + 76); - GLenum type = *(GLenum *) (pc + 80); - - if (swap) { - row_length = bswap_32(row_length); - image_height = bswap_32(image_height); - skip_rows = bswap_32(skip_rows); - skip_images = bswap_32(skip_images); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - depth = bswap_32(depth); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, depth, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 20); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 24); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 28); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 36); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei len = *(GLsizei *) (pc + 8); - - if (swap) { - len = bswap_32(len); - } - - return __GLX_PAD(len); -} - -int -__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 0); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 4)); -} - -int -__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glPointParameterfvEXT_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLuint num = *(GLuint *) (pc + 8); - - if (swap) { - num = bswap_32(num); - } - - return __GLX_PAD((num * 32)); -} - -int -__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLuint num = *(GLuint *) (pc + 8); - - if (swap) { - num = bswap_32(num); - } - - return __GLX_PAD((num * 16)); -} - -int -__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 8)); -} - -int -__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 16)); -} - -int -__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 24)); -} - -int -__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 12)); -} - -int -__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 6)); -} - -int -__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 32)); -} - -int -__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei len = *(GLsizei *) (pc + 4); - - if (swap) { - len = bswap_32(len); - } - - return __GLX_PAD(len); -} - -ALIAS(Fogiv, Fogfv) - ALIAS(Lightiv, Lightfv) - ALIAS(LightModeliv, LightModelfv) - ALIAS(Materialiv, Materialfv) - ALIAS(TexParameteriv, TexParameterfv) - ALIAS(TexEnviv, TexEnvfv) - ALIAS(TexGeniv, TexGenfv) - ALIAS(PixelMapuiv, PixelMapfv) - ALIAS(ColorTableParameteriv, ColorTableParameterfv) - ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) - ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB) - ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB) - ALIAS(LoadProgramNV, ProgramStringARB) - ALIAS(RequestResidentProgramsNV, DrawBuffersARB) - ALIAS(VertexAttribs1fvNV, PixelMapfv) - ALIAS(VertexAttribs1svNV, PixelMapusv) - ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV) - ALIAS(VertexAttribs2svNV, PixelMapfv) - ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV) - ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV) - ALIAS(VertexAttribs4ubvNV, PixelMapfv) - ALIAS(PointParameterivNV, PointParameterfvEXT) - ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB) - ALIAS(DeleteFramebuffersEXT, DrawBuffersARB) - ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB) diff --git a/src/glx/x11/indirect_reqsize.h b/src/glx/x11/indirect_reqsize.h deleted file mode 100644 index 26211ee5cae..00000000000 --- a/src/glx/x11/indirect_reqsize.h +++ /dev/null @@ -1,121 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (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 - * 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 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. - */ - -#if !defined( _INDIRECT_REQSIZE_H_ ) -# define _INDIRECT_REQSIZE_H_ - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define HIDDEN __attribute__((visibility("hidden"))) -# else -# define HIDDEN -# endif - -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define PURE __attribute__((pure)) -# else -# define PURE -# endif - -extern PURE HIDDEN int __glXCallListsReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXBitmapReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXFogfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXFogivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightModelfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightModelivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMaterialfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMaterialivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexParameterivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexImage1DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexImage2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexEnvivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexGendvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexGenfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexGenivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap1dReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap1fReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap2dReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap2fReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPixelMapuivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawArraysReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorTableReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorTableParameterivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorSubTableReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); - -# undef HIDDEN -# undef PURE - -#endif /* !defined( _INDIRECT_REQSIZE_H_ ) */ diff --git a/src/glx/x11/indirect_size_get.c b/src/glx/x11/indirect_size_get.c deleted file mode 100644 index 8f726904fd6..00000000000 --- a/src/glx/x11/indirect_size_get.c +++ /dev/null @@ -1,1210 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (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 - * 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 THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -#include <GL/gl.h> -#include "indirect_size_get.h" -#include "glxserver.h" -#include "indirect_util.h" -#include "indirect_size.h" - -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define PURE __attribute__((pure)) -# else -# define PURE -# endif - -# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) -# define FASTCALL __attribute__((fastcall)) -# else -# define FASTCALL -# endif - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define INTERNAL __attribute__((visibility("internal"))) -# else -# define INTERNAL -# endif - - -#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) -# undef HAVE_ALIAS -#endif -#ifdef HAVE_ALIAS -# define ALIAS2(from,to) \ - INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ - __attribute__ ((alias( # to ))); -# define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size ) -#else -# define ALIAS(from,to) \ - INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ - { return __gl ## to ## _size( e ); } -#endif - - -INTERNAL PURE FASTCALL GLint -__glCallLists_size(GLenum e) -{ - switch (e) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - return 1; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - case GL_2_BYTES: - return 2; - case GL_3_BYTES: - return 3; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - case GL_4_BYTES: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glFogfv_size(GLenum e) -{ - switch (e) { - case GL_FOG_INDEX: - case GL_FOG_DENSITY: - case GL_FOG_START: - case GL_FOG_END: - case GL_FOG_MODE: - case GL_FOG_OFFSET_VALUE_SGIX: - case GL_FOG_DISTANCE_MODE_NV: - return 1; - case GL_FOG_COLOR: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glLightfv_size(GLenum e) -{ - switch (e) { - case GL_SPOT_EXPONENT: - case GL_SPOT_CUTOFF: - case GL_CONSTANT_ATTENUATION: - case GL_LINEAR_ATTENUATION: - case GL_QUADRATIC_ATTENUATION: - return 1; - case GL_SPOT_DIRECTION: - return 3; - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_POSITION: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glLightModelfv_size(GLenum e) -{ - switch (e) { - case GL_LIGHT_MODEL_LOCAL_VIEWER: - case GL_LIGHT_MODEL_TWO_SIDE: - case GL_LIGHT_MODEL_COLOR_CONTROL: -/* case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/ - return 1; - case GL_LIGHT_MODEL_AMBIENT: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glMaterialfv_size(GLenum e) -{ - switch (e) { - case GL_SHININESS: - return 1; - case GL_COLOR_INDEXES: - return 3; - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_EMISSION: - case GL_AMBIENT_AND_DIFFUSE: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glTexParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_MAG_FILTER: - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_PRIORITY: - case GL_TEXTURE_WRAP_R: - case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: -/* case GL_SHADOW_AMBIENT_SGIX:*/ - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_CLIPMAP_FRAME_SGIX: - case GL_TEXTURE_LOD_BIAS_S_SGIX: - case GL_TEXTURE_LOD_BIAS_T_SGIX: - case GL_TEXTURE_LOD_BIAS_R_SGIX: - case GL_GENERATE_MIPMAP: -/* case GL_GENERATE_MIPMAP_SGIS:*/ - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - case GL_TEXTURE_MAX_CLAMP_S_SGIX: - case GL_TEXTURE_MAX_CLAMP_T_SGIX: - case GL_TEXTURE_MAX_CLAMP_R_SGIX: - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - case GL_TEXTURE_LOD_BIAS: -/* case GL_TEXTURE_LOD_BIAS_EXT:*/ - case GL_DEPTH_TEXTURE_MODE: -/* case GL_DEPTH_TEXTURE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_MODE: -/* case GL_TEXTURE_COMPARE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_FUNC: -/* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ - case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: - return 1; - case GL_TEXTURE_CLIPMAP_CENTER_SGIX: - case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: - return 2; - case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: - return 3; - case GL_TEXTURE_BORDER_COLOR: - case GL_POST_TEXTURE_FILTER_BIAS_SGIX: - case GL_POST_TEXTURE_FILTER_SCALE_SGIX: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glTexEnvfv_size(GLenum e) -{ - switch (e) { - case GL_ALPHA_SCALE: - case GL_TEXTURE_ENV_MODE: - case GL_TEXTURE_LOD_BIAS: - case GL_COMBINE_RGB: - case GL_COMBINE_ALPHA: - case GL_RGB_SCALE: - case GL_SOURCE0_RGB: - case GL_SOURCE1_RGB: - case GL_SOURCE2_RGB: - case GL_SOURCE3_RGB_NV: - case GL_SOURCE0_ALPHA: - case GL_SOURCE1_ALPHA: - case GL_SOURCE2_ALPHA: - case GL_SOURCE3_ALPHA_NV: - case GL_OPERAND0_RGB: - case GL_OPERAND1_RGB: - case GL_OPERAND2_RGB: - case GL_OPERAND3_RGB_NV: - case GL_OPERAND0_ALPHA: - case GL_OPERAND1_ALPHA: - case GL_OPERAND2_ALPHA: - case GL_OPERAND3_ALPHA_NV: - case GL_COORD_REPLACE_ARB: -/* case GL_COORD_REPLACE_NV:*/ - return 1; - case GL_TEXTURE_ENV_COLOR: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glTexGendv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_GEN_MODE: - return 1; - case GL_OBJECT_PLANE: - case GL_EYE_PLANE: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glMap1d_size(GLenum e) -{ - switch (e) { - case GL_MAP1_INDEX: - case GL_MAP1_TEXTURE_COORD_1: - return 1; - case GL_MAP1_TEXTURE_COORD_2: - return 2; - case GL_MAP1_NORMAL: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_VERTEX_3: - return 3; - case GL_MAP1_COLOR_4: - case GL_MAP1_TEXTURE_COORD_4: - case GL_MAP1_VERTEX_4: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glMap2d_size(GLenum e) -{ - switch (e) { - case GL_MAP2_INDEX: - case GL_MAP2_TEXTURE_COORD_1: - return 1; - case GL_MAP2_TEXTURE_COORD_2: - return 2; - case GL_MAP2_NORMAL: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_VERTEX_3: - return 3; - case GL_MAP2_COLOR_4: - case GL_MAP2_TEXTURE_COORD_4: - case GL_MAP2_VERTEX_4: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetBooleanv_size(GLenum e) -{ - switch (e) { - case GL_CURRENT_INDEX: - case GL_CURRENT_RASTER_INDEX: - case GL_CURRENT_RASTER_POSITION_VALID: - case GL_CURRENT_RASTER_DISTANCE: - case GL_POINT_SMOOTH: - case GL_POINT_SIZE: - case GL_SMOOTH_POINT_SIZE_GRANULARITY: - case GL_LINE_SMOOTH: - case GL_LINE_WIDTH: - case GL_LINE_WIDTH_GRANULARITY: - case GL_LINE_STIPPLE: - case GL_LINE_STIPPLE_PATTERN: - case GL_LINE_STIPPLE_REPEAT: - case GL_LIST_MODE: - case GL_MAX_LIST_NESTING: - case GL_LIST_BASE: - case GL_LIST_INDEX: - case GL_POLYGON_SMOOTH: - case GL_POLYGON_STIPPLE: - case GL_EDGE_FLAG: - case GL_CULL_FACE: - case GL_CULL_FACE_MODE: - case GL_FRONT_FACE: - case GL_LIGHTING: - case GL_LIGHT_MODEL_LOCAL_VIEWER: - case GL_LIGHT_MODEL_TWO_SIDE: - case GL_SHADE_MODEL: - case GL_COLOR_MATERIAL_FACE: - case GL_COLOR_MATERIAL_PARAMETER: - case GL_COLOR_MATERIAL: - case GL_FOG: - case GL_FOG_INDEX: - case GL_FOG_DENSITY: - case GL_FOG_START: - case GL_FOG_END: - case GL_FOG_MODE: - case GL_DEPTH_TEST: - case GL_DEPTH_WRITEMASK: - case GL_DEPTH_CLEAR_VALUE: - case GL_DEPTH_FUNC: - case GL_STENCIL_TEST: - case GL_STENCIL_CLEAR_VALUE: - case GL_STENCIL_FUNC: - case GL_STENCIL_VALUE_MASK: - case GL_STENCIL_FAIL: - case GL_STENCIL_PASS_DEPTH_FAIL: - case GL_STENCIL_PASS_DEPTH_PASS: - case GL_STENCIL_REF: - case GL_STENCIL_WRITEMASK: - case GL_MATRIX_MODE: - case GL_NORMALIZE: - case GL_MODELVIEW_STACK_DEPTH: - case GL_PROJECTION_STACK_DEPTH: - case GL_TEXTURE_STACK_DEPTH: - case GL_ATTRIB_STACK_DEPTH: - case GL_CLIENT_ATTRIB_STACK_DEPTH: - case GL_ALPHA_TEST: - case GL_ALPHA_TEST_FUNC: - case GL_ALPHA_TEST_REF: - case GL_DITHER: - case GL_BLEND_DST: - case GL_BLEND_SRC: - case GL_BLEND: - case GL_LOGIC_OP_MODE: - case GL_LOGIC_OP: - case GL_AUX_BUFFERS: - case GL_DRAW_BUFFER: - case GL_READ_BUFFER: - case GL_SCISSOR_TEST: - case GL_INDEX_CLEAR_VALUE: - case GL_INDEX_WRITEMASK: - case GL_INDEX_MODE: - case GL_RGBA_MODE: - case GL_DOUBLEBUFFER: - case GL_STEREO: - case GL_RENDER_MODE: - case GL_PERSPECTIVE_CORRECTION_HINT: - case GL_POINT_SMOOTH_HINT: - case GL_LINE_SMOOTH_HINT: - case GL_POLYGON_SMOOTH_HINT: - case GL_FOG_HINT: - case GL_TEXTURE_GEN_S: - case GL_TEXTURE_GEN_T: - case GL_TEXTURE_GEN_R: - case GL_TEXTURE_GEN_Q: - case GL_PIXEL_MAP_I_TO_I: - case GL_PIXEL_MAP_I_TO_I_SIZE: - case GL_PIXEL_MAP_S_TO_S_SIZE: - case GL_PIXEL_MAP_I_TO_R_SIZE: - case GL_PIXEL_MAP_I_TO_G_SIZE: - case GL_PIXEL_MAP_I_TO_B_SIZE: - case GL_PIXEL_MAP_I_TO_A_SIZE: - case GL_PIXEL_MAP_R_TO_R_SIZE: - case GL_PIXEL_MAP_G_TO_G_SIZE: - case GL_PIXEL_MAP_B_TO_B_SIZE: - case GL_PIXEL_MAP_A_TO_A_SIZE: - case GL_UNPACK_SWAP_BYTES: - case GL_UNPACK_LSB_FIRST: - case GL_UNPACK_ROW_LENGTH: - case GL_UNPACK_SKIP_ROWS: - case GL_UNPACK_SKIP_PIXELS: - case GL_UNPACK_ALIGNMENT: - case GL_PACK_SWAP_BYTES: - case GL_PACK_LSB_FIRST: - case GL_PACK_ROW_LENGTH: - case GL_PACK_SKIP_ROWS: - case GL_PACK_SKIP_PIXELS: - case GL_PACK_ALIGNMENT: - case GL_MAP_COLOR: - case GL_MAP_STENCIL: - case GL_INDEX_SHIFT: - case GL_INDEX_OFFSET: - case GL_RED_SCALE: - case GL_RED_BIAS: - case GL_ZOOM_X: - case GL_ZOOM_Y: - case GL_GREEN_SCALE: - case GL_GREEN_BIAS: - case GL_BLUE_SCALE: - case GL_BLUE_BIAS: - case GL_ALPHA_SCALE: - case GL_ALPHA_BIAS: - case GL_DEPTH_SCALE: - case GL_DEPTH_BIAS: - case GL_MAX_EVAL_ORDER: - case GL_MAX_LIGHTS: - case GL_MAX_CLIP_PLANES: - case GL_MAX_TEXTURE_SIZE: - case GL_MAX_PIXEL_MAP_TABLE: - case GL_MAX_ATTRIB_STACK_DEPTH: - case GL_MAX_MODELVIEW_STACK_DEPTH: - case GL_MAX_NAME_STACK_DEPTH: - case GL_MAX_PROJECTION_STACK_DEPTH: - case GL_MAX_TEXTURE_STACK_DEPTH: - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - case GL_SUBPIXEL_BITS: - case GL_INDEX_BITS: - case GL_RED_BITS: - case GL_GREEN_BITS: - case GL_BLUE_BITS: - case GL_ALPHA_BITS: - case GL_DEPTH_BITS: - case GL_STENCIL_BITS: - case GL_ACCUM_RED_BITS: - case GL_ACCUM_GREEN_BITS: - case GL_ACCUM_BLUE_BITS: - case GL_ACCUM_ALPHA_BITS: - case GL_NAME_STACK_DEPTH: - case GL_AUTO_NORMAL: - case GL_MAP1_COLOR_4: - case GL_MAP1_INDEX: - case GL_MAP1_NORMAL: - case GL_MAP1_TEXTURE_COORD_1: - case GL_MAP1_TEXTURE_COORD_2: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_TEXTURE_COORD_4: - case GL_MAP1_VERTEX_3: - case GL_MAP1_VERTEX_4: - case GL_MAP2_COLOR_4: - case GL_MAP2_INDEX: - case GL_MAP2_NORMAL: - case GL_MAP2_TEXTURE_COORD_1: - case GL_MAP2_TEXTURE_COORD_2: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_TEXTURE_COORD_4: - case GL_MAP2_VERTEX_3: - case GL_MAP2_VERTEX_4: - case GL_MAP1_GRID_SEGMENTS: - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_POLYGON_OFFSET_UNITS: - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - case GL_BLEND_EQUATION: -/* case GL_BLEND_EQUATION_EXT:*/ - case GL_CONVOLUTION_1D: - case GL_CONVOLUTION_2D: - case GL_SEPARABLE_2D: - case GL_MAX_CONVOLUTION_WIDTH: -/* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ - case GL_MAX_CONVOLUTION_HEIGHT: -/* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ - case GL_POST_CONVOLUTION_RED_SCALE: -/* case GL_POST_CONVOLUTION_RED_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_GREEN_SCALE: -/* case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_BLUE_SCALE: -/* case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_ALPHA_SCALE: -/* case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_RED_BIAS: -/* case GL_POST_CONVOLUTION_RED_BIAS_EXT:*/ - case GL_POST_CONVOLUTION_GREEN_BIAS: -/* case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:*/ - case GL_POST_CONVOLUTION_BLUE_BIAS: -/* case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:*/ - case GL_POST_CONVOLUTION_ALPHA_BIAS: -/* case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:*/ - case GL_HISTOGRAM: - case GL_MINMAX: - case GL_POLYGON_OFFSET_FACTOR: - case GL_RESCALE_NORMAL: -/* case GL_RESCALE_NORMAL_EXT:*/ - case GL_TEXTURE_BINDING_1D: - case GL_TEXTURE_BINDING_2D: - case GL_TEXTURE_BINDING_3D: - case GL_PACK_SKIP_IMAGES: - case GL_PACK_IMAGE_HEIGHT: - case GL_UNPACK_SKIP_IMAGES: - case GL_UNPACK_IMAGE_HEIGHT: - case GL_TEXTURE_3D: - case GL_MAX_3D_TEXTURE_SIZE: - case GL_VERTEX_ARRAY: - case GL_NORMAL_ARRAY: - case GL_COLOR_ARRAY: - case GL_INDEX_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - case GL_EDGE_FLAG_ARRAY: - case GL_VERTEX_ARRAY_SIZE: - case GL_VERTEX_ARRAY_TYPE: - case GL_VERTEX_ARRAY_STRIDE: - case GL_NORMAL_ARRAY_TYPE: - case GL_NORMAL_ARRAY_STRIDE: - case GL_COLOR_ARRAY_SIZE: - case GL_COLOR_ARRAY_TYPE: - case GL_COLOR_ARRAY_STRIDE: - case GL_INDEX_ARRAY_TYPE: - case GL_INDEX_ARRAY_STRIDE: - case GL_TEXTURE_COORD_ARRAY_SIZE: - case GL_TEXTURE_COORD_ARRAY_TYPE: - case GL_TEXTURE_COORD_ARRAY_STRIDE: - case GL_EDGE_FLAG_ARRAY_STRIDE: - case GL_MULTISAMPLE: -/* case GL_MULTISAMPLE_ARB:*/ - case GL_SAMPLE_ALPHA_TO_COVERAGE: -/* case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:*/ - case GL_SAMPLE_ALPHA_TO_ONE: -/* case GL_SAMPLE_ALPHA_TO_ONE_ARB:*/ - case GL_SAMPLE_COVERAGE: -/* case GL_SAMPLE_COVERAGE_ARB:*/ - case GL_SAMPLE_BUFFERS: -/* case GL_SAMPLE_BUFFERS_ARB:*/ - case GL_SAMPLES: -/* case GL_SAMPLES_ARB:*/ - case GL_SAMPLE_COVERAGE_VALUE: -/* case GL_SAMPLE_COVERAGE_VALUE_ARB:*/ - case GL_SAMPLE_COVERAGE_INVERT: -/* case GL_SAMPLE_COVERAGE_INVERT_ARB:*/ - case GL_COLOR_MATRIX_STACK_DEPTH: - case GL_MAX_COLOR_MATRIX_STACK_DEPTH: - case GL_POST_COLOR_MATRIX_RED_SCALE: - case GL_POST_COLOR_MATRIX_GREEN_SCALE: - case GL_POST_COLOR_MATRIX_BLUE_SCALE: - case GL_POST_COLOR_MATRIX_ALPHA_SCALE: - case GL_POST_COLOR_MATRIX_RED_BIAS: - case GL_POST_COLOR_MATRIX_GREEN_BIAS: - case GL_POST_COLOR_MATRIX_BLUE_BIAS: - case GL_POST_COLOR_MATRIX_ALPHA_BIAS: - case GL_BLEND_DST_RGB: - case GL_BLEND_SRC_RGB: - case GL_BLEND_DST_ALPHA: - case GL_BLEND_SRC_ALPHA: - case GL_COLOR_TABLE: - case GL_POST_CONVOLUTION_COLOR_TABLE: - case GL_POST_COLOR_MATRIX_COLOR_TABLE: - case GL_MAX_ELEMENTS_VERTICES: - case GL_MAX_ELEMENTS_INDICES: - case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: - case GL_POINT_SIZE_MIN: - case GL_POINT_SIZE_MAX: - case GL_POINT_FADE_THRESHOLD_SIZE: - case GL_OCCLUSION_TEST_HP: - case GL_OCCLUSION_TEST_RESULT_HP: - case GL_LIGHT_MODEL_COLOR_CONTROL: - case GL_CURRENT_FOG_COORD: - case GL_FOG_COORDINATE_ARRAY_TYPE: - case GL_FOG_COORDINATE_ARRAY_STRIDE: - case GL_FOG_COORD_ARRAY: - case GL_COLOR_SUM_ARB: - case GL_SECONDARY_COLOR_ARRAY_SIZE: - case GL_SECONDARY_COLOR_ARRAY_TYPE: - case GL_SECONDARY_COLOR_ARRAY_STRIDE: - case GL_SECONDARY_COLOR_ARRAY: - case GL_ACTIVE_TEXTURE: -/* case GL_ACTIVE_TEXTURE_ARB:*/ - case GL_CLIENT_ACTIVE_TEXTURE: -/* case GL_CLIENT_ACTIVE_TEXTURE_ARB:*/ - case GL_MAX_TEXTURE_UNITS: -/* case GL_MAX_TEXTURE_UNITS_ARB:*/ - case GL_MAX_RENDERBUFFER_SIZE_EXT: - case GL_TEXTURE_COMPRESSION_HINT: -/* case GL_TEXTURE_COMPRESSION_HINT_ARB:*/ - case GL_TEXTURE_RECTANGLE_ARB: -/* case GL_TEXTURE_RECTANGLE_NV:*/ - case GL_TEXTURE_BINDING_RECTANGLE_ARB: -/* case GL_TEXTURE_BINDING_RECTANGLE_NV:*/ - case GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB: -/* case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:*/ - case GL_MAX_TEXTURE_LOD_BIAS: - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - case GL_MAX_SHININESS_NV: - case GL_MAX_SPOT_EXPONENT_NV: - case GL_TEXTURE_CUBE_MAP: -/* case GL_TEXTURE_CUBE_MAP_ARB:*/ - case GL_TEXTURE_BINDING_CUBE_MAP: -/* case GL_TEXTURE_BINDING_CUBE_MAP_ARB:*/ - case GL_MAX_CUBE_MAP_TEXTURE_SIZE: -/* case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:*/ - case GL_MULTISAMPLE_FILTER_HINT_NV: - case GL_FOG_DISTANCE_MODE_NV: - case GL_VERTEX_PROGRAM_ARB: - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - case GL_MAX_PROGRAM_MATRICES_ARB: - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - case GL_PROGRAM_ERROR_POSITION_ARB: - case GL_DEPTH_CLAMP_NV: - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: -/* case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:*/ - case GL_MAX_VERTEX_UNITS_ARB: - case GL_ACTIVE_VERTEX_UNITS_ARB: - case GL_WEIGHT_SUM_UNITY_ARB: - case GL_VERTEX_BLEND_ARB: - case GL_CURRENT_WEIGHT_ARB: - case GL_WEIGHT_ARRAY_TYPE_ARB: - case GL_WEIGHT_ARRAY_STRIDE_ARB: - case GL_WEIGHT_ARRAY_SIZE_ARB: - case GL_WEIGHT_ARRAY_ARB: - case GL_PACK_INVERT_MESA: - case GL_STENCIL_BACK_FUNC_ATI: - case GL_STENCIL_BACK_FAIL_ATI: - case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: - case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: - case GL_FRAGMENT_PROGRAM_ARB: - case GL_MAX_DRAW_BUFFERS_ARB: -/* case GL_MAX_DRAW_BUFFERS_ATI:*/ - case GL_DRAW_BUFFER0_ARB: -/* case GL_DRAW_BUFFER0_ATI:*/ - case GL_DRAW_BUFFER1_ARB: -/* case GL_DRAW_BUFFER1_ATI:*/ - case GL_DRAW_BUFFER2_ARB: -/* case GL_DRAW_BUFFER2_ATI:*/ - case GL_DRAW_BUFFER3_ARB: -/* case GL_DRAW_BUFFER3_ATI:*/ - case GL_DRAW_BUFFER4_ARB: -/* case GL_DRAW_BUFFER4_ATI:*/ - case GL_DRAW_BUFFER5_ARB: -/* case GL_DRAW_BUFFER5_ATI:*/ - case GL_DRAW_BUFFER6_ARB: -/* case GL_DRAW_BUFFER6_ATI:*/ - case GL_DRAW_BUFFER7_ARB: -/* case GL_DRAW_BUFFER7_ATI:*/ - case GL_DRAW_BUFFER8_ARB: -/* case GL_DRAW_BUFFER8_ATI:*/ - case GL_DRAW_BUFFER9_ARB: -/* case GL_DRAW_BUFFER9_ATI:*/ - case GL_DRAW_BUFFER10_ARB: -/* case GL_DRAW_BUFFER10_ATI:*/ - case GL_DRAW_BUFFER11_ARB: -/* case GL_DRAW_BUFFER11_ATI:*/ - case GL_DRAW_BUFFER12_ARB: -/* case GL_DRAW_BUFFER12_ATI:*/ - case GL_DRAW_BUFFER13_ARB: -/* case GL_DRAW_BUFFER13_ATI:*/ - case GL_DRAW_BUFFER14_ARB: -/* case GL_DRAW_BUFFER14_ATI:*/ - case GL_DRAW_BUFFER15_ARB: -/* case GL_DRAW_BUFFER15_ATI:*/ - case GL_BLEND_EQUATION_ALPHA_EXT: - case GL_MATRIX_PALETTE_ARB: - case GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB: - case GL_MAX_PALETTE_MATRICES_ARB: - case GL_CURRENT_PALETTE_MATRIX_ARB: - case GL_MATRIX_INDEX_ARRAY_ARB: - case GL_CURRENT_MATRIX_INDEX_ARB: - case GL_MATRIX_INDEX_ARRAY_SIZE_ARB: - case GL_MATRIX_INDEX_ARRAY_TYPE_ARB: - case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB: - case GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT: - case GL_POINT_SPRITE_ARB: -/* case GL_POINT_SPRITE_NV:*/ - case GL_POINT_SPRITE_R_MODE_NV: - case GL_MAX_VERTEX_ATTRIBS_ARB: - case GL_MAX_TEXTURE_COORDS_ARB: - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - case GL_DEPTH_BOUNDS_TEST_EXT: - case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: - case GL_STENCIL_TEST_TWO_SIDE_EXT: - case GL_ACTIVE_STENCIL_FACE_EXT: - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - case GL_DRAW_FRAMEBUFFER_BINDING_EXT: - case GL_RENDERBUFFER_BINDING_EXT: - case GL_READ_FRAMEBUFFER_BINDING_EXT: - case GL_MAX_COLOR_ATTACHMENTS_EXT: - case GL_RASTER_POSITION_UNCLIPPED_IBM: - return 1; - case GL_SMOOTH_POINT_SIZE_RANGE: - case GL_LINE_WIDTH_RANGE: - case GL_POLYGON_MODE: - case GL_DEPTH_RANGE: - case GL_MAX_VIEWPORT_DIMS: - case GL_MAP1_GRID_DOMAIN: - case GL_MAP2_GRID_SEGMENTS: - case GL_ALIASED_POINT_SIZE_RANGE: - case GL_ALIASED_LINE_WIDTH_RANGE: - case GL_DEPTH_BOUNDS_EXT: - return 2; - case GL_CURRENT_NORMAL: - case GL_POINT_DISTANCE_ATTENUATION: - return 3; - case GL_CURRENT_COLOR: - case GL_CURRENT_TEXTURE_COORDS: - case GL_CURRENT_RASTER_COLOR: - case GL_CURRENT_RASTER_TEXTURE_COORDS: - case GL_CURRENT_RASTER_POSITION: - case GL_LIGHT_MODEL_AMBIENT: - case GL_FOG_COLOR: - case GL_ACCUM_CLEAR_VALUE: - case GL_VIEWPORT: - case GL_SCISSOR_BOX: - case GL_COLOR_CLEAR_VALUE: - case GL_COLOR_WRITEMASK: - case GL_MAP2_GRID_DOMAIN: - case GL_BLEND_COLOR: -/* case GL_BLEND_COLOR_EXT:*/ - case GL_CURRENT_SECONDARY_COLOR: - return 4; - case GL_MODELVIEW_MATRIX: - case GL_PROJECTION_MATRIX: - case GL_TEXTURE_MATRIX: - case GL_MODELVIEW0_ARB: - case GL_COLOR_MATRIX: - case GL_MODELVIEW1_ARB: - case GL_CURRENT_MATRIX_ARB: - case GL_MODELVIEW2_ARB: - case GL_MODELVIEW3_ARB: - case GL_MODELVIEW4_ARB: - case GL_MODELVIEW5_ARB: - case GL_MODELVIEW6_ARB: - case GL_MODELVIEW7_ARB: - case GL_MODELVIEW8_ARB: - case GL_MODELVIEW9_ARB: - case GL_MODELVIEW10_ARB: - case GL_MODELVIEW11_ARB: - case GL_MODELVIEW12_ARB: - case GL_MODELVIEW13_ARB: - case GL_MODELVIEW14_ARB: - case GL_MODELVIEW15_ARB: - case GL_MODELVIEW16_ARB: - case GL_MODELVIEW17_ARB: - case GL_MODELVIEW18_ARB: - case GL_MODELVIEW19_ARB: - case GL_MODELVIEW20_ARB: - case GL_MODELVIEW21_ARB: - case GL_MODELVIEW22_ARB: - case GL_MODELVIEW23_ARB: - case GL_MODELVIEW24_ARB: - case GL_MODELVIEW25_ARB: - case GL_MODELVIEW26_ARB: - case GL_MODELVIEW27_ARB: - case GL_MODELVIEW28_ARB: - case GL_MODELVIEW29_ARB: - case GL_MODELVIEW30_ARB: - case GL_MODELVIEW31_ARB: - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - return 16; - case GL_FOG_COORDINATE_SOURCE: - case GL_COMPRESSED_TEXTURE_FORMATS: - return __glGetBooleanv_variable_size(e); - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetTexParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_MAG_FILTER: - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_PRIORITY: - case GL_TEXTURE_RESIDENT: - case GL_TEXTURE_WRAP_R: - case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: -/* case GL_SHADOW_AMBIENT_SGIX:*/ - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_CLIPMAP_FRAME_SGIX: - case GL_TEXTURE_LOD_BIAS_S_SGIX: - case GL_TEXTURE_LOD_BIAS_T_SGIX: - case GL_TEXTURE_LOD_BIAS_R_SGIX: - case GL_GENERATE_MIPMAP: -/* case GL_GENERATE_MIPMAP_SGIS:*/ - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - case GL_TEXTURE_MAX_CLAMP_S_SGIX: - case GL_TEXTURE_MAX_CLAMP_T_SGIX: - case GL_TEXTURE_MAX_CLAMP_R_SGIX: - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - case GL_TEXTURE_LOD_BIAS: -/* case GL_TEXTURE_LOD_BIAS_EXT:*/ - case GL_DEPTH_TEXTURE_MODE: -/* case GL_DEPTH_TEXTURE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_MODE: -/* case GL_TEXTURE_COMPARE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_FUNC: -/* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ - case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: - return 1; - case GL_TEXTURE_CLIPMAP_CENTER_SGIX: - case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: - return 2; - case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: - return 3; - case GL_TEXTURE_BORDER_COLOR: - case GL_POST_TEXTURE_FILTER_BIAS_SGIX: - case GL_POST_TEXTURE_FILTER_SCALE_SGIX: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetTexLevelParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_WIDTH: - case GL_TEXTURE_HEIGHT: - case GL_TEXTURE_COMPONENTS: - case GL_TEXTURE_BORDER: - case GL_TEXTURE_RED_SIZE: -/* case GL_TEXTURE_RED_SIZE_EXT:*/ - case GL_TEXTURE_GREEN_SIZE: -/* case GL_TEXTURE_GREEN_SIZE_EXT:*/ - case GL_TEXTURE_BLUE_SIZE: -/* case GL_TEXTURE_BLUE_SIZE_EXT:*/ - case GL_TEXTURE_ALPHA_SIZE: -/* case GL_TEXTURE_ALPHA_SIZE_EXT:*/ - case GL_TEXTURE_LUMINANCE_SIZE: -/* case GL_TEXTURE_LUMINANCE_SIZE_EXT:*/ - case GL_TEXTURE_INTENSITY_SIZE: -/* case GL_TEXTURE_INTENSITY_SIZE_EXT:*/ - case GL_TEXTURE_DEPTH: - case GL_TEXTURE_INDEX_SIZE_EXT: - case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: -/* case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB:*/ - case GL_TEXTURE_COMPRESSED: -/* case GL_TEXTURE_COMPRESSED_ARB:*/ - case GL_TEXTURE_DEPTH_SIZE: -/* case GL_TEXTURE_DEPTH_SIZE_ARB:*/ - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glColorTableParameterfv_size(GLenum e) -{ - switch (e) { - case GL_COLOR_TABLE_SCALE: - case GL_COLOR_TABLE_BIAS: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetColorTableParameterfv_size(GLenum e) -{ - switch (e) { - case GL_COLOR_TABLE_FORMAT: -/* case GL_COLOR_TABLE_FORMAT_EXT:*/ - case GL_COLOR_TABLE_WIDTH: -/* case GL_COLOR_TABLE_WIDTH_EXT:*/ - case GL_COLOR_TABLE_RED_SIZE: -/* case GL_COLOR_TABLE_RED_SIZE_EXT:*/ - case GL_COLOR_TABLE_GREEN_SIZE: -/* case GL_COLOR_TABLE_GREEN_SIZE_EXT:*/ - case GL_COLOR_TABLE_BLUE_SIZE: -/* case GL_COLOR_TABLE_BLUE_SIZE_EXT:*/ - case GL_COLOR_TABLE_ALPHA_SIZE: -/* case GL_COLOR_TABLE_ALPHA_SIZE_EXT:*/ - case GL_COLOR_TABLE_LUMINANCE_SIZE: -/* case GL_COLOR_TABLE_LUMINANCE_SIZE_EXT:*/ - case GL_COLOR_TABLE_INTENSITY_SIZE: -/* case GL_COLOR_TABLE_INTENSITY_SIZE_EXT:*/ - return 1; - case GL_COLOR_TABLE_SCALE: - case GL_COLOR_TABLE_BIAS: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glConvolutionParameterfv_size(GLenum e) -{ - switch (e) { - case GL_CONVOLUTION_BORDER_MODE: -/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ - return 1; - case GL_CONVOLUTION_FILTER_SCALE: -/* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ - case GL_CONVOLUTION_FILTER_BIAS: -/* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ - case GL_CONVOLUTION_BORDER_COLOR: -/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetConvolutionParameterfv_size(GLenum e) -{ - switch (e) { - case GL_CONVOLUTION_BORDER_MODE: -/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ - case GL_CONVOLUTION_FORMAT: -/* case GL_CONVOLUTION_FORMAT_EXT:*/ - case GL_CONVOLUTION_WIDTH: -/* case GL_CONVOLUTION_WIDTH_EXT:*/ - case GL_CONVOLUTION_HEIGHT: -/* case GL_CONVOLUTION_HEIGHT_EXT:*/ - case GL_MAX_CONVOLUTION_WIDTH: -/* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ - case GL_MAX_CONVOLUTION_HEIGHT: -/* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ - return 1; - case GL_CONVOLUTION_FILTER_SCALE: -/* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ - case GL_CONVOLUTION_FILTER_BIAS: -/* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ - case GL_CONVOLUTION_BORDER_COLOR: -/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetHistogramParameterfv_size(GLenum e) -{ - switch (e) { - case GL_HISTOGRAM_WIDTH: - case GL_HISTOGRAM_FORMAT: - case GL_HISTOGRAM_RED_SIZE: - case GL_HISTOGRAM_GREEN_SIZE: - case GL_HISTOGRAM_BLUE_SIZE: - case GL_HISTOGRAM_ALPHA_SIZE: - case GL_HISTOGRAM_LUMINANCE_SIZE: - case GL_HISTOGRAM_SINK: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetMinmaxParameterfv_size(GLenum e) -{ - switch (e) { - case GL_MINMAX_FORMAT: - case GL_MINMAX_SINK: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetProgramivARB_size(GLenum e) -{ - switch (e) { - case GL_PROGRAM_LENGTH_ARB: - case GL_PROGRAM_BINDING_ARB: - case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: - case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: - case GL_PROGRAM_TEX_INDIRECTIONS_ARB: - case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: - case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: - case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: - case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: - case GL_PROGRAM_FORMAT_ARB: - case GL_PROGRAM_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: - case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: - case GL_PROGRAM_TEMPORARIES_ARB: - case GL_MAX_PROGRAM_TEMPORARIES_ARB: - case GL_PROGRAM_NATIVE_TEMPORARIES_ARB: - case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: - case GL_PROGRAM_PARAMETERS_ARB: - case GL_MAX_PROGRAM_PARAMETERS_ARB: - case GL_PROGRAM_NATIVE_PARAMETERS_ARB: - case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: - case GL_PROGRAM_ATTRIBS_ARB: - case GL_MAX_PROGRAM_ATTRIBS_ARB: - case GL_PROGRAM_NATIVE_ATTRIBS_ARB: - case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: - case GL_PROGRAM_ADDRESS_REGISTERS_ARB: - case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB: - case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: - case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: - case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB: - case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB: - case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB: - case GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV: - case GL_MAX_PROGRAM_CALL_DEPTH_NV: - case GL_MAX_PROGRAM_IF_DEPTH_NV: - case GL_MAX_PROGRAM_LOOP_DEPTH_NV: - case GL_MAX_PROGRAM_LOOP_COUNT_NV: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetVertexAttribdvARB_size(GLenum e) -{ - switch (e) { - case GL_VERTEX_PROGRAM_ARB: - case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: - case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: - case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: - case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: - case GL_CURRENT_VERTEX_ATTRIB_ARB: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetQueryObjectivARB_size(GLenum e) -{ - switch (e) { - case GL_QUERY_RESULT_ARB: - case GL_QUERY_RESULT_AVAILABLE_ARB: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetQueryivARB_size(GLenum e) -{ - switch (e) { - case GL_QUERY_COUNTER_BITS_ARB: - case GL_CURRENT_QUERY_ARB: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glPointParameterfvEXT_size(GLenum e) -{ - switch (e) { - case GL_POINT_SIZE_MIN: -/* case GL_POINT_SIZE_MIN_ARB:*/ -/* case GL_POINT_SIZE_MIN_SGIS:*/ - case GL_POINT_SIZE_MAX: -/* case GL_POINT_SIZE_MAX_ARB:*/ -/* case GL_POINT_SIZE_MAX_SGIS:*/ - case GL_POINT_FADE_THRESHOLD_SIZE: -/* case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/ -/* case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/ - case GL_POINT_SPRITE_R_MODE_NV: - case GL_POINT_SPRITE_COORD_ORIGIN: - return 1; - case GL_POINT_DISTANCE_ATTENUATION: -/* case GL_POINT_DISTANCE_ATTENUATION_ARB:*/ -/* case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/ - return 3; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetProgramivNV_size(GLenum e) -{ - switch (e) { - case GL_PROGRAM_LENGTH_NV: - case GL_PROGRAM_TARGET_NV: - case GL_PROGRAM_RESIDENT_NV: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetVertexAttribdvNV_size(GLenum e) -{ - switch (e) { - case GL_ATTRIB_ARRAY_SIZE_NV: - case GL_ATTRIB_ARRAY_STRIDE_NV: - case GL_ATTRIB_ARRAY_TYPE_NV: - case GL_CURRENT_ATTRIB_NV: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetFramebufferAttachmentParameterivEXT_size(GLenum e) -{ - switch (e) { - case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: - return 1; - default: - return 0; - } -} - -ALIAS(Fogiv, Fogfv) - ALIAS(Lightiv, Lightfv) - ALIAS(LightModeliv, LightModelfv) - ALIAS(Materialiv, Materialfv) - ALIAS(TexParameteriv, TexParameterfv) - ALIAS(TexEnviv, TexEnvfv) - ALIAS(TexGenfv, TexGendv) - ALIAS(TexGeniv, TexGendv) - ALIAS(Map1f, Map1d) - ALIAS(Map2f, Map2d) - ALIAS(GetDoublev, GetBooleanv) - ALIAS(GetFloatv, GetBooleanv) - ALIAS(GetIntegerv, GetBooleanv) - ALIAS(GetLightfv, Lightfv) - ALIAS(GetLightiv, Lightfv) - ALIAS(GetMaterialfv, Materialfv) - ALIAS(GetMaterialiv, Materialfv) - ALIAS(GetTexEnvfv, TexEnvfv) - ALIAS(GetTexEnviv, TexEnvfv) - ALIAS(GetTexGendv, TexGendv) - ALIAS(GetTexGenfv, TexGendv) - ALIAS(GetTexGeniv, TexGendv) - ALIAS(GetTexParameteriv, GetTexParameterfv) - ALIAS(GetTexLevelParameteriv, GetTexLevelParameterfv) - ALIAS(ColorTableParameteriv, ColorTableParameterfv) - ALIAS(GetColorTableParameteriv, GetColorTableParameterfv) - ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) - ALIAS(GetConvolutionParameteriv, GetConvolutionParameterfv) - ALIAS(GetHistogramParameteriv, GetHistogramParameterfv) - ALIAS(GetMinmaxParameteriv, GetMinmaxParameterfv) - ALIAS(GetVertexAttribfvARB, GetVertexAttribdvARB) - ALIAS(GetVertexAttribivARB, GetVertexAttribdvARB) - ALIAS(GetQueryObjectuivARB, GetQueryObjectivARB) - ALIAS(GetVertexAttribfvNV, GetVertexAttribdvNV) - ALIAS(GetVertexAttribivNV, GetVertexAttribdvNV) - ALIAS(PointParameterivNV, PointParameterfvEXT) -# undef PURE -# undef FASTCALL -# undef INTERNAL diff --git a/src/glx/x11/indirect_size_get.h b/src/glx/x11/indirect_size_get.h deleted file mode 100644 index 4fcb55b4e1c..00000000000 --- a/src/glx/x11/indirect_size_get.h +++ /dev/null @@ -1,102 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (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 - * 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 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. - */ - -#if !defined( _INDIRECT_SIZE_GET_H_ ) -# define _INDIRECT_SIZE_GET_H_ - -/** - * \file - * Prototypes for functions used to determine the number of data elements in - * various GLX protocol messages. - * - * \author Ian Romanick <[email protected]> - */ - -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define PURE __attribute__((pure)) -# else -# define PURE -# endif - -# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) -# define FASTCALL __attribute__((fastcall)) -# else -# define FASTCALL -# endif - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define INTERNAL __attribute__((visibility("internal"))) -# else -# define INTERNAL -# endif - -extern INTERNAL PURE FASTCALL GLint __glGetBooleanv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetDoublev_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetFloatv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetIntegerv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetLightfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetLightiv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMaterialfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMaterialiv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexEnvfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexEnviv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexGendv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexGenfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexGeniv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint -__glGetConvolutionParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint -__glGetConvolutionParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint -__glGetFramebufferAttachmentParameterivEXT_size(GLenum); - -# undef PURE -# undef FASTCALL -# undef INTERNAL - -#endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */ diff --git a/src/glx/x11/indirect_table.c b/src/glx/x11/indirect_table.c deleted file mode 100644 index cb3202605d6..00000000000 --- a/src/glx/x11/indirect_table.c +++ /dev/null @@ -1,1596 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_server_table.py (from Mesa) script */ - -/* - * (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 - * 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 THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include <inttypes.h> -#include "glxserver.h" -#include "glxext.h" -#include "indirect_dispatch.h" -#include "indirect_reqsize.h" -#include "g_disptab.h" -#include "indirect_table.h" - -/*****************************************************************/ -/* tree depth = 3 */ -static const int_fast16_t Single_dispatch_tree[24] = { - /* [0] -> opcode range [0, 256], node depth 1 */ - 2, - 5, - 13, - 16, - EMPTY_LEAF, - - /* [5] -> opcode range [0, 64], node depth 2 */ - 2, - LEAF(0), - LEAF(16), - 10, - EMPTY_LEAF, - - /* [10] -> opcode range [32, 48], node depth 3 */ - 1, - LEAF(32), - EMPTY_LEAF, - - /* [13] -> opcode range [64, 128], node depth 2 */ - 1, - EMPTY_LEAF, - LEAF(40), - - /* [16] -> opcode range [128, 192], node depth 2 */ - 2, - LEAF(72), - LEAF(88), - 21, - EMPTY_LEAF, - - /* [21] -> opcode range [160, 176], node depth 3 */ - 1, - LEAF(104), - EMPTY_LEAF, - -}; - -static const void *Single_function_table[112][2] = { - /* [ 0] = 0 */ {NULL, NULL}, - /* [ 1] = 1 */ {__glXDisp_Render, __glXDispSwap_Render}, - /* [ 2] = 2 */ {__glXDisp_RenderLarge, __glXDispSwap_RenderLarge}, - /* [ 3] = 3 */ {__glXDisp_CreateContext, __glXDispSwap_CreateContext}, - /* [ 4] = 4 */ {__glXDisp_DestroyContext, __glXDispSwap_DestroyContext}, - /* [ 5] = 5 */ {__glXDisp_MakeCurrent, __glXDispSwap_MakeCurrent}, - /* [ 6] = 6 */ {__glXDisp_IsDirect, __glXDispSwap_IsDirect}, - /* [ 7] = 7 */ {__glXDisp_QueryVersion, __glXDispSwap_QueryVersion}, - /* [ 8] = 8 */ {__glXDisp_WaitGL, __glXDispSwap_WaitGL}, - /* [ 9] = 9 */ {__glXDisp_WaitX, __glXDispSwap_WaitX}, - /* [ 10] = 10 */ {__glXDisp_CopyContext, __glXDispSwap_CopyContext}, - /* [ 11] = 11 */ {__glXDisp_SwapBuffers, __glXDispSwap_SwapBuffers}, - /* [ 12] = 12 */ {__glXDisp_UseXFont, __glXDispSwap_UseXFont}, - /* [ 13] = 13 */ {__glXDisp_CreateGLXPixmap, __glXDispSwap_CreateGLXPixmap}, - /* [ 14] = 14 */ {__glXDisp_GetVisualConfigs, __glXDispSwap_GetVisualConfigs}, - /* [ 15] = 15 */ {__glXDisp_DestroyGLXPixmap, __glXDispSwap_DestroyGLXPixmap}, - /* [ 16] = 16 */ {__glXDisp_VendorPrivate, __glXDispSwap_VendorPrivate}, - /* [ 17] = 17 */ {__glXDisp_VendorPrivateWithReply, __glXDispSwap_VendorPrivateWithReply}, - /* [ 18] = 18 */ {__glXDisp_QueryExtensionsString, __glXDispSwap_QueryExtensionsString}, - /* [ 19] = 19 */ {__glXDisp_QueryServerString, __glXDispSwap_QueryServerString}, - /* [ 20] = 20 */ {__glXDisp_ClientInfo, __glXDispSwap_ClientInfo}, - /* [ 21] = 21 */ {__glXDisp_GetFBConfigs, __glXDispSwap_GetFBConfigs}, - /* [ 22] = 22 */ {__glXDisp_CreatePixmap, __glXDispSwap_CreatePixmap}, - /* [ 23] = 23 */ {__glXDisp_DestroyPixmap, __glXDispSwap_DestroyPixmap}, - /* [ 24] = 24 */ {__glXDisp_CreateNewContext, __glXDispSwap_CreateNewContext}, - /* [ 25] = 25 */ {__glXDisp_QueryContext, __glXDispSwap_QueryContext}, - /* [ 26] = 26 */ {__glXDisp_MakeContextCurrent, __glXDispSwap_MakeContextCurrent}, - /* [ 27] = 27 */ {__glXDisp_CreatePbuffer, __glXDispSwap_CreatePbuffer}, - /* [ 28] = 28 */ {__glXDisp_DestroyPbuffer, __glXDispSwap_DestroyPbuffer}, - /* [ 29] = 29 */ {__glXDisp_GetDrawableAttributes, __glXDispSwap_GetDrawableAttributes}, - /* [ 30] = 30 */ {__glXDisp_ChangeDrawableAttributes, __glXDispSwap_ChangeDrawableAttributes}, - /* [ 31] = 31 */ {__glXDisp_CreateWindow, __glXDispSwap_CreateWindow}, - /* [ 32] = 32 */ {__glXDisp_DestroyWindow, __glXDispSwap_DestroyWindow}, - /* [ 33] = 33 */ {NULL, NULL}, - /* [ 34] = 34 */ {NULL, NULL}, - /* [ 35] = 35 */ {NULL, NULL}, - /* [ 36] = 36 */ {NULL, NULL}, - /* [ 37] = 37 */ {NULL, NULL}, - /* [ 38] = 38 */ {NULL, NULL}, - /* [ 39] = 39 */ {NULL, NULL}, - /* [ 40] = 96 */ {NULL, NULL}, - /* [ 41] = 97 */ {NULL, NULL}, - /* [ 42] = 98 */ {NULL, NULL}, - /* [ 43] = 99 */ {NULL, NULL}, - /* [ 44] = 100 */ {NULL, NULL}, - /* [ 45] = 101 */ {__glXDisp_NewList, __glXDispSwap_NewList}, - /* [ 46] = 102 */ {__glXDisp_EndList, __glXDispSwap_EndList}, - /* [ 47] = 103 */ {__glXDisp_DeleteLists, __glXDispSwap_DeleteLists}, - /* [ 48] = 104 */ {__glXDisp_GenLists, __glXDispSwap_GenLists}, - /* [ 49] = 105 */ {__glXDisp_FeedbackBuffer, __glXDispSwap_FeedbackBuffer}, - /* [ 50] = 106 */ {__glXDisp_SelectBuffer, __glXDispSwap_SelectBuffer}, - /* [ 51] = 107 */ {__glXDisp_RenderMode, __glXDispSwap_RenderMode}, - /* [ 52] = 108 */ {__glXDisp_Finish, __glXDispSwap_Finish}, - /* [ 53] = 109 */ {__glXDisp_PixelStoref, __glXDispSwap_PixelStoref}, - /* [ 54] = 110 */ {__glXDisp_PixelStorei, __glXDispSwap_PixelStorei}, - /* [ 55] = 111 */ {__glXDisp_ReadPixels, __glXDispSwap_ReadPixels}, - /* [ 56] = 112 */ {__glXDisp_GetBooleanv, __glXDispSwap_GetBooleanv}, - /* [ 57] = 113 */ {__glXDisp_GetClipPlane, __glXDispSwap_GetClipPlane}, - /* [ 58] = 114 */ {__glXDisp_GetDoublev, __glXDispSwap_GetDoublev}, - /* [ 59] = 115 */ {__glXDisp_GetError, __glXDispSwap_GetError}, - /* [ 60] = 116 */ {__glXDisp_GetFloatv, __glXDispSwap_GetFloatv}, - /* [ 61] = 117 */ {__glXDisp_GetIntegerv, __glXDispSwap_GetIntegerv}, - /* [ 62] = 118 */ {__glXDisp_GetLightfv, __glXDispSwap_GetLightfv}, - /* [ 63] = 119 */ {__glXDisp_GetLightiv, __glXDispSwap_GetLightiv}, - /* [ 64] = 120 */ {__glXDisp_GetMapdv, __glXDispSwap_GetMapdv}, - /* [ 65] = 121 */ {__glXDisp_GetMapfv, __glXDispSwap_GetMapfv}, - /* [ 66] = 122 */ {__glXDisp_GetMapiv, __glXDispSwap_GetMapiv}, - /* [ 67] = 123 */ {__glXDisp_GetMaterialfv, __glXDispSwap_GetMaterialfv}, - /* [ 68] = 124 */ {__glXDisp_GetMaterialiv, __glXDispSwap_GetMaterialiv}, - /* [ 69] = 125 */ {__glXDisp_GetPixelMapfv, __glXDispSwap_GetPixelMapfv}, - /* [ 70] = 126 */ {__glXDisp_GetPixelMapuiv, __glXDispSwap_GetPixelMapuiv}, - /* [ 71] = 127 */ {__glXDisp_GetPixelMapusv, __glXDispSwap_GetPixelMapusv}, - /* [ 72] = 128 */ {__glXDisp_GetPolygonStipple, __glXDispSwap_GetPolygonStipple}, - /* [ 73] = 129 */ {__glXDisp_GetString, __glXDispSwap_GetString}, - /* [ 74] = 130 */ {__glXDisp_GetTexEnvfv, __glXDispSwap_GetTexEnvfv}, - /* [ 75] = 131 */ {__glXDisp_GetTexEnviv, __glXDispSwap_GetTexEnviv}, - /* [ 76] = 132 */ {__glXDisp_GetTexGendv, __glXDispSwap_GetTexGendv}, - /* [ 77] = 133 */ {__glXDisp_GetTexGenfv, __glXDispSwap_GetTexGenfv}, - /* [ 78] = 134 */ {__glXDisp_GetTexGeniv, __glXDispSwap_GetTexGeniv}, - /* [ 79] = 135 */ {__glXDisp_GetTexImage, __glXDispSwap_GetTexImage}, - /* [ 80] = 136 */ {__glXDisp_GetTexParameterfv, __glXDispSwap_GetTexParameterfv}, - /* [ 81] = 137 */ {__glXDisp_GetTexParameteriv, __glXDispSwap_GetTexParameteriv}, - /* [ 82] = 138 */ {__glXDisp_GetTexLevelParameterfv, __glXDispSwap_GetTexLevelParameterfv}, - /* [ 83] = 139 */ {__glXDisp_GetTexLevelParameteriv, __glXDispSwap_GetTexLevelParameteriv}, - /* [ 84] = 140 */ {__glXDisp_IsEnabled, __glXDispSwap_IsEnabled}, - /* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList}, - /* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush}, - /* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident}, - /* [ 88] = 144 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures}, - /* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures}, - /* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture}, - /* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable}, - /* [ 92] = 148 */ {__glXDisp_GetColorTableParameterfv, __glXDispSwap_GetColorTableParameterfv}, - /* [ 93] = 149 */ {__glXDisp_GetColorTableParameteriv, __glXDispSwap_GetColorTableParameteriv}, - /* [ 94] = 150 */ {__glXDisp_GetConvolutionFilter, __glXDispSwap_GetConvolutionFilter}, - /* [ 95] = 151 */ {__glXDisp_GetConvolutionParameterfv, __glXDispSwap_GetConvolutionParameterfv}, - /* [ 96] = 152 */ {__glXDisp_GetConvolutionParameteriv, __glXDispSwap_GetConvolutionParameteriv}, - /* [ 97] = 153 */ {__glXDisp_GetSeparableFilter, __glXDispSwap_GetSeparableFilter}, - /* [ 98] = 154 */ {__glXDisp_GetHistogram, __glXDispSwap_GetHistogram}, - /* [ 99] = 155 */ {__glXDisp_GetHistogramParameterfv, __glXDispSwap_GetHistogramParameterfv}, - /* [ 100] = 156 */ {__glXDisp_GetHistogramParameteriv, __glXDispSwap_GetHistogramParameteriv}, - /* [ 101] = 157 */ {__glXDisp_GetMinmax, __glXDispSwap_GetMinmax}, - /* [ 102] = 158 */ {__glXDisp_GetMinmaxParameterfv, __glXDispSwap_GetMinmaxParameterfv}, - /* [ 103] = 159 */ {__glXDisp_GetMinmaxParameteriv, __glXDispSwap_GetMinmaxParameteriv}, - /* [ 104] = 160 */ {__glXDisp_GetCompressedTexImageARB, __glXDispSwap_GetCompressedTexImageARB}, - /* [ 105] = 161 */ {__glXDisp_DeleteQueriesARB, __glXDispSwap_DeleteQueriesARB}, - /* [ 106] = 162 */ {__glXDisp_GenQueriesARB, __glXDispSwap_GenQueriesARB}, - /* [ 107] = 163 */ {__glXDisp_IsQueryARB, __glXDispSwap_IsQueryARB}, - /* [ 108] = 164 */ {__glXDisp_GetQueryivARB, __glXDispSwap_GetQueryivARB}, - /* [ 109] = 165 */ {__glXDisp_GetQueryObjectivARB, __glXDispSwap_GetQueryObjectivARB}, - /* [ 110] = 166 */ {__glXDisp_GetQueryObjectuivARB, __glXDispSwap_GetQueryObjectuivARB}, - /* [ 111] = 167 */ {NULL, NULL}, -}; - -const struct __glXDispatchInfo Single_dispatch_info = { - 8, - Single_dispatch_tree, - Single_function_table, - NULL, - NULL -}; - -/*****************************************************************/ -/* tree depth = 8 */ -static const int_fast16_t Render_dispatch_tree[95] = { - /* [0] -> opcode range [0, 8192], node depth 1 */ - 2, - 5, - 31, - 54, - EMPTY_LEAF, - - /* [5] -> opcode range [0, 2048], node depth 2 */ - 1, - 8, - EMPTY_LEAF, - - /* [8] -> opcode range [0, 1024], node depth 3 */ - 1, - 11, - EMPTY_LEAF, - - /* [11] -> opcode range [0, 512], node depth 4 */ - 1, - 14, - EMPTY_LEAF, - - /* [14] -> opcode range [0, 256], node depth 5 */ - 4, - LEAF(0), - LEAF(16), - LEAF(32), - LEAF(48), - LEAF(64), - LEAF(80), - LEAF(96), - LEAF(112), - LEAF(128), - LEAF(144), - LEAF(160), - LEAF(176), - LEAF(192), - LEAF(208), - LEAF(224), - EMPTY_LEAF, - - /* [31] -> opcode range [2048, 4096], node depth 2 */ - 1, - 34, - EMPTY_LEAF, - - /* [34] -> opcode range [2048, 3072], node depth 3 */ - 1, - 37, - EMPTY_LEAF, - - /* [37] -> opcode range [2048, 2560], node depth 4 */ - 1, - 40, - EMPTY_LEAF, - - /* [40] -> opcode range [2048, 2304], node depth 5 */ - 1, - 43, - EMPTY_LEAF, - - /* [43] -> opcode range [2048, 2176], node depth 6 */ - 1, - 46, - EMPTY_LEAF, - - /* [46] -> opcode range [2048, 2112], node depth 7 */ - 1, - 49, - EMPTY_LEAF, - - /* [49] -> opcode range [2048, 2080], node depth 8 */ - 2, - LEAF(240), - LEAF(248), - LEAF(256), - EMPTY_LEAF, - - /* [54] -> opcode range [4096, 6144], node depth 2 */ - 1, - 57, - EMPTY_LEAF, - - /* [57] -> opcode range [4096, 5120], node depth 3 */ - 1, - 60, - EMPTY_LEAF, - - /* [60] -> opcode range [4096, 4608], node depth 4 */ - 1, - 63, - EMPTY_LEAF, - - /* [63] -> opcode range [4096, 4352], node depth 5 */ - 4, - LEAF(264), - LEAF(280), - 80, - EMPTY_LEAF, - EMPTY_LEAF, - LEAF(296), - LEAF(312), - LEAF(328), - LEAF(344), - EMPTY_LEAF, - 83, - 86, - EMPTY_LEAF, - 89, - 92, - EMPTY_LEAF, - - /* [80] -> opcode range [4128, 4144], node depth 6 */ - 1, - LEAF(360), - EMPTY_LEAF, - - /* [83] -> opcode range [4256, 4272], node depth 6 */ - 1, - EMPTY_LEAF, - LEAF(368), - - /* [86] -> opcode range [4272, 4288], node depth 6 */ - 1, - LEAF(376), - EMPTY_LEAF, - - /* [89] -> opcode range [4304, 4320], node depth 6 */ - 1, - EMPTY_LEAF, - LEAF(384), - - /* [92] -> opcode range [4320, 4336], node depth 6 */ - 1, - LEAF(392), - EMPTY_LEAF, - -}; - -static const void *Render_function_table[400][2] = { - /* [ 0] = 0 */ {NULL, NULL}, - /* [ 1] = 1 */ {__glXDisp_CallList, __glXDispSwap_CallList}, - /* [ 2] = 2 */ {__glXDisp_CallLists, __glXDispSwap_CallLists}, - /* [ 3] = 3 */ {__glXDisp_ListBase, __glXDispSwap_ListBase}, - /* [ 4] = 4 */ {__glXDisp_Begin, __glXDispSwap_Begin}, - /* [ 5] = 5 */ {__glXDisp_Bitmap, __glXDispSwap_Bitmap}, - /* [ 6] = 6 */ {__glXDisp_Color3bv, __glXDispSwap_Color3bv}, - /* [ 7] = 7 */ {__glXDisp_Color3dv, __glXDispSwap_Color3dv}, - /* [ 8] = 8 */ {__glXDisp_Color3fv, __glXDispSwap_Color3fv}, - /* [ 9] = 9 */ {__glXDisp_Color3iv, __glXDispSwap_Color3iv}, - /* [ 10] = 10 */ {__glXDisp_Color3sv, __glXDispSwap_Color3sv}, - /* [ 11] = 11 */ {__glXDisp_Color3ubv, __glXDispSwap_Color3ubv}, - /* [ 12] = 12 */ {__glXDisp_Color3uiv, __glXDispSwap_Color3uiv}, - /* [ 13] = 13 */ {__glXDisp_Color3usv, __glXDispSwap_Color3usv}, - /* [ 14] = 14 */ {__glXDisp_Color4bv, __glXDispSwap_Color4bv}, - /* [ 15] = 15 */ {__glXDisp_Color4dv, __glXDispSwap_Color4dv}, - /* [ 16] = 16 */ {__glXDisp_Color4fv, __glXDispSwap_Color4fv}, - /* [ 17] = 17 */ {__glXDisp_Color4iv, __glXDispSwap_Color4iv}, - /* [ 18] = 18 */ {__glXDisp_Color4sv, __glXDispSwap_Color4sv}, - /* [ 19] = 19 */ {__glXDisp_Color4ubv, __glXDispSwap_Color4ubv}, - /* [ 20] = 20 */ {__glXDisp_Color4uiv, __glXDispSwap_Color4uiv}, - /* [ 21] = 21 */ {__glXDisp_Color4usv, __glXDispSwap_Color4usv}, - /* [ 22] = 22 */ {__glXDisp_EdgeFlagv, __glXDispSwap_EdgeFlagv}, - /* [ 23] = 23 */ {__glXDisp_End, __glXDispSwap_End}, - /* [ 24] = 24 */ {__glXDisp_Indexdv, __glXDispSwap_Indexdv}, - /* [ 25] = 25 */ {__glXDisp_Indexfv, __glXDispSwap_Indexfv}, - /* [ 26] = 26 */ {__glXDisp_Indexiv, __glXDispSwap_Indexiv}, - /* [ 27] = 27 */ {__glXDisp_Indexsv, __glXDispSwap_Indexsv}, - /* [ 28] = 28 */ {__glXDisp_Normal3bv, __glXDispSwap_Normal3bv}, - /* [ 29] = 29 */ {__glXDisp_Normal3dv, __glXDispSwap_Normal3dv}, - /* [ 30] = 30 */ {__glXDisp_Normal3fv, __glXDispSwap_Normal3fv}, - /* [ 31] = 31 */ {__glXDisp_Normal3iv, __glXDispSwap_Normal3iv}, - /* [ 32] = 32 */ {__glXDisp_Normal3sv, __glXDispSwap_Normal3sv}, - /* [ 33] = 33 */ {__glXDisp_RasterPos2dv, __glXDispSwap_RasterPos2dv}, - /* [ 34] = 34 */ {__glXDisp_RasterPos2fv, __glXDispSwap_RasterPos2fv}, - /* [ 35] = 35 */ {__glXDisp_RasterPos2iv, __glXDispSwap_RasterPos2iv}, - /* [ 36] = 36 */ {__glXDisp_RasterPos2sv, __glXDispSwap_RasterPos2sv}, - /* [ 37] = 37 */ {__glXDisp_RasterPos3dv, __glXDispSwap_RasterPos3dv}, - /* [ 38] = 38 */ {__glXDisp_RasterPos3fv, __glXDispSwap_RasterPos3fv}, - /* [ 39] = 39 */ {__glXDisp_RasterPos3iv, __glXDispSwap_RasterPos3iv}, - /* [ 40] = 40 */ {__glXDisp_RasterPos3sv, __glXDispSwap_RasterPos3sv}, - /* [ 41] = 41 */ {__glXDisp_RasterPos4dv, __glXDispSwap_RasterPos4dv}, - /* [ 42] = 42 */ {__glXDisp_RasterPos4fv, __glXDispSwap_RasterPos4fv}, - /* [ 43] = 43 */ {__glXDisp_RasterPos4iv, __glXDispSwap_RasterPos4iv}, - /* [ 44] = 44 */ {__glXDisp_RasterPos4sv, __glXDispSwap_RasterPos4sv}, - /* [ 45] = 45 */ {__glXDisp_Rectdv, __glXDispSwap_Rectdv}, - /* [ 46] = 46 */ {__glXDisp_Rectfv, __glXDispSwap_Rectfv}, - /* [ 47] = 47 */ {__glXDisp_Rectiv, __glXDispSwap_Rectiv}, - /* [ 48] = 48 */ {__glXDisp_Rectsv, __glXDispSwap_Rectsv}, - /* [ 49] = 49 */ {__glXDisp_TexCoord1dv, __glXDispSwap_TexCoord1dv}, - /* [ 50] = 50 */ {__glXDisp_TexCoord1fv, __glXDispSwap_TexCoord1fv}, - /* [ 51] = 51 */ {__glXDisp_TexCoord1iv, __glXDispSwap_TexCoord1iv}, - /* [ 52] = 52 */ {__glXDisp_TexCoord1sv, __glXDispSwap_TexCoord1sv}, - /* [ 53] = 53 */ {__glXDisp_TexCoord2dv, __glXDispSwap_TexCoord2dv}, - /* [ 54] = 54 */ {__glXDisp_TexCoord2fv, __glXDispSwap_TexCoord2fv}, - /* [ 55] = 55 */ {__glXDisp_TexCoord2iv, __glXDispSwap_TexCoord2iv}, - /* [ 56] = 56 */ {__glXDisp_TexCoord2sv, __glXDispSwap_TexCoord2sv}, - /* [ 57] = 57 */ {__glXDisp_TexCoord3dv, __glXDispSwap_TexCoord3dv}, - /* [ 58] = 58 */ {__glXDisp_TexCoord3fv, __glXDispSwap_TexCoord3fv}, - /* [ 59] = 59 */ {__glXDisp_TexCoord3iv, __glXDispSwap_TexCoord3iv}, - /* [ 60] = 60 */ {__glXDisp_TexCoord3sv, __glXDispSwap_TexCoord3sv}, - /* [ 61] = 61 */ {__glXDisp_TexCoord4dv, __glXDispSwap_TexCoord4dv}, - /* [ 62] = 62 */ {__glXDisp_TexCoord4fv, __glXDispSwap_TexCoord4fv}, - /* [ 63] = 63 */ {__glXDisp_TexCoord4iv, __glXDispSwap_TexCoord4iv}, - /* [ 64] = 64 */ {__glXDisp_TexCoord4sv, __glXDispSwap_TexCoord4sv}, - /* [ 65] = 65 */ {__glXDisp_Vertex2dv, __glXDispSwap_Vertex2dv}, - /* [ 66] = 66 */ {__glXDisp_Vertex2fv, __glXDispSwap_Vertex2fv}, - /* [ 67] = 67 */ {__glXDisp_Vertex2iv, __glXDispSwap_Vertex2iv}, - /* [ 68] = 68 */ {__glXDisp_Vertex2sv, __glXDispSwap_Vertex2sv}, - /* [ 69] = 69 */ {__glXDisp_Vertex3dv, __glXDispSwap_Vertex3dv}, - /* [ 70] = 70 */ {__glXDisp_Vertex3fv, __glXDispSwap_Vertex3fv}, - /* [ 71] = 71 */ {__glXDisp_Vertex3iv, __glXDispSwap_Vertex3iv}, - /* [ 72] = 72 */ {__glXDisp_Vertex3sv, __glXDispSwap_Vertex3sv}, - /* [ 73] = 73 */ {__glXDisp_Vertex4dv, __glXDispSwap_Vertex4dv}, - /* [ 74] = 74 */ {__glXDisp_Vertex4fv, __glXDispSwap_Vertex4fv}, - /* [ 75] = 75 */ {__glXDisp_Vertex4iv, __glXDispSwap_Vertex4iv}, - /* [ 76] = 76 */ {__glXDisp_Vertex4sv, __glXDispSwap_Vertex4sv}, - /* [ 77] = 77 */ {__glXDisp_ClipPlane, __glXDispSwap_ClipPlane}, - /* [ 78] = 78 */ {__glXDisp_ColorMaterial, __glXDispSwap_ColorMaterial}, - /* [ 79] = 79 */ {__glXDisp_CullFace, __glXDispSwap_CullFace}, - /* [ 80] = 80 */ {__glXDisp_Fogf, __glXDispSwap_Fogf}, - /* [ 81] = 81 */ {__glXDisp_Fogfv, __glXDispSwap_Fogfv}, - /* [ 82] = 82 */ {__glXDisp_Fogi, __glXDispSwap_Fogi}, - /* [ 83] = 83 */ {__glXDisp_Fogiv, __glXDispSwap_Fogiv}, - /* [ 84] = 84 */ {__glXDisp_FrontFace, __glXDispSwap_FrontFace}, - /* [ 85] = 85 */ {__glXDisp_Hint, __glXDispSwap_Hint}, - /* [ 86] = 86 */ {__glXDisp_Lightf, __glXDispSwap_Lightf}, - /* [ 87] = 87 */ {__glXDisp_Lightfv, __glXDispSwap_Lightfv}, - /* [ 88] = 88 */ {__glXDisp_Lighti, __glXDispSwap_Lighti}, - /* [ 89] = 89 */ {__glXDisp_Lightiv, __glXDispSwap_Lightiv}, - /* [ 90] = 90 */ {__glXDisp_LightModelf, __glXDispSwap_LightModelf}, - /* [ 91] = 91 */ {__glXDisp_LightModelfv, __glXDispSwap_LightModelfv}, - /* [ 92] = 92 */ {__glXDisp_LightModeli, __glXDispSwap_LightModeli}, - /* [ 93] = 93 */ {__glXDisp_LightModeliv, __glXDispSwap_LightModeliv}, - /* [ 94] = 94 */ {__glXDisp_LineStipple, __glXDispSwap_LineStipple}, - /* [ 95] = 95 */ {__glXDisp_LineWidth, __glXDispSwap_LineWidth}, - /* [ 96] = 96 */ {__glXDisp_Materialf, __glXDispSwap_Materialf}, - /* [ 97] = 97 */ {__glXDisp_Materialfv, __glXDispSwap_Materialfv}, - /* [ 98] = 98 */ {__glXDisp_Materiali, __glXDispSwap_Materiali}, - /* [ 99] = 99 */ {__glXDisp_Materialiv, __glXDispSwap_Materialiv}, - /* [ 100] = 100 */ {__glXDisp_PointSize, __glXDispSwap_PointSize}, - /* [ 101] = 101 */ {__glXDisp_PolygonMode, __glXDispSwap_PolygonMode}, - /* [ 102] = 102 */ {__glXDisp_PolygonStipple, __glXDispSwap_PolygonStipple}, - /* [ 103] = 103 */ {__glXDisp_Scissor, __glXDispSwap_Scissor}, - /* [ 104] = 104 */ {__glXDisp_ShadeModel, __glXDispSwap_ShadeModel}, - /* [ 105] = 105 */ {__glXDisp_TexParameterf, __glXDispSwap_TexParameterf}, - /* [ 106] = 106 */ {__glXDisp_TexParameterfv, __glXDispSwap_TexParameterfv}, - /* [ 107] = 107 */ {__glXDisp_TexParameteri, __glXDispSwap_TexParameteri}, - /* [ 108] = 108 */ {__glXDisp_TexParameteriv, __glXDispSwap_TexParameteriv}, - /* [ 109] = 109 */ {__glXDisp_TexImage1D, __glXDispSwap_TexImage1D}, - /* [ 110] = 110 */ {__glXDisp_TexImage2D, __glXDispSwap_TexImage2D}, - /* [ 111] = 111 */ {__glXDisp_TexEnvf, __glXDispSwap_TexEnvf}, - /* [ 112] = 112 */ {__glXDisp_TexEnvfv, __glXDispSwap_TexEnvfv}, - /* [ 113] = 113 */ {__glXDisp_TexEnvi, __glXDispSwap_TexEnvi}, - /* [ 114] = 114 */ {__glXDisp_TexEnviv, __glXDispSwap_TexEnviv}, - /* [ 115] = 115 */ {__glXDisp_TexGend, __glXDispSwap_TexGend}, - /* [ 116] = 116 */ {__glXDisp_TexGendv, __glXDispSwap_TexGendv}, - /* [ 117] = 117 */ {__glXDisp_TexGenf, __glXDispSwap_TexGenf}, - /* [ 118] = 118 */ {__glXDisp_TexGenfv, __glXDispSwap_TexGenfv}, - /* [ 119] = 119 */ {__glXDisp_TexGeni, __glXDispSwap_TexGeni}, - /* [ 120] = 120 */ {__glXDisp_TexGeniv, __glXDispSwap_TexGeniv}, - /* [ 121] = 121 */ {__glXDisp_InitNames, __glXDispSwap_InitNames}, - /* [ 122] = 122 */ {__glXDisp_LoadName, __glXDispSwap_LoadName}, - /* [ 123] = 123 */ {__glXDisp_PassThrough, __glXDispSwap_PassThrough}, - /* [ 124] = 124 */ {__glXDisp_PopName, __glXDispSwap_PopName}, - /* [ 125] = 125 */ {__glXDisp_PushName, __glXDispSwap_PushName}, - /* [ 126] = 126 */ {__glXDisp_DrawBuffer, __glXDispSwap_DrawBuffer}, - /* [ 127] = 127 */ {__glXDisp_Clear, __glXDispSwap_Clear}, - /* [ 128] = 128 */ {__glXDisp_ClearAccum, __glXDispSwap_ClearAccum}, - /* [ 129] = 129 */ {__glXDisp_ClearIndex, __glXDispSwap_ClearIndex}, - /* [ 130] = 130 */ {__glXDisp_ClearColor, __glXDispSwap_ClearColor}, - /* [ 131] = 131 */ {__glXDisp_ClearStencil, __glXDispSwap_ClearStencil}, - /* [ 132] = 132 */ {__glXDisp_ClearDepth, __glXDispSwap_ClearDepth}, - /* [ 133] = 133 */ {__glXDisp_StencilMask, __glXDispSwap_StencilMask}, - /* [ 134] = 134 */ {__glXDisp_ColorMask, __glXDispSwap_ColorMask}, - /* [ 135] = 135 */ {__glXDisp_DepthMask, __glXDispSwap_DepthMask}, - /* [ 136] = 136 */ {__glXDisp_IndexMask, __glXDispSwap_IndexMask}, - /* [ 137] = 137 */ {__glXDisp_Accum, __glXDispSwap_Accum}, - /* [ 138] = 138 */ {__glXDisp_Disable, __glXDispSwap_Disable}, - /* [ 139] = 139 */ {__glXDisp_Enable, __glXDispSwap_Enable}, - /* [ 140] = 140 */ {NULL, NULL}, - /* [ 141] = 141 */ {__glXDisp_PopAttrib, __glXDispSwap_PopAttrib}, - /* [ 142] = 142 */ {__glXDisp_PushAttrib, __glXDispSwap_PushAttrib}, - /* [ 143] = 143 */ {__glXDisp_Map1d, __glXDispSwap_Map1d}, - /* [ 144] = 144 */ {__glXDisp_Map1f, __glXDispSwap_Map1f}, - /* [ 145] = 145 */ {__glXDisp_Map2d, __glXDispSwap_Map2d}, - /* [ 146] = 146 */ {__glXDisp_Map2f, __glXDispSwap_Map2f}, - /* [ 147] = 147 */ {__glXDisp_MapGrid1d, __glXDispSwap_MapGrid1d}, - /* [ 148] = 148 */ {__glXDisp_MapGrid1f, __glXDispSwap_MapGrid1f}, - /* [ 149] = 149 */ {__glXDisp_MapGrid2d, __glXDispSwap_MapGrid2d}, - /* [ 150] = 150 */ {__glXDisp_MapGrid2f, __glXDispSwap_MapGrid2f}, - /* [ 151] = 151 */ {__glXDisp_EvalCoord1dv, __glXDispSwap_EvalCoord1dv}, - /* [ 152] = 152 */ {__glXDisp_EvalCoord1fv, __glXDispSwap_EvalCoord1fv}, - /* [ 153] = 153 */ {__glXDisp_EvalCoord2dv, __glXDispSwap_EvalCoord2dv}, - /* [ 154] = 154 */ {__glXDisp_EvalCoord2fv, __glXDispSwap_EvalCoord2fv}, - /* [ 155] = 155 */ {__glXDisp_EvalMesh1, __glXDispSwap_EvalMesh1}, - /* [ 156] = 156 */ {__glXDisp_EvalPoint1, __glXDispSwap_EvalPoint1}, - /* [ 157] = 157 */ {__glXDisp_EvalMesh2, __glXDispSwap_EvalMesh2}, - /* [ 158] = 158 */ {__glXDisp_EvalPoint2, __glXDispSwap_EvalPoint2}, - /* [ 159] = 159 */ {__glXDisp_AlphaFunc, __glXDispSwap_AlphaFunc}, - /* [ 160] = 160 */ {__glXDisp_BlendFunc, __glXDispSwap_BlendFunc}, - /* [ 161] = 161 */ {__glXDisp_LogicOp, __glXDispSwap_LogicOp}, - /* [ 162] = 162 */ {__glXDisp_StencilFunc, __glXDispSwap_StencilFunc}, - /* [ 163] = 163 */ {__glXDisp_StencilOp, __glXDispSwap_StencilOp}, - /* [ 164] = 164 */ {__glXDisp_DepthFunc, __glXDispSwap_DepthFunc}, - /* [ 165] = 165 */ {__glXDisp_PixelZoom, __glXDispSwap_PixelZoom}, - /* [ 166] = 166 */ {__glXDisp_PixelTransferf, __glXDispSwap_PixelTransferf}, - /* [ 167] = 167 */ {__glXDisp_PixelTransferi, __glXDispSwap_PixelTransferi}, - /* [ 168] = 168 */ {__glXDisp_PixelMapfv, __glXDispSwap_PixelMapfv}, - /* [ 169] = 169 */ {__glXDisp_PixelMapuiv, __glXDispSwap_PixelMapuiv}, - /* [ 170] = 170 */ {__glXDisp_PixelMapusv, __glXDispSwap_PixelMapusv}, - /* [ 171] = 171 */ {__glXDisp_ReadBuffer, __glXDispSwap_ReadBuffer}, - /* [ 172] = 172 */ {__glXDisp_CopyPixels, __glXDispSwap_CopyPixels}, - /* [ 173] = 173 */ {__glXDisp_DrawPixels, __glXDispSwap_DrawPixels}, - /* [ 174] = 174 */ {__glXDisp_DepthRange, __glXDispSwap_DepthRange}, - /* [ 175] = 175 */ {__glXDisp_Frustum, __glXDispSwap_Frustum}, - /* [ 176] = 176 */ {__glXDisp_LoadIdentity, __glXDispSwap_LoadIdentity}, - /* [ 177] = 177 */ {__glXDisp_LoadMatrixf, __glXDispSwap_LoadMatrixf}, - /* [ 178] = 178 */ {__glXDisp_LoadMatrixd, __glXDispSwap_LoadMatrixd}, - /* [ 179] = 179 */ {__glXDisp_MatrixMode, __glXDispSwap_MatrixMode}, - /* [ 180] = 180 */ {__glXDisp_MultMatrixf, __glXDispSwap_MultMatrixf}, - /* [ 181] = 181 */ {__glXDisp_MultMatrixd, __glXDispSwap_MultMatrixd}, - /* [ 182] = 182 */ {__glXDisp_Ortho, __glXDispSwap_Ortho}, - /* [ 183] = 183 */ {__glXDisp_PopMatrix, __glXDispSwap_PopMatrix}, - /* [ 184] = 184 */ {__glXDisp_PushMatrix, __glXDispSwap_PushMatrix}, - /* [ 185] = 185 */ {__glXDisp_Rotated, __glXDispSwap_Rotated}, - /* [ 186] = 186 */ {__glXDisp_Rotatef, __glXDispSwap_Rotatef}, - /* [ 187] = 187 */ {__glXDisp_Scaled, __glXDispSwap_Scaled}, - /* [ 188] = 188 */ {__glXDisp_Scalef, __glXDispSwap_Scalef}, - /* [ 189] = 189 */ {__glXDisp_Translated, __glXDispSwap_Translated}, - /* [ 190] = 190 */ {__glXDisp_Translatef, __glXDispSwap_Translatef}, - /* [ 191] = 191 */ {__glXDisp_Viewport, __glXDispSwap_Viewport}, - /* [ 192] = 192 */ {__glXDisp_PolygonOffset, __glXDispSwap_PolygonOffset}, - /* [ 193] = 193 */ {__glXDisp_DrawArrays, __glXDispSwap_DrawArrays}, - /* [ 194] = 194 */ {__glXDisp_Indexubv, __glXDispSwap_Indexubv}, - /* [ 195] = 195 */ {__glXDisp_ColorSubTable, __glXDispSwap_ColorSubTable}, - /* [ 196] = 196 */ {__glXDisp_CopyColorSubTable, __glXDispSwap_CopyColorSubTable}, - /* [ 197] = 197 */ {__glXDisp_ActiveTextureARB, __glXDispSwap_ActiveTextureARB}, - /* [ 198] = 198 */ {__glXDisp_MultiTexCoord1dvARB, __glXDispSwap_MultiTexCoord1dvARB}, - /* [ 199] = 199 */ {__glXDisp_MultiTexCoord1fvARB, __glXDispSwap_MultiTexCoord1fvARB}, - /* [ 200] = 200 */ {__glXDisp_MultiTexCoord1ivARB, __glXDispSwap_MultiTexCoord1ivARB}, - /* [ 201] = 201 */ {__glXDisp_MultiTexCoord1svARB, __glXDispSwap_MultiTexCoord1svARB}, - /* [ 202] = 202 */ {__glXDisp_MultiTexCoord2dvARB, __glXDispSwap_MultiTexCoord2dvARB}, - /* [ 203] = 203 */ {__glXDisp_MultiTexCoord2fvARB, __glXDispSwap_MultiTexCoord2fvARB}, - /* [ 204] = 204 */ {__glXDisp_MultiTexCoord2ivARB, __glXDispSwap_MultiTexCoord2ivARB}, - /* [ 205] = 205 */ {__glXDisp_MultiTexCoord2svARB, __glXDispSwap_MultiTexCoord2svARB}, - /* [ 206] = 206 */ {__glXDisp_MultiTexCoord3dvARB, __glXDispSwap_MultiTexCoord3dvARB}, - /* [ 207] = 207 */ {__glXDisp_MultiTexCoord3fvARB, __glXDispSwap_MultiTexCoord3fvARB}, - /* [ 208] = 208 */ {__glXDisp_MultiTexCoord3ivARB, __glXDispSwap_MultiTexCoord3ivARB}, - /* [ 209] = 209 */ {__glXDisp_MultiTexCoord3svARB, __glXDispSwap_MultiTexCoord3svARB}, - /* [ 210] = 210 */ {__glXDisp_MultiTexCoord4dvARB, __glXDispSwap_MultiTexCoord4dvARB}, - /* [ 211] = 211 */ {__glXDisp_MultiTexCoord4fvARB, __glXDispSwap_MultiTexCoord4fvARB}, - /* [ 212] = 212 */ {__glXDisp_MultiTexCoord4ivARB, __glXDispSwap_MultiTexCoord4ivARB}, - /* [ 213] = 213 */ {__glXDisp_MultiTexCoord4svARB, __glXDispSwap_MultiTexCoord4svARB}, - /* [ 214] = 214 */ {__glXDisp_CompressedTexImage1DARB, __glXDispSwap_CompressedTexImage1DARB}, - /* [ 215] = 215 */ {__glXDisp_CompressedTexImage2DARB, __glXDispSwap_CompressedTexImage2DARB}, - /* [ 216] = 216 */ {__glXDisp_CompressedTexImage3DARB, __glXDispSwap_CompressedTexImage3DARB}, - /* [ 217] = 217 */ {__glXDisp_CompressedTexSubImage1DARB, __glXDispSwap_CompressedTexSubImage1DARB}, - /* [ 218] = 218 */ {__glXDisp_CompressedTexSubImage2DARB, __glXDispSwap_CompressedTexSubImage2DARB}, - /* [ 219] = 219 */ {__glXDisp_CompressedTexSubImage3DARB, __glXDispSwap_CompressedTexSubImage3DARB}, - /* [ 220] = 220 */ {NULL, NULL}, - /* [ 221] = 221 */ {NULL, NULL}, - /* [ 222] = 222 */ {NULL, NULL}, - /* [ 223] = 223 */ {NULL, NULL}, - /* [ 224] = 224 */ {NULL, NULL}, - /* [ 225] = 225 */ {NULL, NULL}, - /* [ 226] = 226 */ {NULL, NULL}, - /* [ 227] = 227 */ {NULL, NULL}, - /* [ 228] = 228 */ {NULL, NULL}, - /* [ 229] = 229 */ {__glXDisp_SampleCoverageARB, __glXDispSwap_SampleCoverageARB}, - /* [ 230] = 230 */ {__glXDisp_WindowPos3fvMESA, __glXDispSwap_WindowPos3fvMESA}, - /* [ 231] = 231 */ {__glXDisp_BeginQueryARB, __glXDispSwap_BeginQueryARB}, - /* [ 232] = 232 */ {__glXDisp_EndQueryARB, __glXDispSwap_EndQueryARB}, - /* [ 233] = 233 */ {__glXDisp_DrawBuffersARB, __glXDispSwap_DrawBuffersARB}, - /* [ 234] = 234 */ {NULL, NULL}, - /* [ 235] = 235 */ {NULL, NULL}, - /* [ 236] = 236 */ {NULL, NULL}, - /* [ 237] = 237 */ {NULL, NULL}, - /* [ 238] = 238 */ {NULL, NULL}, - /* [ 239] = 239 */ {NULL, NULL}, - /* [ 240] = 2048 */ {__glXDisp_SampleMaskSGIS, __glXDispSwap_SampleMaskSGIS}, - /* [ 241] = 2049 */ {__glXDisp_SamplePatternSGIS, __glXDispSwap_SamplePatternSGIS}, - /* [ 242] = 2050 */ {NULL, NULL}, - /* [ 243] = 2051 */ {NULL, NULL}, - /* [ 244] = 2052 */ {NULL, NULL}, - /* [ 245] = 2053 */ {__glXDisp_ColorTable, __glXDispSwap_ColorTable}, - /* [ 246] = 2054 */ {__glXDisp_ColorTableParameterfv, __glXDispSwap_ColorTableParameterfv}, - /* [ 247] = 2055 */ {__glXDisp_ColorTableParameteriv, __glXDispSwap_ColorTableParameteriv}, - /* [ 248] = 2056 */ {__glXDisp_CopyColorTable, __glXDispSwap_CopyColorTable}, - /* [ 249] = 2057 */ {NULL, NULL}, - /* [ 250] = 2058 */ {NULL, NULL}, - /* [ 251] = 2059 */ {NULL, NULL}, - /* [ 252] = 2060 */ {NULL, NULL}, - /* [ 253] = 2061 */ {NULL, NULL}, - /* [ 254] = 2062 */ {NULL, NULL}, - /* [ 255] = 2063 */ {NULL, NULL}, - /* [ 256] = 2064 */ {NULL, NULL}, - /* [ 257] = 2065 */ {__glXDisp_PointParameterfEXT, __glXDispSwap_PointParameterfEXT}, - /* [ 258] = 2066 */ {__glXDisp_PointParameterfvEXT, __glXDispSwap_PointParameterfvEXT}, - /* [ 259] = 2067 */ {NULL, NULL}, - /* [ 260] = 2068 */ {NULL, NULL}, - /* [ 261] = 2069 */ {NULL, NULL}, - /* [ 262] = 2070 */ {NULL, NULL}, - /* [ 263] = 2071 */ {NULL, NULL}, - /* [ 264] = 4096 */ {__glXDisp_BlendColor, __glXDispSwap_BlendColor}, - /* [ 265] = 4097 */ {__glXDisp_BlendEquation, __glXDispSwap_BlendEquation}, - /* [ 266] = 4098 */ {NULL, NULL}, - /* [ 267] = 4099 */ {__glXDisp_TexSubImage1D, __glXDispSwap_TexSubImage1D}, - /* [ 268] = 4100 */ {__glXDisp_TexSubImage2D, __glXDispSwap_TexSubImage2D}, - /* [ 269] = 4101 */ {__glXDisp_ConvolutionFilter1D, __glXDispSwap_ConvolutionFilter1D}, - /* [ 270] = 4102 */ {__glXDisp_ConvolutionFilter2D, __glXDispSwap_ConvolutionFilter2D}, - /* [ 271] = 4103 */ {__glXDisp_ConvolutionParameterf, __glXDispSwap_ConvolutionParameterf}, - /* [ 272] = 4104 */ {__glXDisp_ConvolutionParameterfv, __glXDispSwap_ConvolutionParameterfv}, - /* [ 273] = 4105 */ {__glXDisp_ConvolutionParameteri, __glXDispSwap_ConvolutionParameteri}, - /* [ 274] = 4106 */ {__glXDisp_ConvolutionParameteriv, __glXDispSwap_ConvolutionParameteriv}, - /* [ 275] = 4107 */ {__glXDisp_CopyConvolutionFilter1D, __glXDispSwap_CopyConvolutionFilter1D}, - /* [ 276] = 4108 */ {__glXDisp_CopyConvolutionFilter2D, __glXDispSwap_CopyConvolutionFilter2D}, - /* [ 277] = 4109 */ {__glXDisp_SeparableFilter2D, __glXDispSwap_SeparableFilter2D}, - /* [ 278] = 4110 */ {__glXDisp_Histogram, __glXDispSwap_Histogram}, - /* [ 279] = 4111 */ {__glXDisp_Minmax, __glXDispSwap_Minmax}, - /* [ 280] = 4112 */ {__glXDisp_ResetHistogram, __glXDispSwap_ResetHistogram}, - /* [ 281] = 4113 */ {__glXDisp_ResetMinmax, __glXDispSwap_ResetMinmax}, - /* [ 282] = 4114 */ {__glXDisp_TexImage3D, __glXDispSwap_TexImage3D}, - /* [ 283] = 4115 */ {__glXDisp_TexSubImage3D, __glXDispSwap_TexSubImage3D}, - /* [ 284] = 4116 */ {NULL, NULL}, - /* [ 285] = 4117 */ {__glXDisp_BindTexture, __glXDispSwap_BindTexture}, - /* [ 286] = 4118 */ {__glXDisp_PrioritizeTextures, __glXDispSwap_PrioritizeTextures}, - /* [ 287] = 4119 */ {__glXDisp_CopyTexImage1D, __glXDispSwap_CopyTexImage1D}, - /* [ 288] = 4120 */ {__glXDisp_CopyTexImage2D, __glXDispSwap_CopyTexImage2D}, - /* [ 289] = 4121 */ {__glXDisp_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage1D}, - /* [ 290] = 4122 */ {__glXDisp_CopyTexSubImage2D, __glXDispSwap_CopyTexSubImage2D}, - /* [ 291] = 4123 */ {__glXDisp_CopyTexSubImage3D, __glXDispSwap_CopyTexSubImage3D}, - /* [ 292] = 4124 */ {__glXDisp_FogCoordfvEXT, __glXDispSwap_FogCoordfvEXT}, - /* [ 293] = 4125 */ {__glXDisp_FogCoorddvEXT, __glXDispSwap_FogCoorddvEXT}, - /* [ 294] = 4126 */ {__glXDisp_SecondaryColor3bvEXT, __glXDispSwap_SecondaryColor3bvEXT}, - /* [ 295] = 4127 */ {__glXDisp_SecondaryColor3svEXT, __glXDispSwap_SecondaryColor3svEXT}, - /* [ 296] = 4176 */ {NULL, NULL}, - /* [ 297] = 4177 */ {NULL, NULL}, - /* [ 298] = 4178 */ {NULL, NULL}, - /* [ 299] = 4179 */ {NULL, NULL}, - /* [ 300] = 4180 */ {__glXDisp_BindProgramNV, __glXDispSwap_BindProgramNV}, - /* [ 301] = 4181 */ {__glXDisp_ExecuteProgramNV, __glXDispSwap_ExecuteProgramNV}, - /* [ 302] = 4182 */ {__glXDisp_RequestResidentProgramsNV, __glXDispSwap_RequestResidentProgramsNV}, - /* [ 303] = 4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV}, - /* [ 304] = 4184 */ {__glXDisp_ProgramEnvParameter4fvARB, __glXDispSwap_ProgramEnvParameter4fvARB}, - /* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB}, - /* [ 306] = 4186 */ {__glXDisp_ProgramParameters4fvNV, __glXDispSwap_ProgramParameters4fvNV}, - /* [ 307] = 4187 */ {__glXDisp_ProgramParameters4dvNV, __glXDispSwap_ProgramParameters4dvNV}, - /* [ 308] = 4188 */ {__glXDisp_TrackMatrixNV, __glXDispSwap_TrackMatrixNV}, - /* [ 309] = 4189 */ {__glXDisp_VertexAttrib1svARB, __glXDispSwap_VertexAttrib1svARB}, - /* [ 310] = 4190 */ {__glXDisp_VertexAttrib2svARB, __glXDispSwap_VertexAttrib2svARB}, - /* [ 311] = 4191 */ {__glXDisp_VertexAttrib3svARB, __glXDispSwap_VertexAttrib3svARB}, - /* [ 312] = 4192 */ {__glXDisp_VertexAttrib4svARB, __glXDispSwap_VertexAttrib4svARB}, - /* [ 313] = 4193 */ {__glXDisp_VertexAttrib1fvARB, __glXDispSwap_VertexAttrib1fvARB}, - /* [ 314] = 4194 */ {__glXDisp_VertexAttrib2fvARB, __glXDispSwap_VertexAttrib2fvARB}, - /* [ 315] = 4195 */ {__glXDisp_VertexAttrib3fvARB, __glXDispSwap_VertexAttrib3fvARB}, - /* [ 316] = 4196 */ {__glXDisp_VertexAttrib4fvARB, __glXDispSwap_VertexAttrib4fvARB}, - /* [ 317] = 4197 */ {__glXDisp_VertexAttrib1dvARB, __glXDispSwap_VertexAttrib1dvARB}, - /* [ 318] = 4198 */ {__glXDisp_VertexAttrib2dvARB, __glXDispSwap_VertexAttrib2dvARB}, - /* [ 319] = 4199 */ {__glXDisp_VertexAttrib3dvARB, __glXDispSwap_VertexAttrib3dvARB}, - /* [ 320] = 4200 */ {__glXDisp_VertexAttrib4dvARB, __glXDispSwap_VertexAttrib4dvARB}, - /* [ 321] = 4201 */ {__glXDisp_VertexAttrib4NubvARB, __glXDispSwap_VertexAttrib4NubvARB}, - /* [ 322] = 4202 */ {__glXDisp_VertexAttribs1svNV, __glXDispSwap_VertexAttribs1svNV}, - /* [ 323] = 4203 */ {__glXDisp_VertexAttribs2svNV, __glXDispSwap_VertexAttribs2svNV}, - /* [ 324] = 4204 */ {__glXDisp_VertexAttribs3svNV, __glXDispSwap_VertexAttribs3svNV}, - /* [ 325] = 4205 */ {__glXDisp_VertexAttribs4svNV, __glXDispSwap_VertexAttribs4svNV}, - /* [ 326] = 4206 */ {__glXDisp_VertexAttribs1fvNV, __glXDispSwap_VertexAttribs1fvNV}, - /* [ 327] = 4207 */ {__glXDisp_VertexAttribs2fvNV, __glXDispSwap_VertexAttribs2fvNV}, - /* [ 328] = 4208 */ {__glXDisp_VertexAttribs3fvNV, __glXDispSwap_VertexAttribs3fvNV}, - /* [ 329] = 4209 */ {__glXDisp_VertexAttribs4fvNV, __glXDispSwap_VertexAttribs4fvNV}, - /* [ 330] = 4210 */ {__glXDisp_VertexAttribs1dvNV, __glXDispSwap_VertexAttribs1dvNV}, - /* [ 331] = 4211 */ {__glXDisp_VertexAttribs2dvNV, __glXDispSwap_VertexAttribs2dvNV}, - /* [ 332] = 4212 */ {__glXDisp_VertexAttribs3dvNV, __glXDispSwap_VertexAttribs3dvNV}, - /* [ 333] = 4213 */ {__glXDisp_VertexAttribs4dvNV, __glXDispSwap_VertexAttribs4dvNV}, - /* [ 334] = 4214 */ {__glXDisp_VertexAttribs4ubvNV, __glXDispSwap_VertexAttribs4ubvNV}, - /* [ 335] = 4215 */ {__glXDisp_ProgramLocalParameter4fvARB, __glXDispSwap_ProgramLocalParameter4fvARB}, - /* [ 336] = 4216 */ {__glXDisp_ProgramLocalParameter4dvARB, __glXDispSwap_ProgramLocalParameter4dvARB}, - /* [ 337] = 4217 */ {__glXDisp_ProgramStringARB, __glXDispSwap_ProgramStringARB}, - /* [ 338] = 4218 */ {__glXDisp_ProgramNamedParameter4fvNV, __glXDispSwap_ProgramNamedParameter4fvNV}, - /* [ 339] = 4219 */ {__glXDisp_ProgramNamedParameter4dvNV, __glXDispSwap_ProgramNamedParameter4dvNV}, - /* [ 340] = 4220 */ {__glXDisp_ActiveStencilFaceEXT, __glXDispSwap_ActiveStencilFaceEXT}, - /* [ 341] = 4221 */ {__glXDisp_PointParameteriNV, __glXDispSwap_PointParameteriNV}, - /* [ 342] = 4222 */ {__glXDisp_PointParameterivNV, __glXDispSwap_PointParameterivNV}, - /* [ 343] = 4223 */ {NULL, NULL}, - /* [ 344] = 4224 */ {NULL, NULL}, - /* [ 345] = 4225 */ {NULL, NULL}, - /* [ 346] = 4226 */ {NULL, NULL}, - /* [ 347] = 4227 */ {NULL, NULL}, - /* [ 348] = 4228 */ {__glXDisp_BlendEquationSeparateEXT, __glXDispSwap_BlendEquationSeparateEXT}, - /* [ 349] = 4229 */ {NULL, NULL}, - /* [ 350] = 4230 */ {__glXDisp_VertexAttrib4bvARB, __glXDispSwap_VertexAttrib4bvARB}, - /* [ 351] = 4231 */ {__glXDisp_VertexAttrib4ivARB, __glXDispSwap_VertexAttrib4ivARB}, - /* [ 352] = 4232 */ {__glXDisp_VertexAttrib4ubvARB, __glXDispSwap_VertexAttrib4ubvARB}, - /* [ 353] = 4233 */ {__glXDisp_VertexAttrib4usvARB, __glXDispSwap_VertexAttrib4usvARB}, - /* [ 354] = 4234 */ {__glXDisp_VertexAttrib4uivARB, __glXDispSwap_VertexAttrib4uivARB}, - /* [ 355] = 4235 */ {__glXDisp_VertexAttrib4NbvARB, __glXDispSwap_VertexAttrib4NbvARB}, - /* [ 356] = 4236 */ {__glXDisp_VertexAttrib4NsvARB, __glXDispSwap_VertexAttrib4NsvARB}, - /* [ 357] = 4237 */ {__glXDisp_VertexAttrib4NivARB, __glXDispSwap_VertexAttrib4NivARB}, - /* [ 358] = 4238 */ {__glXDisp_VertexAttrib4NusvARB, __glXDispSwap_VertexAttrib4NusvARB}, - /* [ 359] = 4239 */ {__glXDisp_VertexAttrib4NuivARB, __glXDispSwap_VertexAttrib4NuivARB}, - /* [ 360] = 4128 */ {__glXDisp_SecondaryColor3ivEXT, __glXDispSwap_SecondaryColor3ivEXT}, - /* [ 361] = 4129 */ {__glXDisp_SecondaryColor3fvEXT, __glXDispSwap_SecondaryColor3fvEXT}, - /* [ 362] = 4130 */ {__glXDisp_SecondaryColor3dvEXT, __glXDispSwap_SecondaryColor3dvEXT}, - /* [ 363] = 4131 */ {__glXDisp_SecondaryColor3ubvEXT, __glXDispSwap_SecondaryColor3ubvEXT}, - /* [ 364] = 4132 */ {__glXDisp_SecondaryColor3usvEXT, __glXDispSwap_SecondaryColor3usvEXT}, - /* [ 365] = 4133 */ {__glXDisp_SecondaryColor3uivEXT, __glXDispSwap_SecondaryColor3uivEXT}, - /* [ 366] = 4134 */ {__glXDisp_BlendFuncSeparateEXT, __glXDispSwap_BlendFuncSeparateEXT}, - /* [ 367] = 4135 */ {NULL, NULL}, - /* [ 368] = 4264 */ {NULL, NULL}, - /* [ 369] = 4265 */ {__glXDisp_VertexAttrib1svNV, __glXDispSwap_VertexAttrib1svNV}, - /* [ 370] = 4266 */ {__glXDisp_VertexAttrib2svNV, __glXDispSwap_VertexAttrib2svNV}, - /* [ 371] = 4267 */ {__glXDisp_VertexAttrib3svNV, __glXDispSwap_VertexAttrib3svNV}, - /* [ 372] = 4268 */ {__glXDisp_VertexAttrib4svNV, __glXDispSwap_VertexAttrib4svNV}, - /* [ 373] = 4269 */ {__glXDisp_VertexAttrib1fvNV, __glXDispSwap_VertexAttrib1fvNV}, - /* [ 374] = 4270 */ {__glXDisp_VertexAttrib2fvNV, __glXDispSwap_VertexAttrib2fvNV}, - /* [ 375] = 4271 */ {__glXDisp_VertexAttrib3fvNV, __glXDispSwap_VertexAttrib3fvNV}, - /* [ 376] = 4272 */ {__glXDisp_VertexAttrib4fvNV, __glXDispSwap_VertexAttrib4fvNV}, - /* [ 377] = 4273 */ {__glXDisp_VertexAttrib1dvNV, __glXDispSwap_VertexAttrib1dvNV}, - /* [ 378] = 4274 */ {__glXDisp_VertexAttrib2dvNV, __glXDispSwap_VertexAttrib2dvNV}, - /* [ 379] = 4275 */ {__glXDisp_VertexAttrib3dvNV, __glXDispSwap_VertexAttrib3dvNV}, - /* [ 380] = 4276 */ {__glXDisp_VertexAttrib4dvNV, __glXDispSwap_VertexAttrib4dvNV}, - /* [ 381] = 4277 */ {__glXDisp_VertexAttrib4ubvNV, __glXDispSwap_VertexAttrib4ubvNV}, - /* [ 382] = 4278 */ {NULL, NULL}, - /* [ 383] = 4279 */ {NULL, NULL}, - /* [ 384] = 4312 */ {NULL, NULL}, - /* [ 385] = 4313 */ {NULL, NULL}, - /* [ 386] = 4314 */ {NULL, NULL}, - /* [ 387] = 4315 */ {NULL, NULL}, - /* [ 388] = 4316 */ {__glXDisp_BindRenderbufferEXT, __glXDispSwap_BindRenderbufferEXT}, - /* [ 389] = 4317 */ {__glXDisp_DeleteRenderbuffersEXT, __glXDispSwap_DeleteRenderbuffersEXT}, - /* [ 390] = 4318 */ {__glXDisp_RenderbufferStorageEXT, __glXDispSwap_RenderbufferStorageEXT}, - /* [ 391] = 4319 */ {__glXDisp_BindFramebufferEXT, __glXDispSwap_BindFramebufferEXT}, - /* [ 392] = 4320 */ {__glXDisp_DeleteFramebuffersEXT, __glXDispSwap_DeleteFramebuffersEXT}, - /* [ 393] = 4321 */ {__glXDisp_FramebufferTexture1DEXT, __glXDispSwap_FramebufferTexture1DEXT}, - /* [ 394] = 4322 */ {__glXDisp_FramebufferTexture2DEXT, __glXDispSwap_FramebufferTexture2DEXT}, - /* [ 395] = 4323 */ {__glXDisp_FramebufferTexture3DEXT, __glXDispSwap_FramebufferTexture3DEXT}, - /* [ 396] = 4324 */ {__glXDisp_FramebufferRenderbufferEXT, __glXDispSwap_FramebufferRenderbufferEXT}, - /* [ 397] = 4325 */ {__glXDisp_GenerateMipmapEXT, __glXDispSwap_GenerateMipmapEXT}, - /* [ 398] = 4326 */ {NULL, NULL}, - /* [ 399] = 4327 */ {NULL, NULL}, -}; - -static const int_fast16_t Render_size_table[400][2] = { - /* [ 0] = 0 */ { 0, ~0}, - /* [ 1] = 1 */ { 8, ~0}, - /* [ 2] = 2 */ { 12, 0}, - /* [ 3] = 3 */ { 8, ~0}, - /* [ 4] = 4 */ { 8, ~0}, - /* [ 5] = 5 */ { 48, 1}, - /* [ 6] = 6 */ { 8, ~0}, - /* [ 7] = 7 */ { 28, ~0}, - /* [ 8] = 8 */ { 16, ~0}, - /* [ 9] = 9 */ { 16, ~0}, - /* [ 10] = 10 */ { 12, ~0}, - /* [ 11] = 11 */ { 8, ~0}, - /* [ 12] = 12 */ { 16, ~0}, - /* [ 13] = 13 */ { 12, ~0}, - /* [ 14] = 14 */ { 8, ~0}, - /* [ 15] = 15 */ { 36, ~0}, - /* [ 16] = 16 */ { 20, ~0}, - /* [ 17] = 17 */ { 20, ~0}, - /* [ 18] = 18 */ { 12, ~0}, - /* [ 19] = 19 */ { 8, ~0}, - /* [ 20] = 20 */ { 20, ~0}, - /* [ 21] = 21 */ { 12, ~0}, - /* [ 22] = 22 */ { 8, ~0}, - /* [ 23] = 23 */ { 4, ~0}, - /* [ 24] = 24 */ { 12, ~0}, - /* [ 25] = 25 */ { 8, ~0}, - /* [ 26] = 26 */ { 8, ~0}, - /* [ 27] = 27 */ { 8, ~0}, - /* [ 28] = 28 */ { 8, ~0}, - /* [ 29] = 29 */ { 28, ~0}, - /* [ 30] = 30 */ { 16, ~0}, - /* [ 31] = 31 */ { 16, ~0}, - /* [ 32] = 32 */ { 12, ~0}, - /* [ 33] = 33 */ { 20, ~0}, - /* [ 34] = 34 */ { 12, ~0}, - /* [ 35] = 35 */ { 12, ~0}, - /* [ 36] = 36 */ { 8, ~0}, - /* [ 37] = 37 */ { 28, ~0}, - /* [ 38] = 38 */ { 16, ~0}, - /* [ 39] = 39 */ { 16, ~0}, - /* [ 40] = 40 */ { 12, ~0}, - /* [ 41] = 41 */ { 36, ~0}, - /* [ 42] = 42 */ { 20, ~0}, - /* [ 43] = 43 */ { 20, ~0}, - /* [ 44] = 44 */ { 12, ~0}, - /* [ 45] = 45 */ { 36, ~0}, - /* [ 46] = 46 */ { 20, ~0}, - /* [ 47] = 47 */ { 20, ~0}, - /* [ 48] = 48 */ { 12, ~0}, - /* [ 49] = 49 */ { 12, ~0}, - /* [ 50] = 50 */ { 8, ~0}, - /* [ 51] = 51 */ { 8, ~0}, - /* [ 52] = 52 */ { 8, ~0}, - /* [ 53] = 53 */ { 20, ~0}, - /* [ 54] = 54 */ { 12, ~0}, - /* [ 55] = 55 */ { 12, ~0}, - /* [ 56] = 56 */ { 8, ~0}, - /* [ 57] = 57 */ { 28, ~0}, - /* [ 58] = 58 */ { 16, ~0}, - /* [ 59] = 59 */ { 16, ~0}, - /* [ 60] = 60 */ { 12, ~0}, - /* [ 61] = 61 */ { 36, ~0}, - /* [ 62] = 62 */ { 20, ~0}, - /* [ 63] = 63 */ { 20, ~0}, - /* [ 64] = 64 */ { 12, ~0}, - /* [ 65] = 65 */ { 20, ~0}, - /* [ 66] = 66 */ { 12, ~0}, - /* [ 67] = 67 */ { 12, ~0}, - /* [ 68] = 68 */ { 8, ~0}, - /* [ 69] = 69 */ { 28, ~0}, - /* [ 70] = 70 */ { 16, ~0}, - /* [ 71] = 71 */ { 16, ~0}, - /* [ 72] = 72 */ { 12, ~0}, - /* [ 73] = 73 */ { 36, ~0}, - /* [ 74] = 74 */ { 20, ~0}, - /* [ 75] = 75 */ { 20, ~0}, - /* [ 76] = 76 */ { 12, ~0}, - /* [ 77] = 77 */ { 40, ~0}, - /* [ 78] = 78 */ { 12, ~0}, - /* [ 79] = 79 */ { 8, ~0}, - /* [ 80] = 80 */ { 12, ~0}, - /* [ 81] = 81 */ { 8, 2}, - /* [ 82] = 82 */ { 12, ~0}, - /* [ 83] = 83 */ { 8, 3}, - /* [ 84] = 84 */ { 8, ~0}, - /* [ 85] = 85 */ { 12, ~0}, - /* [ 86] = 86 */ { 16, ~0}, - /* [ 87] = 87 */ { 12, 4}, - /* [ 88] = 88 */ { 16, ~0}, - /* [ 89] = 89 */ { 12, 5}, - /* [ 90] = 90 */ { 12, ~0}, - /* [ 91] = 91 */ { 8, 6}, - /* [ 92] = 92 */ { 12, ~0}, - /* [ 93] = 93 */ { 8, 7}, - /* [ 94] = 94 */ { 12, ~0}, - /* [ 95] = 95 */ { 8, ~0}, - /* [ 96] = 96 */ { 16, ~0}, - /* [ 97] = 97 */ { 12, 8}, - /* [ 98] = 98 */ { 16, ~0}, - /* [ 99] = 99 */ { 12, 9}, - /* [100] = 100 */ { 8, ~0}, - /* [101] = 101 */ { 12, ~0}, - /* [102] = 102 */ { 24, 10}, - /* [103] = 103 */ { 20, ~0}, - /* [104] = 104 */ { 8, ~0}, - /* [105] = 105 */ { 16, ~0}, - /* [106] = 106 */ { 12, 11}, - /* [107] = 107 */ { 16, ~0}, - /* [108] = 108 */ { 12, 12}, - /* [109] = 109 */ { 56, 13}, - /* [110] = 110 */ { 56, 14}, - /* [111] = 111 */ { 16, ~0}, - /* [112] = 112 */ { 12, 15}, - /* [113] = 113 */ { 16, ~0}, - /* [114] = 114 */ { 12, 16}, - /* [115] = 115 */ { 20, ~0}, - /* [116] = 116 */ { 12, 17}, - /* [117] = 117 */ { 16, ~0}, - /* [118] = 118 */ { 12, 18}, - /* [119] = 119 */ { 16, ~0}, - /* [120] = 120 */ { 12, 19}, - /* [121] = 121 */ { 4, ~0}, - /* [122] = 122 */ { 8, ~0}, - /* [123] = 123 */ { 8, ~0}, - /* [124] = 124 */ { 4, ~0}, - /* [125] = 125 */ { 8, ~0}, - /* [126] = 126 */ { 8, ~0}, - /* [127] = 127 */ { 8, ~0}, - /* [128] = 128 */ { 20, ~0}, - /* [129] = 129 */ { 8, ~0}, - /* [130] = 130 */ { 20, ~0}, - /* [131] = 131 */ { 8, ~0}, - /* [132] = 132 */ { 12, ~0}, - /* [133] = 133 */ { 8, ~0}, - /* [134] = 134 */ { 8, ~0}, - /* [135] = 135 */ { 8, ~0}, - /* [136] = 136 */ { 8, ~0}, - /* [137] = 137 */ { 12, ~0}, - /* [138] = 138 */ { 8, ~0}, - /* [139] = 139 */ { 8, ~0}, - /* [140] = 140 */ { 0, ~0}, - /* [141] = 141 */ { 4, ~0}, - /* [142] = 142 */ { 8, ~0}, - /* [143] = 143 */ { 28, 20}, - /* [144] = 144 */ { 20, 21}, - /* [145] = 145 */ { 48, 22}, - /* [146] = 146 */ { 32, 23}, - /* [147] = 147 */ { 24, ~0}, - /* [148] = 148 */ { 16, ~0}, - /* [149] = 149 */ { 44, ~0}, - /* [150] = 150 */ { 28, ~0}, - /* [151] = 151 */ { 12, ~0}, - /* [152] = 152 */ { 8, ~0}, - /* [153] = 153 */ { 20, ~0}, - /* [154] = 154 */ { 12, ~0}, - /* [155] = 155 */ { 16, ~0}, - /* [156] = 156 */ { 8, ~0}, - /* [157] = 157 */ { 24, ~0}, - /* [158] = 158 */ { 12, ~0}, - /* [159] = 159 */ { 12, ~0}, - /* [160] = 160 */ { 12, ~0}, - /* [161] = 161 */ { 8, ~0}, - /* [162] = 162 */ { 16, ~0}, - /* [163] = 163 */ { 16, ~0}, - /* [164] = 164 */ { 8, ~0}, - /* [165] = 165 */ { 12, ~0}, - /* [166] = 166 */ { 12, ~0}, - /* [167] = 167 */ { 12, ~0}, - /* [168] = 168 */ { 12, 24}, - /* [169] = 169 */ { 12, 25}, - /* [170] = 170 */ { 12, 26}, - /* [171] = 171 */ { 8, ~0}, - /* [172] = 172 */ { 24, ~0}, - /* [173] = 173 */ { 40, 27}, - /* [174] = 174 */ { 20, ~0}, - /* [175] = 175 */ { 52, ~0}, - /* [176] = 176 */ { 4, ~0}, - /* [177] = 177 */ { 68, ~0}, - /* [178] = 178 */ {132, ~0}, - /* [179] = 179 */ { 8, ~0}, - /* [180] = 180 */ { 68, ~0}, - /* [181] = 181 */ {132, ~0}, - /* [182] = 182 */ { 52, ~0}, - /* [183] = 183 */ { 4, ~0}, - /* [184] = 184 */ { 4, ~0}, - /* [185] = 185 */ { 36, ~0}, - /* [186] = 186 */ { 20, ~0}, - /* [187] = 187 */ { 28, ~0}, - /* [188] = 188 */ { 16, ~0}, - /* [189] = 189 */ { 28, ~0}, - /* [190] = 190 */ { 16, ~0}, - /* [191] = 191 */ { 20, ~0}, - /* [192] = 192 */ { 12, ~0}, - /* [193] = 193 */ { 16, 28}, - /* [194] = 194 */ { 8, ~0}, - /* [195] = 195 */ { 44, 29}, - /* [196] = 196 */ { 24, ~0}, - /* [197] = 197 */ { 8, ~0}, - /* [198] = 198 */ { 16, ~0}, - /* [199] = 199 */ { 12, ~0}, - /* [200] = 200 */ { 12, ~0}, - /* [201] = 201 */ { 12, ~0}, - /* [202] = 202 */ { 24, ~0}, - /* [203] = 203 */ { 16, ~0}, - /* [204] = 204 */ { 16, ~0}, - /* [205] = 205 */ { 12, ~0}, - /* [206] = 206 */ { 32, ~0}, - /* [207] = 207 */ { 20, ~0}, - /* [208] = 208 */ { 20, ~0}, - /* [209] = 209 */ { 16, ~0}, - /* [210] = 210 */ { 40, ~0}, - /* [211] = 211 */ { 24, ~0}, - /* [212] = 212 */ { 24, ~0}, - /* [213] = 213 */ { 16, ~0}, - /* [214] = 214 */ { 28, 30}, - /* [215] = 215 */ { 32, 31}, - /* [216] = 216 */ { 36, 32}, - /* [217] = 217 */ { 28, 33}, - /* [218] = 218 */ { 36, 34}, - /* [219] = 219 */ { 44, 35}, - /* [220] = 220 */ { 0, ~0}, - /* [221] = 221 */ { 0, ~0}, - /* [222] = 222 */ { 0, ~0}, - /* [223] = 223 */ { 0, ~0}, - /* [224] = 224 */ { 0, ~0}, - /* [225] = 225 */ { 0, ~0}, - /* [226] = 226 */ { 0, ~0}, - /* [227] = 227 */ { 0, ~0}, - /* [228] = 228 */ { 0, ~0}, - /* [229] = 229 */ { 12, ~0}, - /* [230] = 230 */ { 16, ~0}, - /* [231] = 231 */ { 12, ~0}, - /* [232] = 232 */ { 8, ~0}, - /* [233] = 233 */ { 8, 36}, - /* [234] = 234 */ { 0, ~0}, - /* [235] = 235 */ { 0, ~0}, - /* [236] = 236 */ { 0, ~0}, - /* [237] = 237 */ { 0, ~0}, - /* [238] = 238 */ { 0, ~0}, - /* [239] = 239 */ { 0, ~0}, - /* [240] = 2048 */ { 12, ~0}, - /* [241] = 2049 */ { 8, ~0}, - /* [242] = 2050 */ { 0, ~0}, - /* [243] = 2051 */ { 0, ~0}, - /* [244] = 2052 */ { 0, ~0}, - /* [245] = 2053 */ { 44, 37}, - /* [246] = 2054 */ { 12, 38}, - /* [247] = 2055 */ { 12, 39}, - /* [248] = 2056 */ { 24, ~0}, - /* [249] = 2057 */ { 0, ~0}, - /* [250] = 2058 */ { 0, ~0}, - /* [251] = 2059 */ { 0, ~0}, - /* [252] = 2060 */ { 0, ~0}, - /* [253] = 2061 */ { 0, ~0}, - /* [254] = 2062 */ { 0, ~0}, - /* [255] = 2063 */ { 0, ~0}, - /* [256] = 2064 */ { 0, ~0}, - /* [257] = 2065 */ { 12, ~0}, - /* [258] = 2066 */ { 8, 40}, - /* [259] = 2067 */ { 0, ~0}, - /* [260] = 2068 */ { 0, ~0}, - /* [261] = 2069 */ { 0, ~0}, - /* [262] = 2070 */ { 0, ~0}, - /* [263] = 2071 */ { 0, ~0}, - /* [264] = 4096 */ { 20, ~0}, - /* [265] = 4097 */ { 8, ~0}, - /* [266] = 4098 */ { 0, ~0}, - /* [267] = 4099 */ { 60, 41}, - /* [268] = 4100 */ { 60, 42}, - /* [269] = 4101 */ { 48, 43}, - /* [270] = 4102 */ { 48, 44}, - /* [271] = 4103 */ { 16, ~0}, - /* [272] = 4104 */ { 12, 45}, - /* [273] = 4105 */ { 16, ~0}, - /* [274] = 4106 */ { 12, 46}, - /* [275] = 4107 */ { 24, ~0}, - /* [276] = 4108 */ { 28, ~0}, - /* [277] = 4109 */ { 32, 47}, - /* [278] = 4110 */ { 20, ~0}, - /* [279] = 4111 */ { 16, ~0}, - /* [280] = 4112 */ { 8, ~0}, - /* [281] = 4113 */ { 8, ~0}, - /* [282] = 4114 */ { 84, 48}, - /* [283] = 4115 */ { 92, 49}, - /* [284] = 4116 */ { 0, ~0}, - /* [285] = 4117 */ { 12, ~0}, - /* [286] = 4118 */ { 8, 50}, - /* [287] = 4119 */ { 32, ~0}, - /* [288] = 4120 */ { 36, ~0}, - /* [289] = 4121 */ { 28, ~0}, - /* [290] = 4122 */ { 36, ~0}, - /* [291] = 4123 */ { 40, ~0}, - /* [292] = 4124 */ { 8, ~0}, - /* [293] = 4125 */ { 12, ~0}, - /* [294] = 4126 */ { 8, ~0}, - /* [295] = 4127 */ { 12, ~0}, - /* [296] = 4176 */ { 0, ~0}, - /* [297] = 4177 */ { 0, ~0}, - /* [298] = 4178 */ { 0, ~0}, - /* [299] = 4179 */ { 0, ~0}, - /* [300] = 4180 */ { 12, ~0}, - /* [301] = 4181 */ { 28, ~0}, - /* [302] = 4182 */ { 8, 51}, - /* [303] = 4183 */ { 16, 52}, - /* [304] = 4184 */ { 28, ~0}, - /* [305] = 4185 */ { 44, ~0}, - /* [306] = 4186 */ { 16, 53}, - /* [307] = 4187 */ { 16, 54}, - /* [308] = 4188 */ { 20, ~0}, - /* [309] = 4189 */ { 12, ~0}, - /* [310] = 4190 */ { 12, ~0}, - /* [311] = 4191 */ { 16, ~0}, - /* [312] = 4192 */ { 16, ~0}, - /* [313] = 4193 */ { 12, ~0}, - /* [314] = 4194 */ { 16, ~0}, - /* [315] = 4195 */ { 20, ~0}, - /* [316] = 4196 */ { 24, ~0}, - /* [317] = 4197 */ { 16, ~0}, - /* [318] = 4198 */ { 24, ~0}, - /* [319] = 4199 */ { 32, ~0}, - /* [320] = 4200 */ { 40, ~0}, - /* [321] = 4201 */ { 12, ~0}, - /* [322] = 4202 */ { 12, 55}, - /* [323] = 4203 */ { 12, 56}, - /* [324] = 4204 */ { 12, 57}, - /* [325] = 4205 */ { 12, 58}, - /* [326] = 4206 */ { 12, 59}, - /* [327] = 4207 */ { 12, 60}, - /* [328] = 4208 */ { 12, 61}, - /* [329] = 4209 */ { 12, 62}, - /* [330] = 4210 */ { 12, 63}, - /* [331] = 4211 */ { 12, 64}, - /* [332] = 4212 */ { 12, 65}, - /* [333] = 4213 */ { 12, 66}, - /* [334] = 4214 */ { 12, 67}, - /* [335] = 4215 */ { 28, ~0}, - /* [336] = 4216 */ { 44, ~0}, - /* [337] = 4217 */ { 16, 68}, - /* [338] = 4218 */ { 28, 69}, - /* [339] = 4219 */ { 44, 70}, - /* [340] = 4220 */ { 8, ~0}, - /* [341] = 4221 */ { 12, ~0}, - /* [342] = 4222 */ { 8, 71}, - /* [343] = 4223 */ { 0, ~0}, - /* [344] = 4224 */ { 0, ~0}, - /* [345] = 4225 */ { 0, ~0}, - /* [346] = 4226 */ { 0, ~0}, - /* [347] = 4227 */ { 0, ~0}, - /* [348] = 4228 */ { 12, ~0}, - /* [349] = 4229 */ { 0, ~0}, - /* [350] = 4230 */ { 12, ~0}, - /* [351] = 4231 */ { 24, ~0}, - /* [352] = 4232 */ { 12, ~0}, - /* [353] = 4233 */ { 16, ~0}, - /* [354] = 4234 */ { 24, ~0}, - /* [355] = 4235 */ { 12, ~0}, - /* [356] = 4236 */ { 16, ~0}, - /* [357] = 4237 */ { 24, ~0}, - /* [358] = 4238 */ { 16, ~0}, - /* [359] = 4239 */ { 24, ~0}, - /* [360] = 4128 */ { 16, ~0}, - /* [361] = 4129 */ { 16, ~0}, - /* [362] = 4130 */ { 28, ~0}, - /* [363] = 4131 */ { 8, ~0}, - /* [364] = 4132 */ { 12, ~0}, - /* [365] = 4133 */ { 16, ~0}, - /* [366] = 4134 */ { 20, ~0}, - /* [367] = 4135 */ { 0, ~0}, - /* [368] = 4264 */ { 0, ~0}, - /* [369] = 4265 */ { 12, ~0}, - /* [370] = 4266 */ { 12, ~0}, - /* [371] = 4267 */ { 16, ~0}, - /* [372] = 4268 */ { 16, ~0}, - /* [373] = 4269 */ { 12, ~0}, - /* [374] = 4270 */ { 16, ~0}, - /* [375] = 4271 */ { 20, ~0}, - /* [376] = 4272 */ { 24, ~0}, - /* [377] = 4273 */ { 16, ~0}, - /* [378] = 4274 */ { 24, ~0}, - /* [379] = 4275 */ { 32, ~0}, - /* [380] = 4276 */ { 40, ~0}, - /* [381] = 4277 */ { 12, ~0}, - /* [382] = 4278 */ { 0, ~0}, - /* [383] = 4279 */ { 0, ~0}, - /* [384] = 4312 */ { 0, ~0}, - /* [385] = 4313 */ { 0, ~0}, - /* [386] = 4314 */ { 0, ~0}, - /* [387] = 4315 */ { 0, ~0}, - /* [388] = 4316 */ { 12, ~0}, - /* [389] = 4317 */ { 8, 72}, - /* [390] = 4318 */ { 20, ~0}, - /* [391] = 4319 */ { 12, ~0}, - /* [392] = 4320 */ { 8, 73}, - /* [393] = 4321 */ { 24, ~0}, - /* [394] = 4322 */ { 24, ~0}, - /* [395] = 4323 */ { 28, ~0}, - /* [396] = 4324 */ { 20, ~0}, - /* [397] = 4325 */ { 8, ~0}, - /* [398] = 4326 */ { 0, ~0}, - /* [399] = 4327 */ { 0, ~0}, -}; - -static const gl_proto_size_func Render_size_func_table[74] = { - __glXCallListsReqSize, - __glXBitmapReqSize, - __glXFogfvReqSize, - __glXFogivReqSize, - __glXLightfvReqSize, - __glXLightivReqSize, - __glXLightModelfvReqSize, - __glXLightModelivReqSize, - __glXMaterialfvReqSize, - __glXMaterialivReqSize, - __glXPolygonStippleReqSize, - __glXTexParameterfvReqSize, - __glXTexParameterivReqSize, - __glXTexImage1DReqSize, - __glXTexImage2DReqSize, - __glXTexEnvfvReqSize, - __glXTexEnvivReqSize, - __glXTexGendvReqSize, - __glXTexGenfvReqSize, - __glXTexGenivReqSize, - __glXMap1dReqSize, - __glXMap1fReqSize, - __glXMap2dReqSize, - __glXMap2fReqSize, - __glXPixelMapfvReqSize, - __glXPixelMapuivReqSize, - __glXPixelMapusvReqSize, - __glXDrawPixelsReqSize, - __glXDrawArraysReqSize, - __glXColorSubTableReqSize, - __glXCompressedTexImage1DARBReqSize, - __glXCompressedTexImage2DARBReqSize, - __glXCompressedTexImage3DARBReqSize, - __glXCompressedTexSubImage1DARBReqSize, - __glXCompressedTexSubImage2DARBReqSize, - __glXCompressedTexSubImage3DARBReqSize, - __glXDrawBuffersARBReqSize, - __glXColorTableReqSize, - __glXColorTableParameterfvReqSize, - __glXColorTableParameterivReqSize, - __glXPointParameterfvEXTReqSize, - __glXTexSubImage1DReqSize, - __glXTexSubImage2DReqSize, - __glXConvolutionFilter1DReqSize, - __glXConvolutionFilter2DReqSize, - __glXConvolutionParameterfvReqSize, - __glXConvolutionParameterivReqSize, - __glXSeparableFilter2DReqSize, - __glXTexImage3DReqSize, - __glXTexSubImage3DReqSize, - __glXPrioritizeTexturesReqSize, - __glXRequestResidentProgramsNVReqSize, - __glXLoadProgramNVReqSize, - __glXProgramParameters4fvNVReqSize, - __glXProgramParameters4dvNVReqSize, - __glXVertexAttribs1svNVReqSize, - __glXVertexAttribs2svNVReqSize, - __glXVertexAttribs3svNVReqSize, - __glXVertexAttribs4svNVReqSize, - __glXVertexAttribs1fvNVReqSize, - __glXVertexAttribs2fvNVReqSize, - __glXVertexAttribs3fvNVReqSize, - __glXVertexAttribs4fvNVReqSize, - __glXVertexAttribs1dvNVReqSize, - __glXVertexAttribs2dvNVReqSize, - __glXVertexAttribs3dvNVReqSize, - __glXVertexAttribs4dvNVReqSize, - __glXVertexAttribs4ubvNVReqSize, - __glXProgramStringARBReqSize, - __glXProgramNamedParameter4fvNVReqSize, - __glXProgramNamedParameter4dvNVReqSize, - __glXPointParameterivNVReqSize, - __glXDeleteRenderbuffersEXTReqSize, - __glXDeleteFramebuffersEXTReqSize, -}; - -const struct __glXDispatchInfo Render_dispatch_info = { - 13, - Render_dispatch_tree, - Render_function_table, - Render_size_table, - Render_size_func_table -}; - -/*****************************************************************/ -/* tree depth = 12 */ -static const int_fast16_t VendorPriv_dispatch_tree[152] = { - /* [0] -> opcode range [0, 131072], node depth 1 */ - 2, - 5, - EMPTY_LEAF, - 119, - EMPTY_LEAF, - - /* [5] -> opcode range [0, 32768], node depth 2 */ - 1, - 8, - EMPTY_LEAF, - - /* [8] -> opcode range [0, 16384], node depth 3 */ - 1, - 11, - EMPTY_LEAF, - - /* [11] -> opcode range [0, 8192], node depth 4 */ - 2, - 16, - EMPTY_LEAF, - 78, - EMPTY_LEAF, - - /* [16] -> opcode range [0, 2048], node depth 5 */ - 2, - 21, - EMPTY_LEAF, - 36, - EMPTY_LEAF, - - /* [21] -> opcode range [0, 512], node depth 6 */ - 1, - 24, - EMPTY_LEAF, - - /* [24] -> opcode range [0, 256], node depth 7 */ - 1, - 27, - EMPTY_LEAF, - - /* [27] -> opcode range [0, 128], node depth 8 */ - 1, - 30, - EMPTY_LEAF, - - /* [30] -> opcode range [0, 64], node depth 9 */ - 1, - 33, - EMPTY_LEAF, - - /* [33] -> opcode range [0, 32], node depth 10 */ - 1, - LEAF(0), - EMPTY_LEAF, - - /* [36] -> opcode range [1024, 1536], node depth 6 */ - 2, - 41, - EMPTY_LEAF, - 53, - 67, - - /* [41] -> opcode range [1024, 1152], node depth 7 */ - 1, - 44, - EMPTY_LEAF, - - /* [44] -> opcode range [1024, 1088], node depth 8 */ - 1, - 47, - EMPTY_LEAF, - - /* [47] -> opcode range [1024, 1056], node depth 9 */ - 1, - 50, - EMPTY_LEAF, - - /* [50] -> opcode range [1024, 1040], node depth 10 */ - 1, - LEAF(16), - EMPTY_LEAF, - - /* [53] -> opcode range [1280, 1408], node depth 7 */ - 1, - 56, - EMPTY_LEAF, - - /* [56] -> opcode range [1280, 1344], node depth 8 */ - 2, - 61, - LEAF(24), - EMPTY_LEAF, - 64, - - /* [61] -> opcode range [1280, 1296], node depth 9 */ - 1, - EMPTY_LEAF, - LEAF(40), - - /* [64] -> opcode range [1328, 1344], node depth 9 */ - 1, - LEAF(48), - EMPTY_LEAF, - - /* [67] -> opcode range [1408, 1536], node depth 7 */ - 1, - 70, - EMPTY_LEAF, - - /* [70] -> opcode range [1408, 1472], node depth 8 */ - 1, - 73, - EMPTY_LEAF, - - /* [73] -> opcode range [1408, 1440], node depth 9 */ - 2, - EMPTY_LEAF, - LEAF(56), - LEAF(64), - EMPTY_LEAF, - - /* [78] -> opcode range [4096, 6144], node depth 5 */ - 2, - 83, - EMPTY_LEAF, - 101, - EMPTY_LEAF, - - /* [83] -> opcode range [4096, 4608], node depth 6 */ - 1, - 86, - EMPTY_LEAF, - - /* [86] -> opcode range [4096, 4352], node depth 7 */ - 1, - 89, - EMPTY_LEAF, - - /* [89] -> opcode range [4096, 4224], node depth 8 */ - 1, - 92, - EMPTY_LEAF, - - /* [92] -> opcode range [4096, 4160], node depth 9 */ - 1, - 95, - EMPTY_LEAF, - - /* [95] -> opcode range [4096, 4128], node depth 10 */ - 1, - 98, - EMPTY_LEAF, - - /* [98] -> opcode range [4096, 4112], node depth 11 */ - 1, - LEAF(72), - EMPTY_LEAF, - - /* [101] -> opcode range [5120, 5632], node depth 6 */ - 1, - 104, - EMPTY_LEAF, - - /* [104] -> opcode range [5120, 5376], node depth 7 */ - 1, - 107, - EMPTY_LEAF, - - /* [107] -> opcode range [5120, 5248], node depth 8 */ - 1, - 110, - EMPTY_LEAF, - - /* [110] -> opcode range [5120, 5184], node depth 9 */ - 1, - EMPTY_LEAF, - 113, - - /* [113] -> opcode range [5152, 5184], node depth 10 */ - 1, - 116, - EMPTY_LEAF, - - /* [116] -> opcode range [5152, 5168], node depth 11 */ - 1, - LEAF(80), - EMPTY_LEAF, - - /* [119] -> opcode range [65536, 98304], node depth 2 */ - 1, - 122, - EMPTY_LEAF, - - /* [122] -> opcode range [65536, 81920], node depth 3 */ - 1, - 125, - EMPTY_LEAF, - - /* [125] -> opcode range [65536, 73728], node depth 4 */ - 1, - 128, - EMPTY_LEAF, - - /* [128] -> opcode range [65536, 69632], node depth 5 */ - 1, - 131, - EMPTY_LEAF, - - /* [131] -> opcode range [65536, 67584], node depth 6 */ - 1, - 134, - EMPTY_LEAF, - - /* [134] -> opcode range [65536, 66560], node depth 7 */ - 1, - 137, - EMPTY_LEAF, - - /* [137] -> opcode range [65536, 66048], node depth 8 */ - 1, - 140, - EMPTY_LEAF, - - /* [140] -> opcode range [65536, 65792], node depth 9 */ - 1, - 143, - EMPTY_LEAF, - - /* [143] -> opcode range [65536, 65664], node depth 10 */ - 1, - 146, - EMPTY_LEAF, - - /* [146] -> opcode range [65536, 65600], node depth 11 */ - 1, - 149, - EMPTY_LEAF, - - /* [149] -> opcode range [65536, 65568], node depth 12 */ - 1, - LEAF(88), - EMPTY_LEAF, - -}; - -static const void *VendorPriv_function_table[104][2] = { - /* [ 0] = 0 */ {NULL, NULL}, - /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT}, - /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT}, - /* [ 3] = 3 */ {__glXDisp_GetConvolutionParameterivEXT, __glXDispSwap_GetConvolutionParameterivEXT}, - /* [ 4] = 4 */ {__glXDisp_GetSeparableFilterEXT, __glXDispSwap_GetSeparableFilterEXT}, - /* [ 5] = 5 */ {__glXDisp_GetHistogramEXT, __glXDispSwap_GetHistogramEXT}, - /* [ 6] = 6 */ {__glXDisp_GetHistogramParameterfvEXT, __glXDispSwap_GetHistogramParameterfvEXT}, - /* [ 7] = 7 */ {__glXDisp_GetHistogramParameterivEXT, __glXDispSwap_GetHistogramParameterivEXT}, - /* [ 8] = 8 */ {__glXDisp_GetMinmaxEXT, __glXDispSwap_GetMinmaxEXT}, - /* [ 9] = 9 */ {__glXDisp_GetMinmaxParameterfvEXT, __glXDispSwap_GetMinmaxParameterfvEXT}, - /* [ 10] = 10 */ {__glXDisp_GetMinmaxParameterivEXT, __glXDispSwap_GetMinmaxParameterivEXT}, - /* [ 11] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT}, - /* [ 12] = 12 */ {__glXDisp_DeleteTexturesEXT, __glXDispSwap_DeleteTexturesEXT}, - /* [ 13] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT}, - /* [ 14] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT}, - /* [ 15] = 15 */ {NULL, NULL}, - /* [ 16] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT}, - /* [ 17] = 1025 */ {NULL, NULL}, - /* [ 18] = 1026 */ {NULL, NULL}, - /* [ 19] = 1027 */ {NULL, NULL}, - /* [ 20] = 1028 */ {NULL, NULL}, - /* [ 21] = 1029 */ {NULL, NULL}, - /* [ 22] = 1030 */ {NULL, NULL}, - /* [ 23] = 1031 */ {NULL, NULL}, - /* [ 24] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB}, - /* [ 25] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB}, - /* [ 26] = 1298 */ {__glXDisp_GetProgramivNV, __glXDispSwap_GetProgramivNV}, - /* [ 27] = 1299 */ {__glXDisp_GetProgramStringNV, __glXDispSwap_GetProgramStringNV}, - /* [ 28] = 1300 */ {__glXDisp_GetTrackMatrixivNV, __glXDispSwap_GetTrackMatrixivNV}, - /* [ 29] = 1301 */ {__glXDisp_GetVertexAttribdvARB, __glXDispSwap_GetVertexAttribdvARB}, - /* [ 30] = 1302 */ {__glXDisp_GetVertexAttribfvNV, __glXDispSwap_GetVertexAttribfvNV}, - /* [ 31] = 1303 */ {__glXDisp_GetVertexAttribivNV, __glXDispSwap_GetVertexAttribivNV}, - /* [ 32] = 1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV}, - /* [ 33] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB}, - /* [ 34] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB}, - /* [ 35] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB}, - /* [ 36] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB}, - /* [ 37] = 1309 */ {NULL, NULL}, - /* [ 38] = 1310 */ {__glXDisp_GetProgramNamedParameterfvNV, __glXDispSwap_GetProgramNamedParameterfvNV}, - /* [ 39] = 1311 */ {__glXDisp_GetProgramNamedParameterdvNV, __glXDispSwap_GetProgramNamedParameterdvNV}, - /* [ 40] = 1288 */ {NULL, NULL}, - /* [ 41] = 1289 */ {NULL, NULL}, - /* [ 42] = 1290 */ {NULL, NULL}, - /* [ 43] = 1291 */ {NULL, NULL}, - /* [ 44] = 1292 */ {NULL, NULL}, - /* [ 45] = 1293 */ {__glXDisp_AreProgramsResidentNV, __glXDispSwap_AreProgramsResidentNV}, - /* [ 46] = 1294 */ {__glXDisp_DeleteProgramsNV, __glXDispSwap_DeleteProgramsNV}, - /* [ 47] = 1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV}, - /* [ 48] = 1328 */ {NULL, NULL}, - /* [ 49] = 1329 */ {NULL, NULL}, - /* [ 50] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT}, - /* [ 51] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT}, - /* [ 52] = 1332 */ {NULL, NULL}, - /* [ 53] = 1333 */ {NULL, NULL}, - /* [ 54] = 1334 */ {NULL, NULL}, - /* [ 55] = 1335 */ {NULL, NULL}, - /* [ 56] = 1416 */ {NULL, NULL}, - /* [ 57] = 1417 */ {NULL, NULL}, - /* [ 58] = 1418 */ {NULL, NULL}, - /* [ 59] = 1419 */ {NULL, NULL}, - /* [ 60] = 1420 */ {NULL, NULL}, - /* [ 61] = 1421 */ {NULL, NULL}, - /* [ 62] = 1422 */ {__glXDisp_IsRenderbufferEXT, __glXDispSwap_IsRenderbufferEXT}, - /* [ 63] = 1423 */ {__glXDisp_GenRenderbuffersEXT, __glXDispSwap_GenRenderbuffersEXT}, - /* [ 64] = 1424 */ {__glXDisp_GetRenderbufferParameterivEXT, __glXDispSwap_GetRenderbufferParameterivEXT}, - /* [ 65] = 1425 */ {__glXDisp_IsFramebufferEXT, __glXDispSwap_IsFramebufferEXT}, - /* [ 66] = 1426 */ {__glXDisp_GenFramebuffersEXT, __glXDispSwap_GenFramebuffersEXT}, - /* [ 67] = 1427 */ {__glXDisp_CheckFramebufferStatusEXT, __glXDispSwap_CheckFramebufferStatusEXT}, - /* [ 68] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT, __glXDispSwap_GetFramebufferAttachmentParameterivEXT}, - /* [ 69] = 1429 */ {NULL, NULL}, - /* [ 70] = 1430 */ {NULL, NULL}, - /* [ 71] = 1431 */ {NULL, NULL}, - /* [ 72] = 4096 */ {NULL, NULL}, - /* [ 73] = 4097 */ {NULL, NULL}, - /* [ 74] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI}, - /* [ 75] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI}, - /* [ 76] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI}, - /* [ 77] = 4101 */ {NULL, NULL}, - /* [ 78] = 4102 */ {NULL, NULL}, - /* [ 79] = 4103 */ {NULL, NULL}, - /* [ 80] = 5152 */ {NULL, NULL}, - /* [ 81] = 5153 */ {NULL, NULL}, - /* [ 82] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA}, - /* [ 83] = 5155 */ {NULL, NULL}, - /* [ 84] = 5156 */ {NULL, NULL}, - /* [ 85] = 5157 */ {NULL, NULL}, - /* [ 86] = 5158 */ {NULL, NULL}, - /* [ 87] = 5159 */ {NULL, NULL}, - /* [ 88] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI}, - /* [ 89] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI}, - /* [ 90] = 65538 */ {NULL, NULL}, - /* [ 91] = 65539 */ {NULL, NULL}, - /* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX}, - /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX}, - /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX}, - /* [ 95] = 65543 */ {__glXDisp_CreateGLXPbufferSGIX, __glXDispSwap_CreateGLXPbufferSGIX}, - /* [ 96] = 65544 */ {__glXDisp_DestroyGLXPbufferSGIX, __glXDispSwap_DestroyGLXPbufferSGIX}, - /* [ 97] = 65545 */ {__glXDisp_ChangeDrawableAttributesSGIX, __glXDispSwap_ChangeDrawableAttributesSGIX}, - /* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX}, - /* [ 99] = 65547 */ {NULL, NULL}, - /* [ 100] = 65548 */ {NULL, NULL}, - /* [ 101] = 65549 */ {NULL, NULL}, - /* [ 102] = 65550 */ {NULL, NULL}, - /* [ 103] = 65551 */ {NULL, NULL}, -}; - -const struct __glXDispatchInfo VendorPriv_dispatch_info = { - 17, - VendorPriv_dispatch_tree, - VendorPriv_function_table, - NULL, - NULL -}; - diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 633bfb19a3b..08d723553e8 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -24,25 +24,38 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) # Figure out what to make here -default: +default: depend @for driver in $(DRIVER_DIRS) ; do \ case "$$driver" in \ - x11) $(MAKE) stand-alone ;; \ - dri) $(MAKE) linux-solo ;; \ - osmesa) $(MAKE) osmesa-only ;; \ - beos) $(MAKE) beos ;; \ - directfb) $(MAKE) directfb ;; \ - fbdev) $(MAKE) fbdev ;; \ + x11) $(MAKE) stand-alone || exit 1 ;; \ + dri) $(MAKE) linux-solo || exit 1 ;; \ + osmesa) $(MAKE) osmesa-only || exit 1 ;; \ + beos) $(MAKE) beos || exit 1 ;; \ + directfb) $(MAKE) directfb || exit 1 ;; \ + fbdev) $(MAKE) fbdev || exit 1 ;; \ *) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \ esac ; \ done +install: default + @for driver in $(DRIVER_DIRS) ; do \ + case "$$driver" in \ + osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \ + $(MAKE) install-headers install-osmesa || exit 1 ; \ + else \ + $(MAKE) install-osmesa || exit 1 ; \ + fi ;; \ + dri) $(MAKE) install-libgl install-dri || exit 1 ;; \ + *) $(MAKE) install-libgl || exit 1 ;; \ + esac ; \ + done + ###################################################################### # BeOS driver target beos: depend subdirs libmesa.a - cd drivers/beos; $(MAKE) + cd drivers/beos && $(MAKE) ###################################################################### @@ -56,7 +69,7 @@ libmesa.a: $(SOLO_OBJECTS) fi linux-solo: depend subdirs libmesa.a - cd drivers/dri ; $(MAKE) + cd drivers/dri && $(MAKE) ##################################################################### @@ -69,7 +82,7 @@ libgl-core: $(CORE_OBJECTS) $(GL_LIB_DEPS) directfb: depend subdirs libgl-core - cd drivers/directfb ; $(MAKE) + cd drivers/directfb && $(MAKE) ##################################################################### @@ -145,11 +158,11 @@ depend: $(ALL_SOURCES) subdirs: @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \ - (cd x86 ; $(MAKE)) ; \ + (cd x86 && $(MAKE)) || exit 1 ; \ fi @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \ - (cd x86 ; $(MAKE)) ; \ - (cd x86-64 ; $(MAKE)) ; \ + (cd x86 && $(MAKE)) || exit 1 ; \ + (cd x86-64 && $(MAKE)) || exit 1 ; \ fi pcedit = sed \ @@ -160,31 +173,25 @@ pcedit = sed \ gl.pc: gl.pc.in $(pcedit) $< > $@ -install-libgl: gl.pc +install-headers: $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -m 644 $(TOP)/include/GL/*.h \ + $(DESTDIR)$(INSTALL_DIR)/include/GL + +install-libgl: default gl.pc install-headers $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig - $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL - @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \ - $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* \ - $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \ - fi + $(INSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)* \ + $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig -install-osmesa: - @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \ - $(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* \ - $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \ - fi - -install-drivers: - @for target in $(DRIVER_DIRS); do \ - case "$$target" in \ - dri) cd drivers/dri ; $(MAKE) install ;; \ - esac; \ - done +install-osmesa: default + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)* \ + $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) -install: default install-libgl install-osmesa install-drivers +install-dri: + cd drivers/dri && $(MAKE) install ## NOT INSTALLED YET: ## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES @@ -200,9 +207,10 @@ clean: -rm -f */*/*.o -rm -f depend depend.bak libmesa.a -rm -f drivers/*/*.o - (cd drivers/dri && $(MAKE) clean) - (cd x86 && $(MAKE) clean) - (cd x86-64 && $(MAKE) clean) + -@cd drivers/dri && $(MAKE) clean + -@cd drivers/xorg && $(MAKE) clean + -@cd x86 && $(MAKE) clean + -@cd x86-64 && $(MAKE) clean -include depend diff --git a/src/mesa/drivers/beos/Makefile b/src/mesa/drivers/beos/Makefile index 9c7d6affc3b..0448650a8c6 100644 --- a/src/mesa/drivers/beos/Makefile +++ b/src/mesa/drivers/beos/Makefile @@ -170,10 +170,10 @@ OBJECTS := $(DRIVER_OBJECTS:.cpp=.o) default: depend $(TOP)/$(LIB_DIR) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(MESA_MODULES): - cd $(TOP)/src/mesa; $(MAKE) mesa.a ; + cd $(TOP)/src/mesa && $(MAKE) mesa.a ; $(GLU_MODULES): - cd $(GLU_DIR); $(MAKE) $(subst $(GLU_DIR)/,,$(GLU_MODULES)) ; + cd $(GLU_DIR) && $(MAKE) $(subst $(GLU_DIR)/,,$(GLU_MODULES)) ; $(TOP)/$(LIB_DIR): mkdir $(TOP)/$(LIB_DIR) @@ -184,13 +184,13 @@ $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(MESA_MODULES) $(GLU_MODULES) $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS) $(MESA_MODULES) $(GLU_MODULES) # $(GLU_OBJECTS): -# cd $(GLU_DIR); $(MAKE) $< ; +# cd $(GLU_DIR) && $(MAKE) $< ; depend: $(DRIVER_SOURCES) $(GLU_SOURCES) touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(DRIVER_SOURCES) $(GLU_SOURCES) > /dev/null clean: - rm -f depend $(OBJECTS) + -rm -f depend depend.bak $(OBJECTS) include depend diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 03fbab69e39..e61b9f59cf5 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -29,6 +29,7 @@ #include "buffers.h" #include "context.h" #include "framebuffer.h" +#include "mipmap.h" #include "queryobj.h" #include "renderbuffer.h" #include "texcompress.h" @@ -98,6 +99,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; + driver->GenerateMipmap = _mesa_generate_mipmap; driver->TestProxyTexImage = _mesa_test_proxy_teximage; driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; @@ -260,43 +262,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /** - * Plug in Mesa's GLSL functions. - */ -void -_mesa_init_glsl_driver_functions(struct dd_function_table *driver) -{ - driver->AttachShader = _mesa_attach_shader; - driver->BindAttribLocation = _mesa_bind_attrib_location; - driver->CompileShader = _mesa_compile_shader; - driver->CreateProgram = _mesa_create_program; - driver->CreateShader = _mesa_create_shader; - driver->DeleteProgram2 = _mesa_delete_program2; - driver->DeleteShader = _mesa_delete_shader; - driver->DetachShader = _mesa_detach_shader; - driver->GetActiveAttrib = _mesa_get_active_attrib; - driver->GetActiveUniform = _mesa_get_active_uniform; - driver->GetAttachedShaders = _mesa_get_attached_shaders; - driver->GetAttribLocation = _mesa_get_attrib_location; - driver->GetHandle = _mesa_get_handle; - driver->GetProgramiv = _mesa_get_programiv; - driver->GetProgramInfoLog = _mesa_get_program_info_log; - driver->GetShaderiv = _mesa_get_shaderiv; - driver->GetShaderInfoLog = _mesa_get_shader_info_log; - driver->GetShaderSource = _mesa_get_shader_source; - driver->GetUniformfv = _mesa_get_uniformfv; - driver->GetUniformLocation = _mesa_get_uniform_location; - driver->IsProgram = _mesa_is_program; - driver->IsShader = _mesa_is_shader; - driver->LinkProgram = _mesa_link_program; - driver->ShaderSource = _mesa_shader_source; - driver->Uniform = _mesa_uniform; - driver->UniformMatrix = _mesa_uniform_matrix; - driver->UseProgram = _mesa_use_program; - driver->ValidateProgram = _mesa_validate_program; -} - - -/** * Call the ctx->Driver.* state functions with current values to initialize * driver state. * Only the Intel drivers use this so far. diff --git a/src/mesa/drivers/common/driverfuncs.h b/src/mesa/drivers/common/driverfuncs.h index 6ed23c4520e..4c90ed12f60 100644 --- a/src/mesa/drivers/common/driverfuncs.h +++ b/src/mesa/drivers/common/driverfuncs.h @@ -31,10 +31,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver); extern void -_mesa_init_glsl_driver_functions(struct dd_function_table *driver); - - -extern void _mesa_init_driver_state(GLcontext *ctx); diff --git a/src/mesa/drivers/directfb/Makefile b/src/mesa/drivers/directfb/Makefile index c515785b2a1..dc71b385cac 100644 --- a/src/mesa/drivers/directfb/Makefile +++ b/src/mesa/drivers/directfb/Makefile @@ -50,5 +50,5 @@ install: clean: - rm -f *.o *.so + -rm -f *.o *.so diff --git a/src/mesa/drivers/dri/Makefile b/src/mesa/drivers/dri/Makefile index 69a8c553947..41dfc67e0cf 100644 --- a/src/mesa/drivers/dri/Makefile +++ b/src/mesa/drivers/dri/Makefile @@ -27,13 +27,13 @@ install: (cd $$dir && $(MAKE) install) || exit 1 ; \ fi \ done - $(TOP)/bin/minstall -d $(DESTDIR)$(INSTALL_DIR)/include/GL/internal - $(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_interface.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal - $(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_sarea.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL/internal + $(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal + $(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_sarea.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal clean: - @for dir in $(DRI_DIRS) ; do \ + -@for dir in $(DRI_DIRS) ; do \ if [ -d $$dir ] ; then \ (cd $$dir && $(MAKE) clean) ; \ fi \ diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index b7718f50fd7..6efdf4312a5 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -31,6 +31,7 @@ #include "dri_util.h" #include "drm_sarea.h" +#include "utils.h" #ifndef GLX_OML_sync_control typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); @@ -66,6 +67,18 @@ __driUtilMessage(const char *f, ...) } } +GLint +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) +{ + if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1; + if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2; + if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1; + if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2; + + if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0; + + return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1); +} /*****************************************************************/ /** \name Context (un)binding functions */ @@ -497,9 +510,9 @@ static void driCopySubBuffer(__DRIdrawable *dPriv, dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); rect.x1 = x; - rect.y1 = y; + rect.y1 = dPriv->h - y - h; rect.x2 = x + w; - rect.y2 = y + w; + rect.y2 = rect.y1 + h; driReportDamage(dPriv, &rect, 1); } @@ -758,8 +771,10 @@ static void driDestroyScreen(__DRIscreen *psp) (*psp->DriverAPI.DestroyScreen)(psp); if (psp->dri2.enabled) { +#ifdef TTM_API drmBOUnmap(psp->fd, &psp->dri2.sareaBO); drmBOUnreference(psp->fd, &psp->dri2.sareaBO); +#endif } else { (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); @@ -891,6 +906,7 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, const __DRIextension **extensions, const __DRIconfig ***driver_configs, void *data) { +#ifdef TTM_API static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; unsigned int *p; @@ -958,6 +974,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, psp->DriverAPI = driDriverAPI; return psp; +#else + return NULL; +#endif } static const __DRIextension **driGetExtensions(__DRIscreen *psp) @@ -965,117 +984,6 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp) return psp->extensions; } -#define __ATTRIB(attrib, field) \ - { attrib, offsetof(__GLcontextModes, field) } - -static const struct { unsigned int attrib, offset; } attribMap[] = { - __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), - __ATTRIB(__DRI_ATTRIB_LEVEL, level), - __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits), - __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits), - __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits), - __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits), - __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits), - __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits), - __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits), - __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits), - __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits), - __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits), - __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers), - __ATTRIB(__DRI_ATTRIB_SAMPLES, samples), - __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode), - __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode), - __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers), - __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel), - __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel), - __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed), - __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), - __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), - __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), - __ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode), - __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), - __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), - __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), - __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask), - __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth), - __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight), - __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels), - __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth), - __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight), - __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod), - __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), - __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), - __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), - __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, bindToTextureTargets), - __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), - - /* The struct field doesn't matter here, these are handled by the - * switch in driGetConfigAttribIndex. We need them in the array - * so the iterator includes them though.*/ - __ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level), - __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level), - __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level) -}; - -#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) - -static int -driGetConfigAttribIndex(const __DRIconfig *config, - unsigned int index, unsigned int *value) -{ - switch (attribMap[index].attrib) { - case __DRI_ATTRIB_RENDER_TYPE: - if (config->modes.rgbMode) - *value = __DRI_ATTRIB_RGBA_BIT; - else - *value = __DRI_ATTRIB_COLOR_INDEX_BIT; - break; - case __DRI_ATTRIB_CONFIG_CAVEAT: - if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG) - *value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG; - else if (config->modes.visualRating == GLX_SLOW_CONFIG) - *value = __DRI_ATTRIB_SLOW_BIT; - else - *value = 0; - break; - case __DRI_ATTRIB_SWAP_METHOD: - break; - - default: - *value = *(unsigned int *) - ((char *) &config->modes + attribMap[index].offset); - - break; - } - - return GL_TRUE; -} - -static int -driGetConfigAttrib(const __DRIconfig *config, - unsigned int attrib, unsigned int *value) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(attribMap); i++) - if (attribMap[i].attrib == attrib) - return driGetConfigAttribIndex(config, i, value); - - return GL_FALSE; -} - -static int -driIndexConfigAttrib(const __DRIconfig *config, int index, - unsigned int *attrib, unsigned int *value) -{ - if (index >= 0 && index < ARRAY_SIZE(attribMap)) { - *attrib = attribMap[index].attrib; - return driGetConfigAttribIndex(config, index, value); - } - - return GL_FALSE; -} - const __DRIlegacyExtension driLegacyExtension = { { __DRI_LEGACY, __DRI_LEGACY_VERSION }, driCreateNewScreen, diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 06e1d20a3cf..203479e3267 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -53,7 +53,6 @@ #include <drm.h> #include <drm_sarea.h> #include <xf86drm.h> -#include <xf86mm.h> #include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" #include "GL/internal/dri_sarea.h" @@ -61,7 +60,6 @@ #define GLX_BAD_CONTEXT 5 typedef struct __DRIswapInfoRec __DRIswapInfo; -typedef struct __DRIutilversionRec2 __DRIutilversion2; /* Typedefs to avoid rewriting the world. */ typedef struct __DRIscreenRec __DRIscreenPrivate; @@ -525,7 +523,9 @@ struct __DRIscreenRec { /* Flag to indicate that this is a DRI2 screen. Many of the above * fields will not be valid or initializaed in that case. */ int enabled; +#ifdef TTM_API drmBO sareaBO; +#endif void *sarea; __DRIEventBuffer *buffer; __DRILock *lock; @@ -536,22 +536,6 @@ struct __DRIscreenRec { drmLock *lock; }; -struct __DRIconfigRec { - __GLcontextModes modes; -}; - -/** - * Used to store a version which includes a major range instead of a single - * major version number. - */ -struct __DRIutilversionRec2 { - int major_min; /** min allowed Major version number. */ - int major_max; /** max allowed Major version number. */ - int minor; /**< Minor version number. */ - int patch; /**< Patch-level. */ -}; - - extern void __driUtilMessage(const char *f, ...); @@ -566,4 +550,7 @@ extern float driCalculateSwapUsage( __DRIdrawable *dPriv, int64_t last_swap_ust, int64_t current_ust ); +extern GLint +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ); + #endif /* _DRI_UTIL_H_ */ diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 237d51cf22b..7fbe0d855d0 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -419,21 +419,6 @@ driCheckDriDdxDrmVersions2(const char * driver_name, drmActual, drmExpected); } - - -GLint -driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) -{ - if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1; - if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2; - if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1; - if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2; - - if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0; - - return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1); -} - GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height ) @@ -540,68 +525,62 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes) { - static const u_int8_t bits_table[3][4] = { + static const u_int8_t bits_table[4][4] = { /* R G B A */ + { 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */ { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */ { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */ { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ }; - /* The following arrays are all indexed by the fb_type masked with 0x07. - * Given the four supported fb_type values, this results in valid array - * indices of 3, 4, 5, and 7. - */ - static const u_int32_t masks_table_rgb[8][4] = { - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, + static const u_int32_t masks_table_rgb[6][4] = { + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 }, /* 8_8_8_8 */ - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 } /* 8_8_8_8_REV */ }; - static const u_int32_t masks_table_rgba[8][4] = { - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, + static const u_int32_t masks_table_rgba[6][4] = { + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF }, /* 8_8_8_8 */ - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }, /* 8_8_8_8_REV */ }; - static const u_int32_t masks_table_bgr[8][4] = { - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, + static const u_int32_t masks_table_bgr[6][4] = { + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 }, /* 8_8_8_8 */ - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, /* 8_8_8_8_REV */ }; - static const u_int32_t masks_table_bgra[8][4] = { - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, + static const u_int32_t masks_table_bgra[6][4] = { + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF }, /* 8_8_8_8 */ - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, /* 8_8_8_8_REV */ }; - static const u_int8_t bytes_per_pixel[8] = { - 0, 0, 0, 2, 2, 4, 0, 4 + static const u_int8_t bytes_per_pixel[6] = { + 1, /* 3_3_2 */ + 1, /* 2_3_3_REV */ + 2, /* 5_6_5 */ + 2, /* 5_6_5_REV */ + 4, /* 8_8_8_8 */ + 4 /* 8_8_8_8_REV */ }; const u_int8_t * bits; const u_int32_t * masks; - const int index = fb_type & 0x07; + int index; __DRIconfig **configs, **c; __GLcontextModes *modes; unsigned i; @@ -610,10 +589,29 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, unsigned num_modes; unsigned num_accum_bits = 2; - if ( bytes_per_pixel[ index ] == 0 ) { - fprintf( stderr, "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.\n", - __FUNCTION__, __LINE__, fb_type ); - return NULL; + switch ( fb_type ) { + case GL_UNSIGNED_BYTE_3_3_2: + index = 0; + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + index = 1; + break; + case GL_UNSIGNED_SHORT_5_6_5: + index = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + index = 3; + break; + case GL_UNSIGNED_INT_8_8_8_8: + index = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + index = 5; + break; + default: + fprintf( stderr, "[%s:%u] Unknown framebuffer type 0x%04x.\n", + __FUNCTION__, __LINE__, fb_type ); + return NULL; } @@ -625,35 +623,41 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, switch ( fb_format ) { case GL_RGB: - bits = (bytes_per_pixel[ index ] == 2) - ? bits_table[0] : bits_table[1]; masks = masks_table_rgb[ index ]; break; case GL_RGBA: - bits = (bytes_per_pixel[ index ] == 2) - ? bits_table[0] : bits_table[2]; masks = masks_table_rgba[ index ]; break; case GL_BGR: - bits = (bytes_per_pixel[ index ] == 2) - ? bits_table[0] : bits_table[1]; masks = masks_table_bgr[ index ]; break; case GL_BGRA: - bits = (bytes_per_pixel[ index ] == 2) - ? bits_table[0] : bits_table[2]; masks = masks_table_bgra[ index ]; break; default: - fprintf( stderr, "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.\n", - __FUNCTION__, __LINE__, fb_format ); + fprintf( stderr, "[%s:%u] Unknown framebuffer format 0x%04x.\n", + __FUNCTION__, __LINE__, fb_format ); return NULL; } + switch ( bytes_per_pixel[ index ] ) { + case 1: + bits = bits_table[0]; + break; + case 2: + bits = bits_table[1]; + break; + default: + bits = ((fb_format == GL_RGB) || (fb_format == GL_BGR)) + ? bits_table[2] + : bits_table[3]; + break; + } + num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits; configs = _mesa_calloc((num_modes + 1) * sizeof *configs); if (configs == NULL) @@ -755,3 +759,114 @@ const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b) return all; } + +#define __ATTRIB(attrib, field) \ + { attrib, offsetof(__GLcontextModes, field) } + +static const struct { unsigned int attrib, offset; } attribMap[] = { + __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), + __ATTRIB(__DRI_ATTRIB_LEVEL, level), + __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits), + __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits), + __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits), + __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits), + __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits), + __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits), + __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers), + __ATTRIB(__DRI_ATTRIB_SAMPLES, samples), + __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode), + __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode), + __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), + __ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode), + __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), + __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), + __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), + __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), + __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, bindToTextureTargets), + __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), + + /* The struct field doesn't matter here, these are handled by the + * switch in driGetConfigAttribIndex. We need them in the array + * so the iterator includes them though.*/ + __ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level), + __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level) +}; + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +static int +driGetConfigAttribIndex(const __DRIconfig *config, + unsigned int index, unsigned int *value) +{ + switch (attribMap[index].attrib) { + case __DRI_ATTRIB_RENDER_TYPE: + if (config->modes.rgbMode) + *value = __DRI_ATTRIB_RGBA_BIT; + else + *value = __DRI_ATTRIB_COLOR_INDEX_BIT; + break; + case __DRI_ATTRIB_CONFIG_CAVEAT: + if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG) + *value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG; + else if (config->modes.visualRating == GLX_SLOW_CONFIG) + *value = __DRI_ATTRIB_SLOW_BIT; + else + *value = 0; + break; + case __DRI_ATTRIB_SWAP_METHOD: + break; + + default: + *value = *(unsigned int *) + ((char *) &config->modes + attribMap[index].offset); + + break; + } + + return GL_TRUE; +} + +int +driGetConfigAttrib(const __DRIconfig *config, + unsigned int attrib, unsigned int *value) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(attribMap); i++) + if (attribMap[i].attrib == attrib) + return driGetConfigAttribIndex(config, i, value); + + return GL_FALSE; +} + +int +driIndexConfigAttrib(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value) +{ + if (index >= 0 && index < ARRAY_SIZE(attribMap)) { + *attrib = attribMap[index].attrib; + return driGetConfigAttribIndex(config, index, value); + } + + return GL_FALSE; +} diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 45a78e5ca5a..0c09a7e68fb 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -29,8 +29,11 @@ #ifndef DRI_DEBUG_H #define DRI_DEBUG_H +#include <GL/gl.h> +#include <GL/internal/dri_interface.h> #include "context.h" -#include "dri_util.h" + +typedef struct __DRIutilversionRec2 __DRIutilversion2; struct dri_debug_control { const char * string; @@ -84,6 +87,17 @@ struct dri_extension { const struct dri_extension_function * functions; }; +/** + * Used to store a version which includes a major range instead of a single + * major version number. + */ +struct __DRIutilversionRec2 { + int major_min; /** min allowed Major version number. */ + int major_max; /** max allowed Major version number. */ + int minor; /**< Minor version number. */ + int patch; /**< Patch-level. */ +}; + extern unsigned driParseDebugString( const char * debug, const struct dri_debug_control * control ); @@ -106,12 +120,14 @@ extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name, const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected, const __DRIversion * drmActual, const __DRIversion * drmExpected); -extern GLint driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ); - extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height ); +struct __DRIconfigRec { + __GLcontextModes modes; +}; + extern __DRIconfig ** driCreateConfigs(GLenum fb_format, GLenum fb_type, const u_int8_t * depth_bits, const u_int8_t * stencil_bits, @@ -120,4 +136,11 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b); +int +driGetConfigAttrib(const __DRIconfig *config, + unsigned int attrib, unsigned int *value); +int +driIndexConfigAttrib(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value); + #endif /* DRI_DEBUG_H */ diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index e81cc6886f2..dc2cbcc84d4 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -260,8 +260,8 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) 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; } diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile b/src/mesa/drivers/dri/common/xmlpool/Makefile index b077809cd18..62ec919ea68 100644 --- a/src/mesa/drivers/dri/common/xmlpool/Makefile +++ b/src/mesa/drivers/dri/common/xmlpool/Makefile @@ -57,8 +57,8 @@ 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) + -rm -f $(POT) *~ + -rm -rf $(LANGS) # Default target options.h options.h: t_options.h mo diff --git a/src/mesa/drivers/dri/glcore/Makefile b/src/mesa/drivers/dri/glcore/Makefile deleted file mode 100644 index 968190acfc0..00000000000 --- a/src/mesa/drivers/dri/glcore/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# src/mesa/drivers/dri/glcore/Makefile - -TOP = ../../../../.. -include $(TOP)/configs/current - -LIBNAME = glcore_dri.so - -DRIVER_SOURCES = glcore_driver.c \ - $(TOP)/src/mesa/drivers/common/driverfuncs.c \ - ../common/dri_util.c - -C_SOURCES = \ - $(DRIVER_SOURCES) \ - $(DRI_SOURCES) - - -# Include directories -INCLUDE_DIRS = \ - -I. \ - -I../common \ - -I../dri_client \ - -I../dri_client/imports \ - -Iserver \ - -I$(TOP)/include \ - -I$(DRM_SOURCE_PATH)/shared-core \ - -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 - -# Core Mesa objects -MESA_MODULES = $(TOP)/src/mesa/libmesa.a - -# Libraries that the driver shared lib depends on -LIB_DEPS = -lm -lpthread -lc -# LIB_DEPS = -lGL -lm -lpthread -lc - - -ASM_SOURCES = - -OBJECTS = $(C_SOURCES:.c=.o) \ - $(ASM_SOURCES:.S=.o) - - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: depend $(TOP)/$(LIB_DIR)/$(LIBNAME) - - -$(TOP)/$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(LIBNAME) -noprefix \ - -ldflags '$(LDFLAGS)' -install $(TOP)/$(LIB_DIR) \ - $(OBJECTS) $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES) - - -depend: $(C_SOURCES) $(ASM_SOURCES) - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDE_DIRS) $(C_SOURCES) $(ASM_SOURCES) \ - > /dev/null - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` - - -clean: - -rm -f *.o server/*.o - - -include depend diff --git a/src/mesa/drivers/dri/glcore/glcore_driver.c b/src/mesa/drivers/dri/glcore/glcore_driver.c deleted file mode 100644 index 25778160419..00000000000 --- a/src/mesa/drivers/dri/glcore/glcore_driver.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2006 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS 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 implements a software-only "DRI" driver. It doesn't actually speak - * any DRI protocol or talk to the DRM, it just looks enough like a DRI driver - * that libglx in the server can load it for software rendering in the - * unaccelerated case. - */ - -static GLboolean -glcoreInitDriver(__DRIscreenPrivate *driScreenPriv) -{ -} - -static void -glcoreDestroyScreen(__DRIScreenPrivate *driScreenPriv) -{ -} - -static GLboolean -glcoreCreateContext(const __GLcontextModes *glVisual, - __DRIcontextPrivate *driContextPriv, - void *shared_context) -{ -} - -static void -glcoreDestroyContext(__DRIcontextPrivate *driContextPriv) -{ -} - -static GLboolean -glcoreCreateBuffer(__DRIscreenPrivate *driScreenPriv, - __DRIdrawablePrivate *driDrawablePriv, - const __GLcontextModes *mesaVisual, - GLboolean isPixmap) -{ -} - -static void -glcoreDestroyBuffer(__DRIdrawablePrivate *driDrawablePriv) -{ -} - -static void -glcoreSwapBuffers(__DRIdrawablePrivate *driDrawablePriv) -{ -} - -static GLboolean -glcoreMakeCurrent(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawablePriv, - __DRIdrawablePrivate *driReadablePriv) -{ -} - -static GLboolean -glcoreUnbindContext(__DRIcontextPrivate *driContextPriv) -{ -} - -static struct __DriverAPIRec glcore_api = { - .InitDriver = glcoreInitDriver, - .DestroyScreen = glcoreDestroyScreen, - .CreateContext = glcoreCreateContext, - .DestroyContext = glcoreDestroyContext, - .CreateBuffer = glcoreCreateBuffer, - .DestroyBuffer = glcoreDestroyBuffer, - .SwapBuffers = glcoreSwapBuffers, - .MakeCurrent = glcoreMakeCurrent, - .UnbindContext = glcoreUnbindContext, -}; - -static __GLcontextModes * -glcoreFillInModes(unsigned pixel_bits) -{ -} - -PUBLIC void * -__driCreateNewScreen_20050727(__DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, const __GLcontextModes *modes, - const __DRIversion *ddx_version, - const __DRIversion *dri_version, - const __DRIversion *drm_version, - const __DRIframebuffer *fb, drmAddress pSarea, - int fd, int internal_api_version, - const ___DRIinterfaceMethods *interface, - __GLcontextModes **driver_modes) -{ - __DRIscreenPrivate *driScreenPriv; - glcoreDriverPrivate *glcoreDriverPriv; - - /* would normally check ddx/dri/drm versions here */ - - driScreenPriv = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, ddx_version, - dri_version, drm_version, fb, - internal_api_version, &glcore_api); - if (!driScreenPriv) - return NULL; - - glcoreDriverPriv = driScreenPriv->pDrvPriv; - - *driver_modes = glcoreFillInModes(glcoreDriverPriv->bpp); - - driInitExtensions(NULL, NULL, GL_FALSE); - - return driScreenPriv; -} diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 6124ab6b0f0..f90c5f7b082 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -257,10 +257,12 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx, struct intel_context *intel = intel_context(ctx); struct brw_context *brw = brw_context(ctx); GLboolean retval = GL_FALSE; - GLuint i, ret; + GLuint i; GLuint ib_offset; dri_bo *ib_bo; GLboolean force_flush = GL_FALSE; + int ret; + if (ctx->NewState) _mesa_update_state( ctx ); @@ -316,6 +318,14 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx, goto flush; } + /* Various fallback checks: + */ + if (brw->intel.Fallback) + goto out; + + if (check_fallbacks( brw, prim, nr_prims )) + goto out; + /* need to account for index buffer and vertex buffer */ if (ib) { ret = brw_prepare_indices( brw, ib , &ib_bo, &ib_offset); @@ -333,16 +343,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx, force_flush = GL_TRUE; goto flush; } - - - - /* Various fallback checks: - */ - if (brw->intel.Fallback) - goto out; - - if (check_fallbacks( brw, prim, nr_prims )) - goto out; /* Upload index, vertex data: */ diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 026c8ed8982..18ba02423d5 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -401,6 +401,7 @@ int brw_prepare_vertices( struct brw_context *brw, */ copy_array_to_vbo_array(brw, upload[0], interleave); + ret |= dri_bufmgr_check_aperture_space(upload[0]->bo); for (i = 1; i < nr_uploads; i++) { /* Then, just point upload[i] at upload[0]'s buffer. */ upload[i]->stride = interleave; @@ -413,13 +414,13 @@ int brw_prepare_vertices( struct brw_context *brw, else { /* Upload non-interleaved arrays */ for (i = 0; i < nr_uploads; i++) { - copy_array_to_vbo_array(brw, upload[i], upload[i]->element_size); + copy_array_to_vbo_array(brw, upload[i], upload[i]->element_size); + if (upload[i]->bo) { + ret |= dri_bufmgr_check_aperture_space(upload[i]->bo); + } } } - if (brw->vb.upload.bo) { - ret |= dri_bufmgr_check_aperture_space(brw->vb.upload.bo); - } if (ret) return 1; diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c index 58c81766cdd..c0a18fa2259 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.c +++ b/src/mesa/drivers/dri/intel/intel_ioctl.c @@ -150,6 +150,7 @@ intel_batch_ioctl(struct intel_context *intel, return 0; } +#ifdef TTM_API int intel_exec_ioctl(struct intel_context *intel, GLuint used, @@ -183,3 +184,13 @@ intel_exec_ioctl(struct intel_context *intel, return 0; } +#else +int +int intel_exec_ioctl(struct intel_context *intel, + GLuint used, + GLboolean ignore_cliprects, GLboolean allow_unlock, + struct drm_i915_gem_execbuffer *execbuf); +{ + return -EINVAL; +} +#endif diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 329af0d1b04..f1d6a6dbfc0 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -172,14 +172,13 @@ timed_memcpy(void *dest, const void *src, size_t n) */ void intel_generate_mipmap(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj) { struct intel_texture_object *intelObj = intel_texture_object(texObj); GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; int face, i; - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texObj); /* Update the level information in our private data in the new images, since * it didn't get set as part of a normal TexImage path. @@ -198,6 +197,15 @@ intel_generate_mipmap(GLcontext *ctx, GLenum target, } } +static void intelGenerateMipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) +{ + struct intel_context *intel = intel_context(ctx); + struct intel_texture_object *intelObj = intel_texture_object(texObj); + + intel_tex_map_images(intel, intelObj); + intel_generate_mipmap(ctx, target, texObj); + intel_tex_unmap_images(intel, intelObj); +} void intelInitTextureFuncs(struct dd_function_table *functions) @@ -221,6 +229,7 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->CopyTexSubImage2D = _swrast_copy_texsubimage2d; #endif functions->GetTexImage = intelGetTexImage; + functions->GenerateMipmap = intelGenerateMipmap; /* compressed texture functions */ functions->CompressedTexImage2D = intelCompressedTexImage2D; diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 3a87137cc9e..60ab8203e52 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -151,7 +151,6 @@ void intel_tex_unmap_images(struct intel_context *intel, int intel_compressed_num_bytes(GLuint mesaFormat); void intel_generate_mipmap(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj); #endif diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 7facc469f48..1add7c6188c 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -161,9 +161,7 @@ do_copy_texsubimage(struct intel_context *intel, /* GL_SGIS_generate_mipmap */ if (intelImage->level == texObj->BaseLevel && texObj->GenerateMipmap) { - intel_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + intel_generate_mipmap(ctx, target, texObj); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index bcb65835c6b..95ddbd59202 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -522,9 +522,7 @@ intelTexImage(GLcontext * ctx, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - intel_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + intel_generate_mipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, unpack); diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index 78621814c3a..5428a1d0689 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -103,9 +103,7 @@ intelTexSubimage(GLcontext * ctx, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - intel_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + intel_generate_mipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 7008832965a..20482a41244 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -477,16 +477,18 @@ void r200CopyBuffer( __DRIdrawablePrivate *dPriv, if (rect->y2 < b->y2) b->y2 = rect->y2; - if (b->x1 < b->x2 && b->y1 < b->y2) - b++; + if (b->x1 >= b->x2 || b->y1 >= b->y2) + continue; } - else - b++; + b++; n++; } rmesa->sarea->nbox = n; + if (!n) + continue; + ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP ); if ( ret ) { diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index 44248964fdb..5b2bd0bc2b0 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -39,6 +39,7 @@ DRIVER_SOURCES = \ r300_texstate.c \ r300_vertprog.c \ r300_fragprog.c \ + r500_fragprog.c \ r300_shader.c \ r300_emit.c \ r300_swtcl.c \ diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 3497738eacf..8d4d604ba96 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -164,7 +164,7 @@ static inline void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty) r300->cmdbuf.count_used++; /* Emit cache flush */ - *dest = cmdpacket0(R300_TX_CNTL, 1); + *dest = cmdpacket0(R300_TX_INVALTAGS, 1); dest++; r300->cmdbuf.count_used++; @@ -242,6 +242,7 @@ void r300EmitState(r300ContextPtr r300) #define packet0_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->packet0.count) #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) +#define r500fp_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->r500fp.count) static int check_always(r300ContextPtr r300, struct r300_state_atom *atom) { @@ -262,6 +263,20 @@ static int check_vpu(r300ContextPtr r300, struct r300_state_atom *atom) return cnt ? (cnt * 4) + 1 : 0; } +static int check_r500fp(r300ContextPtr r300, struct r300_state_atom *atom) +{ + int cnt; + cnt = r500fp_count(atom->cmd); + return cnt ? (cnt * 6) + 1 : 0; +} + +static int check_r500fp_const(r300ContextPtr r300, struct r300_state_atom *atom) +{ + int cnt; + cnt = r500fp_count(atom->cmd); + return cnt ? (cnt * 4) + 1 : 0; +} + #define ALLOC_STATE( ATOM, CHK, SZ, IDX ) \ do { \ r300->hw.ATOM.cmd_size = (SZ); \ @@ -281,10 +296,15 @@ void r300InitCmdBuf(r300ContextPtr r300) { int size, mtu; int has_tcl = 1; + int is_r500 = 0; + int i; if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) has_tcl = 0; + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + is_r500 = 1; + r300->hw.max_state_size = 2 + 2; /* reserve extra space for WAIT_IDLE and tex cache flush */ mtu = r300->radeon.glCtx->Const.MaxTextureUnits; @@ -299,8 +319,15 @@ void r300InitCmdBuf(r300ContextPtr r300) /* Initialize state atoms */ ALLOC_STATE(vpt, always, R300_VPT_CMDSIZE, 0); r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6); - ALLOC_STATE(vap_cntl, always, 2, 0); - r300->hw.vap_cntl.cmd[0] = cmdpacket0(R300_VAP_CNTL, 1); + ALLOC_STATE(vap_cntl, always, R300_VAP_CNTL_SIZE, 0); + r300->hw.vap_cntl.cmd[R300_VAP_CNTL_FLUSH] = cmdpacket0(R300_VAP_PVS_STATE_FLUSH_REG, 1); + r300->hw.vap_cntl.cmd[R300_VAP_CNTL_FLUSH_1] = 0; + r300->hw.vap_cntl.cmd[R300_VAP_CNTL_CMD] = cmdpacket0(R300_VAP_CNTL, 1); + if (is_r500) { + ALLOC_STATE(vap_index_offset, always, 2, 0); + r300->hw.vap_index_offset.cmd[0] = cmdpacket0(R500_VAP_INDEX_OFFSET, 1); + r300->hw.vap_index_offset.cmd[1] = 0; + } ALLOC_STATE(vte, always, 3, 0); r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2); ALLOC_STATE(vap_vf_max_vtx_indx, always, 3, 0); @@ -309,12 +336,12 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.vap_cntl_status.cmd[0] = cmdpacket0(R300_VAP_CNTL_STATUS, 1); ALLOC_STATE(vir[0], variable, R300_VIR_CMDSIZE, 0); r300->hw.vir[0].cmd[R300_VIR_CMD_0] = - cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1); + cmdpacket0(R300_VAP_PROG_STREAM_CNTL_0, 1); ALLOC_STATE(vir[1], variable, R300_VIR_CMDSIZE, 1); r300->hw.vir[1].cmd[R300_VIR_CMD_0] = - cmdpacket0(R300_VAP_INPUT_ROUTE_1_0, 1); + cmdpacket0(R300_VAP_PROG_STREAM_CNTL_EXT_0, 1); ALLOC_STATE(vic, always, R300_VIC_CMDSIZE, 0); - r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_INPUT_CNTL_0, 2); + r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_VTX_STATE_CNTL, 2); ALLOC_STATE(vap_psc_sgn_norm_cntl, always, 2, 0); r300->hw.vap_psc_sgn_norm_cntl.cmd[0] = cmdpacket0(R300_VAP_PSC_SGN_NORM_CNTL, SGN_NORM_ZERO_CLAMP_MINUS_ONE); @@ -322,7 +349,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(vap_clip_cntl, always, 2, 0); r300->hw.vap_clip_cntl.cmd[0] = cmdpacket0(R300_VAP_CLIP_CNTL, 1); ALLOC_STATE(vap_clip, always, 5, 0); - r300->hw.vap_clip.cmd[0] = cmdpacket0(R300_VAP_CLIP_X_0, 4); + r300->hw.vap_clip.cmd[0] = cmdpacket0(R300_VAP_GB_VERT_CLIP_ADJ, 4); ALLOC_STATE(vap_pvs_vtx_timeout_reg, always, 2, 0); r300->hw.vap_pvs_vtx_timeout_reg.cmd[0] = cmdpacket0(VAP_PVS_VTX_TIMEOUT_REG, 1); } @@ -334,7 +361,7 @@ void r300InitCmdBuf(r300ContextPtr r300) if (has_tcl) { ALLOC_STATE(pvs, always, R300_PVS_CMDSIZE, 0); r300->hw.pvs.cmd[R300_PVS_CMD_0] = - cmdpacket0(R300_VAP_PVS_CNTL_1, 3); + cmdpacket0(R300_VAP_PVS_CODE_CNTL_0, 3); } ALLOC_STATE(gb_enable, always, 2, 0); @@ -344,69 +371,99 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(txe, always, R300_TXE_CMDSIZE, 0); r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1); ALLOC_STATE(ga_point_s0, always, 5, 0); - r300->hw.ga_point_s0.cmd[0] = cmdpacket0(GA_POINT_S0, 4); + r300->hw.ga_point_s0.cmd[0] = cmdpacket0(R300_GA_POINT_S0, 4); ALLOC_STATE(ga_triangle_stipple, always, 2, 0); - r300->hw.ga_triangle_stipple.cmd[0] = cmdpacket0(GA_TRIANGLE_STIPPLE, 1); + r300->hw.ga_triangle_stipple.cmd[0] = cmdpacket0(R300_GA_TRIANGLE_STIPPLE, 1); ALLOC_STATE(ps, always, R300_PS_CMDSIZE, 0); r300->hw.ps.cmd[0] = cmdpacket0(R300_GA_POINT_SIZE, 1); ALLOC_STATE(ga_point_minmax, always, 4, 0); r300->hw.ga_point_minmax.cmd[0] = cmdpacket0(R300_GA_POINT_MINMAX, 3); ALLOC_STATE(lcntl, always, 2, 0); - r300->hw.lcntl.cmd[0] = cmdpacket0(GA_LINE_CNTL, 1); + r300->hw.lcntl.cmd[0] = cmdpacket0(R300_GA_LINE_CNTL, 1); ALLOC_STATE(ga_line_stipple, always, 4, 0); r300->hw.ga_line_stipple.cmd[0] = cmdpacket0(R300_GA_LINE_STIPPLE_VALUE, 3); ALLOC_STATE(shade, always, 5, 0); - r300->hw.shade.cmd[0] = cmdpacket0(GA_ENHANCE, 4); + r300->hw.shade.cmd[0] = cmdpacket0(R300_GA_ENHANCE, 4); ALLOC_STATE(polygon_mode, always, 4, 0); - r300->hw.polygon_mode.cmd[0] = cmdpacket0(GA_POLY_MODE, 3); + r300->hw.polygon_mode.cmd[0] = cmdpacket0(R300_GA_POLY_MODE, 3); ALLOC_STATE(fogp, always, 3, 0); - r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2); + r300->hw.fogp.cmd[0] = cmdpacket0(R300_GA_FOG_SCALE, 2); ALLOC_STATE(zbias_cntl, always, 2, 0); - r300->hw.zbias_cntl.cmd[0] = cmdpacket0(R300_RE_ZBIAS_CNTL, 1); + r300->hw.zbias_cntl.cmd[0] = cmdpacket0(R300_SU_TEX_WRAP, 1); ALLOC_STATE(zbs, always, R300_ZBS_CMDSIZE, 0); r300->hw.zbs.cmd[R300_ZBS_CMD_0] = - cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4); + cmdpacket0(R300_SU_POLY_OFFSET_FRONT_SCALE, 4); ALLOC_STATE(occlusion_cntl, always, 2, 0); - r300->hw.occlusion_cntl.cmd[0] = cmdpacket0(R300_RE_OCCLUSION_CNTL, 1); + r300->hw.occlusion_cntl.cmd[0] = cmdpacket0(R300_SU_POLY_OFFSET_ENABLE, 1); ALLOC_STATE(cul, always, R300_CUL_CMDSIZE, 0); - r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1); + r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_SU_CULL_MODE, 1); ALLOC_STATE(su_depth_scale, always, 3, 0); r300->hw.su_depth_scale.cmd[0] = cmdpacket0(R300_SU_DEPTH_SCALE, 2); ALLOC_STATE(rc, always, R300_RC_CMDSIZE, 0); r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_COUNT, 2); - ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0); - r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_IP_0, 8); - ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0); - r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_INST_0, 1); + if (is_r500) { + ALLOC_STATE(ri, always, R500_RI_CMDSIZE, 0); + r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R500_RS_IP_0, 16); + for (i = 0; i < 8; i++) { + r300->hw.ri.cmd[R300_RI_CMD_0 + i +1] = + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) | + (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT); + } + ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0); + r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R500_RS_INST_0, 1); + } else { + ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0); + r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_IP_0, 8); + ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0); + r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_INST_0, 1); + } ALLOC_STATE(sc_hyperz, always, 3, 0); r300->hw.sc_hyperz.cmd[0] = cmdpacket0(R300_SC_HYPERZ, 2); ALLOC_STATE(sc_screendoor, always, 2, 0); r300->hw.sc_screendoor.cmd[0] = cmdpacket0(R300_SC_SCREENDOOR, 1); - ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0); - r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3); - r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4); - ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0); - r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0); ALLOC_STATE(us_out_fmt, always, 6, 0); - r300->hw.us_out_fmt.cmd[0] = cmdpacket0(R500_US_OUT_FMT, 5); - ALLOC_STATE(fpi[0], variable, R300_FPI_CMDSIZE, 0); - r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1); - ALLOC_STATE(fpi[1], variable, R300_FPI_CMDSIZE, 1); - r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, 1); - ALLOC_STATE(fpi[2], variable, R300_FPI_CMDSIZE, 2); - r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, 1); - ALLOC_STATE(fpi[3], variable, R300_FPI_CMDSIZE, 3); - r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1); + r300->hw.us_out_fmt.cmd[0] = cmdpacket0(R300_US_OUT_FMT, 5); + + if (is_r500) { + ALLOC_STATE(fp, always, R500_FP_CMDSIZE, 0); + r300->hw.fp.cmd[R500_FP_CMD_0] = cmdpacket0(R500_US_CONFIG, 2); + r300->hw.fp.cmd[R500_FP_CNTL] = R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO; + r300->hw.fp.cmd[R500_FP_CMD_1] = cmdpacket0(R500_US_CODE_ADDR, 3); + r300->hw.fp.cmd[R500_FP_CMD_2] = cmdpacket0(R500_US_FC_CTRL, 1); + r300->hw.fp.cmd[R500_FP_FC_CNTL] = 0; /* FIXME when we add flow control */ + + ALLOC_STATE(r500fp, r500fp, R500_FPI_CMDSIZE, 0); + r300->hw.r500fp.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0, 0, 0); + ALLOC_STATE(r500fp_const, r500fp_const, R500_FPP_CMDSIZE, 0); + r300->hw.r500fp_const.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0, 1, 0); + } else { + ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0); + r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_US_CONFIG, 3); + r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_US_CODE_ADDR_0, 4); + ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0); + r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_US_TEX_INST_0, 0); + + ALLOC_STATE(fpi[0], variable, R300_FPI_CMDSIZE, 0); + r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_RGB_INST_0, 1); + ALLOC_STATE(fpi[1], variable, R300_FPI_CMDSIZE, 1); + r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_RGB_ADDR_0, 1); + ALLOC_STATE(fpi[2], variable, R300_FPI_CMDSIZE, 2); + r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_ALPHA_INST_0, 1); + ALLOC_STATE(fpi[3], variable, R300_FPI_CMDSIZE, 3); + r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_ALPHA_ADDR_0, 1); + ALLOC_STATE(fpp, variable, R300_FPP_CMDSIZE, 0); + r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0); + } ALLOC_STATE(fogs, always, R300_FOGS_CMDSIZE, 0); - r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(FG_FOG_BLEND, 1); + r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_FG_FOG_BLEND, 1); ALLOC_STATE(fogc, always, R300_FOGC_CMDSIZE, 0); - r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(FG_FOG_COLOR_R, 3); + r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FG_FOG_COLOR_R, 3); ALLOC_STATE(at, always, R300_AT_CMDSIZE, 0); - r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(FG_ALPHA_FUNC, 2); + r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_FG_ALPHA_FUNC, 2); ALLOC_STATE(fg_depth_src, always, 2, 0); r300->hw.fg_depth_src.cmd[0] = cmdpacket0(R300_FG_DEPTH_SRC, 1); - ALLOC_STATE(fpp, variable, R300_FPP_CMDSIZE, 0); - r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0); ALLOC_STATE(rb3d_cctl, always, 2, 0); r300->hw.rb3d_cctl.cmd[0] = cmdpacket0(R300_RB3D_CCTL, 1); ALLOC_STATE(bld, always, R300_BLD_CMDSIZE, 0); @@ -421,45 +478,61 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(rb3d_dither_ctl, always, 10, 0); r300->hw.rb3d_dither_ctl.cmd[0] = cmdpacket0(R300_RB3D_DITHER_CTL, 9); ALLOC_STATE(rb3d_aaresolve_ctl, always, 2, 0); - r300->hw.rb3d_aaresolve_ctl.cmd[0] = cmdpacket0(RB3D_AARESOLVE_CTL, 1); + r300->hw.rb3d_aaresolve_ctl.cmd[0] = cmdpacket0(R300_RB3D_AARESOLVE_CTL, 1); ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0); - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2); + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2); ALLOC_STATE(zs, always, R300_ZS_CMDSIZE, 0); r300->hw.zs.cmd[R300_ZS_CMD_0] = - cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3); + cmdpacket0(R300_ZB_CNTL, 3); ALLOC_STATE(zstencil_format, always, 5, 0); r300->hw.zstencil_format.cmd[0] = - cmdpacket0(ZB_FORMAT, 4); + cmdpacket0(R300_ZB_FORMAT, 4); ALLOC_STATE(zb, always, R300_ZB_CMDSIZE, 0); - r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(ZB_DEPTHOFFSET, 2); + r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_ZB_DEPTHOFFSET, 2); ALLOC_STATE(zb_depthclearvalue, always, 2, 0); - r300->hw.zb_depthclearvalue.cmd[0] = cmdpacket0(ZB_DEPTHCLEARVALUE, 1); + r300->hw.zb_depthclearvalue.cmd[0] = cmdpacket0(R300_ZB_DEPTHCLEARVALUE, 1); ALLOC_STATE(unk4F30, always, 3, 0); r300->hw.unk4F30.cmd[0] = cmdpacket0(0x4F30, 2); ALLOC_STATE(zb_hiz_offset, always, 2, 0); - r300->hw.zb_hiz_offset.cmd[0] = cmdpacket0(ZB_HIZ_OFFSET, 1); + r300->hw.zb_hiz_offset.cmd[0] = cmdpacket0(R300_ZB_HIZ_OFFSET, 1); ALLOC_STATE(zb_hiz_pitch, always, 2, 0); - r300->hw.zb_hiz_pitch.cmd[0] = cmdpacket0(ZB_HIZ_PITCH, 1); + r300->hw.zb_hiz_pitch.cmd[0] = cmdpacket0(R300_ZB_HIZ_PITCH, 1); /* VPU only on TCL */ if (has_tcl) { int i; ALLOC_STATE(vpi, vpu, R300_VPI_CMDSIZE, 0); r300->hw.vpi.cmd[R300_VPI_CMD_0] = - cmdvpu(R300_PVS_UPLOAD_PROGRAM, 0); + cmdvpu(R300_PVS_CODE_START, 0); - ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0); - r300->hw.vpp.cmd[R300_VPP_CMD_0] = - cmdvpu(R300_PVS_UPLOAD_PARAMETERS, 0); + if (is_r500) { + ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0); + r300->hw.vpp.cmd[R300_VPP_CMD_0] = + cmdvpu(R500_PVS_CONST_START, 0); - ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0); - r300->hw.vps.cmd[R300_VPS_CMD_0] = - cmdvpu(R300_PVS_UPLOAD_POINTSIZE, 1); + ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0); + r300->hw.vps.cmd[R300_VPS_CMD_0] = + cmdvpu(R500_POINT_VPORT_SCALE_OFFSET, 1); - for (i = 0; i < 6; i++) { - ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0); - r300->hw.vpucp[i].cmd[R300_VPUCP_CMD_0] = - cmdvpu(R300_PVS_UPLOAD_CLIP_PLANE0+i, 1); + for (i = 0; i < 6; i++) { + ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0); + r300->hw.vpucp[i].cmd[R300_VPUCP_CMD_0] = + cmdvpu(R500_PVS_UCP_START + i, 1); + } + } else { + ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0); + r300->hw.vpp.cmd[R300_VPP_CMD_0] = + cmdvpu(R300_PVS_CONST_START, 0); + + ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0); + r300->hw.vps.cmd[R300_VPS_CMD_0] = + cmdvpu(R300_POINT_VPORT_SCALE_OFFSET, 1); + + for (i = 0; i < 6; i++) { + ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0); + r300->hw.vpucp[i].cmd[R300_VPUCP_CMD_0] = + cmdvpu(R300_PVS_UCP_START + i, 1); + } } } diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index c56a7622897..31cc00a081b 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -278,6 +278,11 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, ctx->Const.MaxTextureCoordUnits); ctx->Const.MaxTextureMaxAnisotropy = 16.0; + if (screen->chip_family >= CHIP_FAMILY_RV515) { + ctx->Const.MaxTextureLevels = 13; + ctx->Const.MaxTextureRectSize = 4096; + } + ctx->Const.MinPointSize = 1.0; ctx->Const.MinPointSizeAA = 1.0; ctx->Const.MaxPointSize = R300_POINTSIZE_MAX; diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 780d9aa5d28..a5ec5ee46e2 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -74,6 +74,7 @@ typedef struct r300_context *r300ContextPtr; #include "r300_vertprog.h" #include "r300_fragprog.h" +#include "r500_fragprog.h" /** * This function takes a float and packs it into a uint32_t @@ -330,6 +331,8 @@ struct r300_state_atom { #define R300_RI_INTERP_7 8 #define R300_RI_CMDSIZE 9 +#define R500_RI_CMDSIZE 17 + #define R300_RR_CMD_0 0 /* rr is variable size (at least 1) */ #define R300_RR_INST_0 1 #define R300_RR_INST_1 2 @@ -352,6 +355,17 @@ struct r300_state_atom { #define R300_FP_NODE3 8 #define R300_FP_CMDSIZE 9 +#define R500_FP_CMD_0 0 +#define R500_FP_CNTL 1 +#define R500_FP_PIXSIZE 2 +#define R500_FP_CMD_1 3 +#define R500_FP_CODE_ADDR 4 +#define R500_FP_CODE_RANGE 5 +#define R500_FP_CODE_OFFSET 6 +#define R500_FP_CMD_2 7 +#define R500_FP_FC_CNTL 8 +#define R500_FP_CMDSIZE 9 + #define R300_FPT_CMD_0 0 #define R300_FPT_INSTR_0 1 #define R300_FPT_CMDSIZE 65 @@ -359,10 +373,14 @@ struct r300_state_atom { #define R300_FPI_CMD_0 0 #define R300_FPI_INSTR_0 1 #define R300_FPI_CMDSIZE 65 +/* R500 has space for 512 instructions - 6 dwords per instruction */ +#define R500_FPI_CMDSIZE (512*6+1) #define R300_FPP_CMD_0 0 #define R300_FPP_PARAM_0 1 #define R300_FPP_CMDSIZE (32*4+1) +/* R500 has spcae for 256 constants - 4 dwords per constant */ +#define R500_FPP_CMDSIZE (256*4+1) #define R300_FOGS_CMD_0 0 #define R300_FOGS_STATE 1 @@ -410,6 +428,12 @@ struct r300_state_atom { #define R300_ZB_PITCH 2 #define R300_ZB_CMDSIZE 3 +#define R300_VAP_CNTL_FLUSH 0 +#define R300_VAP_CNTL_FLUSH_1 1 +#define R300_VAP_CNTL_CMD 2 +#define R300_VAP_CNTL_INSTR 3 +#define R300_VAP_CNTL_SIZE 4 + #define R300_VPI_CMD_0 0 #define R300_VPI_INSTR_0 1 #define R300_VPI_CMDSIZE 1025 /* 256 16 byte instructions */ @@ -451,6 +475,7 @@ struct r300_hw_state { struct r300_state_atom vpt; /* viewport (1D98) */ struct r300_state_atom vap_cntl; + struct r300_state_atom vap_index_offset; /* 0x208c r5xx only */ struct r300_state_atom vof; /* VAP output format register 0x2090 */ struct r300_state_atom vte; /* (20B0) */ struct r300_state_atom vap_vf_max_vtx_indx; /* Maximum Vertex Indx Clamp (2134) */ @@ -473,7 +498,7 @@ struct r300_hw_state { struct r300_state_atom shade; struct r300_state_atom polygon_mode; struct r300_state_atom fogp; /* fog parameters (4294) */ - struct r300_state_atom unk429C; /* (429C) */ + struct r300_state_atom ga_soft_reset; /* (429C) */ struct r300_state_atom zbias_cntl; struct r300_state_atom zbs; /* zbias (42A4) */ struct r300_state_atom occlusion_cntl; @@ -487,6 +512,8 @@ struct r300_hw_state { struct r300_state_atom fp; /* fragment program cntl + nodes (4600) */ struct r300_state_atom fpt; /* texi - (4620) */ struct r300_state_atom us_out_fmt; /* (46A4) */ + struct r300_state_atom r500fp; /* r500 fp instructions */ + struct r300_state_atom r500fp_const; /* r500 fp constants */ struct r300_state_atom fpi[4]; /* fp instructions (46C0/47C0/48C0/49C0) */ struct r300_state_atom fogs; /* fog state (4BC0) */ struct r300_state_atom fogc; /* fog color (4BC8) */ @@ -767,6 +794,47 @@ struct r300_fragment_program { int max_temp_idx; + GLboolean WritesDepth; + GLuint optimization; +}; + +struct r500_fragment_program { + struct gl_fragment_program mesa_program; + + GLcontext *ctx; + GLboolean translated; + GLboolean error; + struct r300_pfs_compile_state *cs; + + struct { + GLuint inst0; + GLuint inst1; + GLuint inst2; + GLuint inst3; + GLuint inst4; + GLuint inst5; + } inst[512]; + /* TODO: This is magic! */ + + int temp_reg_offset; + + int inst_offset; + int inst_end; + + /* Hardware constants. + * Contains a pointer to the value. The destination of the pointer + * is supposed to be updated when GL state changes. + * Typically, this is either a pointer into + * gl_program_parameter_list::ParameterValues, or a pointer to a + * global constant (e.g. for sin/cos-approximation) + */ + const GLfloat *constant[PFS_NUM_CONST_REGS]; + int const_nr; + + int max_temp_idx; + + GLboolean writes_depth; + GLuint optimization; }; @@ -804,7 +872,7 @@ struct r300_state { */ struct r300_swtcl_info { GLuint RenderIndex; - + /** * Size of a hardware vertex. This is calculated when \c ::vertex_attrs is * installed in the Mesa state vector. diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index e7371133d34..2ea17ad0a7c 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -207,7 +207,10 @@ static void r300EmitVec(GLcontext * ctx, struct r300_dma_region *rvb, } } -static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, +#define DW_SIZE(x) ((inputs[tab[(x)]] << R300_DST_VEC_LOC_SHIFT) | \ + (attribptr[tab[(x)]]->size - 1) << R300_DATA_TYPE_0_SHIFT) + +GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, int *inputs, GLint * tab, GLuint nr) { GLuint i, dw; @@ -216,14 +219,15 @@ static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, for (i = 0; i < nr; i += 2) { /* make sure input is valid, would lockup the gpu */ assert(inputs[tab[i]] != -1); - dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1); + dw = (R300_SIGNED | DW_SIZE(i)); if (i + 1 == nr) { - dw |= R300_VAP_INPUT_ROUTE_END; + dw |= R300_LAST_VEC << R300_DATA_TYPE_0_SHIFT; } else { assert(inputs[tab[i + 1]] != -1); - dw |= (R300_INPUT_ROUTE_FLOAT | (inputs[tab[i + 1]] << 8) | (attribptr[tab[i + 1]]->size - 1)) << 16; + dw |= (R300_SIGNED | + DW_SIZE(i + 1)) << R300_DATA_TYPE_1_SHIFT; if (i + 2 == nr) { - dw |= (R300_VAP_INPUT_ROUTE_END << 16); + dw |= R300_LAST_VEC << R300_DATA_TYPE_1_SHIFT; } } dst[i >> 1] = dw; @@ -234,10 +238,10 @@ static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, static GLuint r300VAPInputRoute1Swizzle(int swizzle[4]) { - return (swizzle[0] << R300_INPUT_ROUTE_X_SHIFT) | - (swizzle[1] << R300_INPUT_ROUTE_Y_SHIFT) | - (swizzle[2] << R300_INPUT_ROUTE_Z_SHIFT) | - (swizzle[3] << R300_INPUT_ROUTE_W_SHIFT); + return (swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) | + (swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) | + (swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) | + (swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT); } GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr) @@ -245,9 +249,13 @@ GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr) GLuint i, dw; for (i = 0; i < nr; i += 2) { - dw = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE; + dw = (r300VAPInputRoute1Swizzle(swizzle[i]) | + ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | + R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE0_SHIFT; if (i + 1 < nr) { - dw |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE) << 16; + dw |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | + ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | + R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE1_SHIFT; } dst[i >> 1] = dw; } @@ -542,10 +550,10 @@ void r300EmitCacheFlush(r300ContextPtr rmesa) drm_radeon_cmd_header_t *cmd = NULL; reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0); - e32(RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS | - RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D); + e32(R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS | + R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D); - reg_start(ZB_ZCACHE_CTLSTAT, 0); - e32(ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE | - ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); + reg_start(R300_ZB_ZCACHE_CTLSTAT, 0); + e32(R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE | + R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); } diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index a6d69ec5ff8..e6a6df8c4c2 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -74,6 +74,20 @@ static inline uint32_t cmdvpu(int addr, int count) return cmd.u; } +static inline uint32_t cmdr500fp(int addr, int count, int type, int clamp) +{ + drm_r300_cmd_header_t cmd; + + cmd.r500fp.cmd_type = R300_CMD_R500FP; + cmd.r500fp.count = count; + cmd.r500fp.adrhi_flags = ((unsigned int)addr & 0x100) >> 8; + cmd.r500fp.adrhi_flags |= type ? R500FP_CONSTANT_TYPE : 0; + cmd.r500fp.adrhi_flags |= clamp ? R500FP_CONSTANT_CLAMP : 0; + cmd.r500fp.adrlo = ((unsigned int)addr & 0x00FF); + + return cmd.u; +} + static inline uint32_t cmdpacket3(int packet) { drm_r300_cmd_header_t cmd; @@ -166,6 +180,19 @@ static inline uint32_t cmdpacify(void) cmd[0].i = cmdvpu((dest), _n/4); \ } while (0); +#define r500fp_start_fragment(dest, length) \ + do { \ + int _n; \ + _n = (length); \ + cmd = (drm_radeon_cmd_header_t*) \ + r300AllocCmdBuf(rmesa, \ + (_n+1), \ + __FUNCTION__); \ + cmd_reserved = _n+1; \ + cmd_written =1; \ + cmd[0].i = cmdr500fp((dest), _n/6, 0, 0); \ + } while (0); + #define start_packet3(packet, count) \ { \ int _n; \ @@ -230,6 +257,8 @@ extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim); extern void r300EmitCacheFlush(r300ContextPtr rmesa); +extern GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, + int *inputs, GLint * tab, GLuint nr); extern GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr); extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead); extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead); diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index c664fb6562d..54b80d20a16 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -172,19 +172,19 @@ static const struct { int s_op; } r300_fpop[] = { /* *INDENT-OFF* */ - {"MAD", 3, R300_FPI0_OUTC_MAD, R300_FPI2_OUTA_MAD}, - {"DP3", 2, R300_FPI0_OUTC_DP3, R300_FPI2_OUTA_DP4}, - {"DP4", 2, R300_FPI0_OUTC_DP4, R300_FPI2_OUTA_DP4}, - {"MIN", 2, R300_FPI0_OUTC_MIN, R300_FPI2_OUTA_MIN}, - {"MAX", 2, R300_FPI0_OUTC_MAX, R300_FPI2_OUTA_MAX}, - {"CMP", 3, R300_FPI0_OUTC_CMP, R300_FPI2_OUTA_CMP}, - {"FRC", 1, R300_FPI0_OUTC_FRC, R300_FPI2_OUTA_FRC}, - {"EX2", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_EX2}, - {"LG2", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_LG2}, - {"RCP", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RCP}, - {"RSQ", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RSQ}, - {"REPL_ALPHA", 1, R300_FPI0_OUTC_REPL_ALPHA, PFS_INVAL}, - {"CMPH", 3, R300_FPI0_OUTC_CMPH, PFS_INVAL}, + {"MAD", 3, R300_ALU_OUTC_MAD, R300_ALU_OUTA_MAD}, + {"DP3", 2, R300_ALU_OUTC_DP3, R300_ALU_OUTA_DP4}, + {"DP4", 2, R300_ALU_OUTC_DP4, R300_ALU_OUTA_DP4}, + {"MIN", 2, R300_ALU_OUTC_MIN, R300_ALU_OUTA_MIN}, + {"MAX", 2, R300_ALU_OUTC_MAX, R300_ALU_OUTA_MAX}, + {"CMP", 3, R300_ALU_OUTC_CMP, R300_ALU_OUTA_CMP}, + {"FRC", 1, R300_ALU_OUTC_FRC, R300_ALU_OUTA_FRC}, + {"EX2", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_EX2}, + {"LG2", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_LG2}, + {"RCP", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_RCP}, + {"RSQ", 1, R300_ALU_OUTC_REPL_ALPHA, R300_ALU_OUTA_RSQ}, + {"REPL_ALPHA", 1, R300_ALU_OUTC_REPL_ALPHA, PFS_INVAL}, + {"CMPH", 3, R300_ALU_OUTC_CMPH, PFS_INVAL}, /* *INDENT-ON* */ }; @@ -209,17 +209,17 @@ static const struct r300_pfs_swizzle { GLuint flags; } v_swiz[] = { /* *INDENT-OFF* */ - {MAKE_SWZ3(X, Y, Z), R300_FPI0_ARGC_SRC0C_XYZ, 4, SLOT_SRC_VECTOR}, - {MAKE_SWZ3(X, X, X), R300_FPI0_ARGC_SRC0C_XXX, 4, SLOT_SRC_VECTOR}, - {MAKE_SWZ3(Y, Y, Y), R300_FPI0_ARGC_SRC0C_YYY, 4, SLOT_SRC_VECTOR}, - {MAKE_SWZ3(Z, Z, Z), R300_FPI0_ARGC_SRC0C_ZZZ, 4, SLOT_SRC_VECTOR}, - {MAKE_SWZ3(W, W, W), R300_FPI0_ARGC_SRC0A, 1, SLOT_SRC_SCALAR}, - {MAKE_SWZ3(Y, Z, X), R300_FPI0_ARGC_SRC0C_YZX, 1, SLOT_SRC_VECTOR}, - {MAKE_SWZ3(Z, X, Y), R300_FPI0_ARGC_SRC0C_ZXY, 1, SLOT_SRC_VECTOR}, - {MAKE_SWZ3(W, Z, Y), R300_FPI0_ARGC_SRC0CA_WZY, 1, SLOT_SRC_BOTH}, - {MAKE_SWZ3(ONE, ONE, ONE), R300_FPI0_ARGC_ONE, 0, 0}, - {MAKE_SWZ3(ZERO, ZERO, ZERO), R300_FPI0_ARGC_ZERO, 0, 0}, - {MAKE_SWZ3(HALF, HALF, HALF), R300_FPI0_ARGC_HALF, 0, 0}, + {MAKE_SWZ3(X, Y, Z), R300_ALU_ARGC_SRC0C_XYZ, 4, SLOT_SRC_VECTOR}, + {MAKE_SWZ3(X, X, X), R300_ALU_ARGC_SRC0C_XXX, 4, SLOT_SRC_VECTOR}, + {MAKE_SWZ3(Y, Y, Y), R300_ALU_ARGC_SRC0C_YYY, 4, SLOT_SRC_VECTOR}, + {MAKE_SWZ3(Z, Z, Z), R300_ALU_ARGC_SRC0C_ZZZ, 4, SLOT_SRC_VECTOR}, + {MAKE_SWZ3(W, W, W), R300_ALU_ARGC_SRC0A, 1, SLOT_SRC_SCALAR}, + {MAKE_SWZ3(Y, Z, X), R300_ALU_ARGC_SRC0C_YZX, 1, SLOT_SRC_VECTOR}, + {MAKE_SWZ3(Z, X, Y), R300_ALU_ARGC_SRC0C_ZXY, 1, SLOT_SRC_VECTOR}, + {MAKE_SWZ3(W, Z, Y), R300_ALU_ARGC_SRC0CA_WZY, 1, SLOT_SRC_BOTH}, + {MAKE_SWZ3(ONE, ONE, ONE), R300_ALU_ARGC_ONE, 0, 0}, + {MAKE_SWZ3(ZERO, ZERO, ZERO), R300_ALU_ARGC_ZERO, 0, 0}, + {MAKE_SWZ3(HALF, HALF, HALF), R300_ALU_ARGC_HALF, 0, 0}, {PFS_INVAL, 0, 0, 0}, /* *INDENT-ON* */ }; @@ -252,13 +252,13 @@ static const struct { GLuint flags; } s_swiz[] = { /* *INDENT-OFF* */ - {R300_FPI2_ARGA_SRC0C_X, 3, SLOT_SRC_VECTOR}, - {R300_FPI2_ARGA_SRC0C_Y, 3, SLOT_SRC_VECTOR}, - {R300_FPI2_ARGA_SRC0C_Z, 3, SLOT_SRC_VECTOR}, - {R300_FPI2_ARGA_SRC0A, 1, SLOT_SRC_SCALAR}, - {R300_FPI2_ARGA_ZERO, 0, 0}, - {R300_FPI2_ARGA_ONE, 0, 0}, - {R300_FPI2_ARGA_HALF, 0, 0} + {R300_ALU_ARGA_SRC0C_X, 3, SLOT_SRC_VECTOR}, + {R300_ALU_ARGA_SRC0C_Y, 3, SLOT_SRC_VECTOR}, + {R300_ALU_ARGA_SRC0C_Z, 3, SLOT_SRC_VECTOR}, + {R300_ALU_ARGA_SRC0A, 1, SLOT_SRC_SCALAR}, + {R300_ALU_ARGA_ZERO, 0, 0}, + {R300_ALU_ARGA_ONE, 0, 0}, + {R300_ALU_ARGA_HALF, 0, 0} /* *INDENT-ON* */ }; @@ -859,11 +859,12 @@ static int t_hw_dst(struct r300_fragment_program *fp, switch (index) { case FRAG_RESULT_COLR: fp->node[fp->cur_node].flags |= - R300_PFS_NODE_OUTPUT_COLOR; + R300_RGBA_OUT; break; case FRAG_RESULT_DEPR: + fp->WritesDepth = GL_TRUE; fp->node[fp->cur_node].flags |= - R300_PFS_NODE_OUTPUT_DEPTH; + R300_W_OUT; break; } return index; @@ -903,49 +904,59 @@ static void emit_tex(struct r300_fragment_program *fp, int hwsrc, hwdest; GLuint tempreg = 0; + /** + * Hardware uses [0..1]x[0..1] range for rectangle textures + * instead of [0..Width]x[0..Height]. + * Add a scaling instruction. + * + * \todo Refactor this once we have proper rewriting/optimization + * support for programs. + */ + if (opcode != R300_TEX_OP_KIL && fpi->TexSrcTarget == TEXTURE_RECT_INDEX) { + gl_state_index tokens[STATE_LENGTH] = { + STATE_INTERNAL, STATE_R300_TEXRECT_FACTOR, 0, 0, + 0 + }; + int factor_index; + GLuint factorreg; + + tokens[2] = unit; + factor_index = + _mesa_add_state_reference(fp->mesa_program.Base. + Parameters, tokens); + factorreg = + emit_const4fv(fp, + fp->mesa_program.Base.Parameters-> + ParameterValues[factor_index]); + tempreg = keep(get_temp_reg(fp)); + + emit_arith(fp, PFS_OP_MAD, tempreg, WRITEMASK_XYZW, + coord, factorreg, pfs_zero, 0); + + coord = tempreg; + } + + /* Texture operations do not support swizzles etc. in hardware, + * so emit an additional arithmetic operation if necessary. + */ + if (REG_GET_VSWZ(coord) != SWIZZLE_XYZ || + REG_GET_SSWZ(coord) != SWIZZLE_W || + coord & (REG_NEGV_MASK | REG_NEGS_MASK | REG_ABS_MASK)) { + assert(tempreg == 0); + tempreg = keep(get_temp_reg(fp)); + emit_arith(fp, PFS_OP_MAD, tempreg, WRITEMASK_XYZW, + coord, pfs_one, pfs_zero, 0); + coord = tempreg; + } + + /* Ensure correct node indirection */ uin = cs->used_in_node; din = cs->dest_in_node; /* Resolve source/dest to hardware registers */ - if (opcode != R300_FPITX_OP_KIL) { - if (fpi->TexSrcTarget == TEXTURE_RECT_INDEX) { - /** - * Hardware uses [0..1]x[0..1] range for rectangle textures - * instead of [0..Width]x[0..Height]. - * Add a scaling instruction. - * - * \todo Refactor this once we have proper rewriting/optimization - * support for programs. - */ - gl_state_index tokens[STATE_LENGTH] = { - STATE_INTERNAL, STATE_R300_TEXRECT_FACTOR, 0, 0, - 0 - }; - int factor_index; - GLuint factorreg; - - tokens[2] = unit; - factor_index = - _mesa_add_state_reference(fp->mesa_program.Base. - Parameters, tokens); - factorreg = - emit_const4fv(fp, - fp->mesa_program.Base.Parameters-> - ParameterValues[factor_index]); - tempreg = keep(get_temp_reg(fp)); - - emit_arith(fp, PFS_OP_MAD, tempreg, WRITEMASK_XYZW, - coord, factorreg, pfs_zero, 0); - - /* Ensure correct node indirection */ - uin = cs->used_in_node; - din = cs->dest_in_node; - - hwsrc = t_hw_src(fp, tempreg, GL_TRUE); - } else { - hwsrc = t_hw_src(fp, coord, GL_TRUE); - } + hwsrc = t_hw_src(fp, coord, GL_TRUE); + if (opcode != R300_TEX_OP_KIL) { dest = t_dst(fp, fpi->DstReg); /* r300 doesn't seem to be able to do TEX->output reg */ @@ -972,7 +983,6 @@ static void emit_tex(struct r300_fragment_program *fp, } else { hwdest = 0; unit = 0; - hwsrc = t_hw_src(fp, coord, GL_TRUE); } /* Indirection if source has been written in this node, or if the @@ -1007,11 +1017,10 @@ static void emit_tex(struct r300_fragment_program *fp, if (fp->cur_node == 0) fp->first_node_has_tex = 1; - fp->tex.inst[fp->tex.length++] = 0 | (hwsrc << R300_FPITX_SRC_SHIFT) - | (hwdest << R300_FPITX_DST_SHIFT) - | (unit << R300_FPITX_IMAGE_SHIFT) - /* not entirely sure about this */ - | (opcode << R300_FPITX_OPCODE_SHIFT); + fp->tex.inst[fp->tex.length++] = 0 | (hwsrc << R300_SRC_ADDR_SHIFT) + | (hwdest << R300_DST_ADDR_SHIFT) + | (unit << R300_TEX_ID_SHIFT) + | (opcode << R300_TEX_INST_SHIFT); cs->dest_in_node |= (1 << hwdest); if (REG_GET_TYPE(coord) != REG_TYPE_CONST) @@ -1228,17 +1237,17 @@ static int find_and_prepare_slot(struct r300_fragment_program *fp, } // Emit the source fetch code - fp->alu.inst[pos].inst1 &= ~R300_FPI1_SRC_MASK; + fp->alu.inst[pos].inst1 &= ~R300_ALU_SRC_MASK; fp->alu.inst[pos].inst1 |= - ((cs->slot[pos].vsrc[0] << R300_FPI1_SRC0C_SHIFT) | - (cs->slot[pos].vsrc[1] << R300_FPI1_SRC1C_SHIFT) | - (cs->slot[pos].vsrc[2] << R300_FPI1_SRC2C_SHIFT)); + ((cs->slot[pos].vsrc[0] << R300_ALU_SRC0C_SHIFT) | + (cs->slot[pos].vsrc[1] << R300_ALU_SRC1C_SHIFT) | + (cs->slot[pos].vsrc[2] << R300_ALU_SRC2C_SHIFT)); - fp->alu.inst[pos].inst3 &= ~R300_FPI3_SRC_MASK; + fp->alu.inst[pos].inst3 &= ~R300_ALU_SRC_MASK; fp->alu.inst[pos].inst3 |= - ((cs->slot[pos].ssrc[0] << R300_FPI3_SRC0A_SHIFT) | - (cs->slot[pos].ssrc[1] << R300_FPI3_SRC1A_SHIFT) | - (cs->slot[pos].ssrc[2] << R300_FPI3_SRC2A_SHIFT)); + ((cs->slot[pos].ssrc[0] << R300_ALU_SRC0A_SHIFT) | + (cs->slot[pos].ssrc[1] << R300_ALU_SRC1A_SHIFT) | + (cs->slot[pos].ssrc[2] << R300_ALU_SRC2A_SHIFT)); // Emit the argument selection code if (emit_vop) { @@ -1257,17 +1266,17 @@ static int find_and_prepare_slot(struct r300_fragment_program *fp, ARG_ABS : 0); } else { - swz[i] = R300_FPI0_ARGC_ZERO; + swz[i] = R300_ALU_ARGC_ZERO; } } fp->alu.inst[pos].inst0 &= - ~(R300_FPI0_ARG0C_MASK | R300_FPI0_ARG1C_MASK | - R300_FPI0_ARG2C_MASK); + ~(R300_ALU_ARG0C_MASK | R300_ALU_ARG1C_MASK | + R300_ALU_ARG2C_MASK); fp->alu.inst[pos].inst0 |= - (swz[0] << R300_FPI0_ARG0C_SHIFT) | (swz[1] << - R300_FPI0_ARG1C_SHIFT) - | (swz[2] << R300_FPI0_ARG2C_SHIFT); + (swz[0] << R300_ALU_ARG0C_SHIFT) | (swz[1] << + R300_ALU_ARG1C_SHIFT) + | (swz[2] << R300_ALU_ARG2C_SHIFT); } if (emit_sop) { @@ -1286,17 +1295,17 @@ static int find_and_prepare_slot(struct r300_fragment_program *fp, ARG_ABS : 0); } else { - swz[i] = R300_FPI2_ARGA_ZERO; + swz[i] = R300_ALU_ARGA_ZERO; } } fp->alu.inst[pos].inst2 &= - ~(R300_FPI2_ARG0A_MASK | R300_FPI2_ARG1A_MASK | - R300_FPI2_ARG2A_MASK); + ~(R300_ALU_ARG0A_MASK | R300_ALU_ARG1A_MASK | + R300_ALU_ARG2A_MASK); fp->alu.inst[pos].inst2 |= - (swz[0] << R300_FPI2_ARG0A_SHIFT) | (swz[1] << - R300_FPI2_ARG1A_SHIFT) - | (swz[2] << R300_FPI2_ARG2A_SHIFT); + (swz[0] << R300_ALU_ARG0A_SHIFT) | (swz[1] << + R300_ALU_ARG1A_SHIFT) + | (swz[2] << R300_ALU_ARG2A_SHIFT); } return pos; @@ -1333,9 +1342,9 @@ static void emit_arith(struct r300_fragment_program *fp, emit_vop = GL_FALSE; emit_sop = GL_FALSE; - if ((mask & WRITEMASK_XYZ) || vop == R300_FPI0_OUTC_DP3) + if ((mask & WRITEMASK_XYZ) || vop == R300_ALU_OUTC_DP3) emit_vop = GL_TRUE; - if ((mask & WRITEMASK_W) || vop == R300_FPI0_OUTC_REPL_ALPHA) + if ((mask & WRITEMASK_W) || vop == R300_ALU_OUTC_REPL_ALPHA) emit_sop = GL_TRUE; pos = @@ -1347,33 +1356,33 @@ static void emit_arith(struct r300_fragment_program *fp, hwdest = t_hw_dst(fp, dest, GL_FALSE, pos); /* Note: Side effects wrt register allocation */ if (flags & PFS_FLAG_SAT) { - vop |= R300_FPI0_OUTC_SAT; - sop |= R300_FPI2_OUTA_SAT; + vop |= R300_ALU_OUTC_CLAMP; + sop |= R300_ALU_OUTA_CLAMP; } - /* Throw the pieces together and get FPI0/1 */ + /* Throw the pieces together and get ALU/1 */ if (emit_vop) { fp->alu.inst[pos].inst0 |= vop; - fp->alu.inst[pos].inst1 |= hwdest << R300_FPI1_DSTC_SHIFT; + fp->alu.inst[pos].inst1 |= hwdest << R300_ALU_DSTC_SHIFT; if (REG_GET_TYPE(dest) == REG_TYPE_OUTPUT) { if (REG_GET_INDEX(dest) == FRAG_RESULT_COLR) { fp->alu.inst[pos].inst1 |= (mask & WRITEMASK_XYZ) << - R300_FPI1_DSTC_OUTPUT_MASK_SHIFT; + R300_ALU_DSTC_OUTPUT_MASK_SHIFT; } else assert(0); } else { fp->alu.inst[pos].inst1 |= (mask & WRITEMASK_XYZ) << - R300_FPI1_DSTC_REG_MASK_SHIFT; + R300_ALU_DSTC_REG_MASK_SHIFT; cs->hwtemps[hwdest].vector_valid = pos + 1; } } - /* And now FPI2/3 */ + /* And now ALU/3 */ if (emit_sop) { fp->alu.inst[pos].inst2 |= sop; @@ -1381,18 +1390,18 @@ static void emit_arith(struct r300_fragment_program *fp, if (REG_GET_TYPE(dest) == REG_TYPE_OUTPUT) { if (REG_GET_INDEX(dest) == FRAG_RESULT_COLR) { fp->alu.inst[pos].inst3 |= - (hwdest << R300_FPI3_DSTA_SHIFT) | - R300_FPI3_DSTA_OUTPUT; + (hwdest << R300_ALU_DSTA_SHIFT) | + R300_ALU_DSTA_OUTPUT; } else if (REG_GET_INDEX(dest) == FRAG_RESULT_DEPR) { fp->alu.inst[pos].inst3 |= - R300_FPI3_DSTA_DEPTH; + R300_ALU_DSTA_DEPTH; } else assert(0); } else { fp->alu.inst[pos].inst3 |= - (hwdest << R300_FPI3_DSTA_SHIFT) | - R300_FPI3_DSTA_REG; + (hwdest << R300_ALU_DSTA_SHIFT) | + R300_ALU_DSTA_REG; cs->hwtemps[hwdest].scalar_valid = pos + 1; } @@ -1708,7 +1717,7 @@ static GLboolean parse_program(struct r300_fragment_program *fp) src[0], undef, undef, flags); break; case OPCODE_KIL: - emit_tex(fp, fpi, R300_FPITX_OP_KIL); + emit_tex(fp, fpi, R300_TEX_OP_KIL); break; case OPCODE_LG2: src[0] = t_scalar_src(fp, fpi->SrcReg[0]); @@ -1943,13 +1952,13 @@ static GLboolean parse_program(struct r300_fragment_program *fp) src[0], pfs_one, negate(src[1]), flags); break; case OPCODE_TEX: - emit_tex(fp, fpi, R300_FPITX_OP_TEX); + emit_tex(fp, fpi, R300_TEX_OP_LD); break; case OPCODE_TXB: - emit_tex(fp, fpi, R300_FPITX_OP_TXB); + emit_tex(fp, fpi, R300_TEX_OP_TXB); break; case OPCODE_TXP: - emit_tex(fp, fpi, R300_FPITX_OP_TXP); + emit_tex(fp, fpi, R300_TEX_OP_TXP); break; case OPCODE_XPD:{ src[0] = t_src(fp, fpi->SrcReg[0]); @@ -2097,6 +2106,7 @@ static void init_program(r300ContextPtr r300, struct r300_fragment_program *fp) fp->translated = GL_FALSE; fp->error = GL_FALSE; fp->cs = cs = &(R300_CONTEXT(fp->ctx)->state.pfs_compile); + fp->WritesDepth = GL_FALSE; fp->tex.length = 0; fp->cur_node = 0; fp->first_node_has_tex = 0; @@ -2217,6 +2227,7 @@ static void update_params(struct r300_fragment_program *fp) void r300TranslateFragmentShader(r300ContextPtr r300, struct r300_fragment_program *fp) { + struct r300_pfs_compile_state *cs = NULL; if (!fp->translated) { @@ -2281,18 +2292,18 @@ static void dump_program(struct r300_fragment_program *fp) const char *instr; switch ((fp->tex. - inst[i] >> R300_FPITX_OPCODE_SHIFT) & + inst[i] >> R300_TEX_INST_SHIFT) & 15) { - case R300_FPITX_OP_TEX: + case R300_TEX_OP_LD: instr = "TEX"; break; - case R300_FPITX_OP_KIL: + case R300_TEX_OP_KIL: instr = "KIL"; break; - case R300_FPITX_OP_TXP: + case R300_TEX_OP_TXP: instr = "TXP"; break; - case R300_FPITX_OP_TXB: + case R300_TEX_OP_TXB: instr = "TXB"; break; default: @@ -2303,15 +2314,13 @@ static void dump_program(struct r300_fragment_program *fp) " %s t%i, %c%i, texture[%i] (%08x)\n", instr, (fp->tex. - inst[i] >> R300_FPITX_DST_SHIFT) & 31, - (fp->tex. - inst[i] & R300_FPITX_SRC_CONST) ? 'c' : + inst[i] >> R300_DST_ADDR_SHIFT) & 31, 't', (fp->tex. - inst[i] >> R300_FPITX_SRC_SHIFT) & 31, + inst[i] >> R300_SRC_ADDR_SHIFT) & 31, (fp->tex. - inst[i] & R300_FPITX_IMAGE_MASK) >> - R300_FPITX_IMAGE_SHIFT, + inst[i] & R300_TEX_ID_MASK) >> + R300_TEX_ID_SHIFT, fp->tex.inst[i]); } } @@ -2337,45 +2346,45 @@ static void dump_program(struct r300_fragment_program *fp) dstc[0] = 0; sprintf(flags, "%s%s%s", (fp->alu.inst[i]. - inst1 & R300_FPI1_DSTC_REG_X) ? "x" : "", + inst1 & R300_ALU_DSTC_REG_X) ? "x" : "", (fp->alu.inst[i]. - inst1 & R300_FPI1_DSTC_REG_Y) ? "y" : "", + inst1 & R300_ALU_DSTC_REG_Y) ? "y" : "", (fp->alu.inst[i]. - inst1 & R300_FPI1_DSTC_REG_Z) ? "z" : ""); + inst1 & R300_ALU_DSTC_REG_Z) ? "z" : ""); if (flags[0] != 0) { sprintf(dstc, "t%i.%s ", (fp->alu.inst[i]. - inst1 >> R300_FPI1_DSTC_SHIFT) & 31, + inst1 >> R300_ALU_DSTC_SHIFT) & 31, flags); } sprintf(flags, "%s%s%s", (fp->alu.inst[i]. - inst1 & R300_FPI1_DSTC_OUTPUT_X) ? "x" : "", + inst1 & R300_ALU_DSTC_OUTPUT_X) ? "x" : "", (fp->alu.inst[i]. - inst1 & R300_FPI1_DSTC_OUTPUT_Y) ? "y" : "", + inst1 & R300_ALU_DSTC_OUTPUT_Y) ? "y" : "", (fp->alu.inst[i]. - inst1 & R300_FPI1_DSTC_OUTPUT_Z) ? "z" : ""); + inst1 & R300_ALU_DSTC_OUTPUT_Z) ? "z" : ""); if (flags[0] != 0) { sprintf(tmp, "o%i.%s", (fp->alu.inst[i]. - inst1 >> R300_FPI1_DSTC_SHIFT) & 31, + inst1 >> R300_ALU_DSTC_SHIFT) & 31, flags); strcat(dstc, tmp); } dsta[0] = 0; - if (fp->alu.inst[i].inst3 & R300_FPI3_DSTA_REG) { + if (fp->alu.inst[i].inst3 & R300_ALU_DSTA_REG) { sprintf(dsta, "t%i.w ", (fp->alu.inst[i]. - inst3 >> R300_FPI3_DSTA_SHIFT) & 31); + inst3 >> R300_ALU_DSTA_SHIFT) & 31); } - if (fp->alu.inst[i].inst3 & R300_FPI3_DSTA_OUTPUT) { + if (fp->alu.inst[i].inst3 & R300_ALU_DSTA_OUTPUT) { sprintf(tmp, "o%i.w ", (fp->alu.inst[i]. - inst3 >> R300_FPI3_DSTA_SHIFT) & 31); + inst3 >> R300_ALU_DSTA_SHIFT) & 31); strcat(dsta, tmp); } - if (fp->alu.inst[i].inst3 & R300_FPI3_DSTA_DEPTH) { + if (fp->alu.inst[i].inst3 & R300_ALU_DSTA_DEPTH) { strcat(dsta, "Z"); } @@ -2395,19 +2404,19 @@ static void dump_program(struct r300_fragment_program *fp) d = regc & 31; if (d < 12) { switch (d % 4) { - case R300_FPI0_ARGC_SRC0C_XYZ: + case R300_ALU_ARGC_SRC0C_XYZ: sprintf(buf, "%s.xyz", srcc[d / 4]); break; - case R300_FPI0_ARGC_SRC0C_XXX: + case R300_ALU_ARGC_SRC0C_XXX: sprintf(buf, "%s.xxx", srcc[d / 4]); break; - case R300_FPI0_ARGC_SRC0C_YYY: + case R300_ALU_ARGC_SRC0C_YYY: sprintf(buf, "%s.yyy", srcc[d / 4]); break; - case R300_FPI0_ARGC_SRC0C_ZZZ: + case R300_ALU_ARGC_SRC0C_ZZZ: sprintf(buf, "%s.zzz", srcc[d / 4]); break; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 73efe49fc17..573aacf19a1 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -75,23 +75,23 @@ typedef struct r300_fragment_program_swizzle { #define SRC_STRIDE 6 #define NOP_INST0 ( \ - (R300_FPI0_OUTC_MAD) | \ - (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG0C_SHIFT) | \ - (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG1C_SHIFT) | \ - (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT)) + (R300_ALU_OUTC_MAD) | \ + (R300_ALU_ARGC_ZERO << R300_ALU_ARG0C_SHIFT) | \ + (R300_ALU_ARGC_ZERO << R300_ALU_ARG1C_SHIFT) | \ + (R300_ALU_ARGC_ZERO << R300_ALU_ARG2C_SHIFT)) #define NOP_INST1 ( \ - ((0 | SRC_CONST) << R300_FPI1_SRC0C_SHIFT) | \ - ((0 | SRC_CONST) << R300_FPI1_SRC1C_SHIFT) | \ - ((0 | SRC_CONST) << R300_FPI1_SRC2C_SHIFT)) + ((0 | SRC_CONST) << R300_ALU_SRC0C_SHIFT) | \ + ((0 | SRC_CONST) << R300_ALU_SRC1C_SHIFT) | \ + ((0 | SRC_CONST) << R300_ALU_SRC2C_SHIFT)) #define NOP_INST2 ( \ - (R300_FPI2_OUTA_MAD) | \ - (R300_FPI2_ARGA_ZERO << R300_FPI2_ARG0A_SHIFT) | \ - (R300_FPI2_ARGA_ZERO << R300_FPI2_ARG1A_SHIFT) | \ - (R300_FPI2_ARGA_ZERO << R300_FPI2_ARG2A_SHIFT)) + (R300_ALU_OUTA_MAD) | \ + (R300_ALU_ARGA_ZERO << R300_ALU_ARG0A_SHIFT) | \ + (R300_ALU_ARGA_ZERO << R300_ALU_ARG1A_SHIFT) | \ + (R300_ALU_ARGA_ZERO << R300_ALU_ARG2A_SHIFT)) #define NOP_INST3 ( \ - ((0 | SRC_CONST) << R300_FPI3_SRC0A_SHIFT) | \ - ((0 | SRC_CONST) << R300_FPI3_SRC1A_SHIFT) | \ - ((0 | SRC_CONST) << R300_FPI3_SRC2A_SHIFT)) + ((0 | SRC_CONST) << R300_ALU_SRC0A_SHIFT) | \ + ((0 | SRC_CONST) << R300_ALU_SRC1A_SHIFT) | \ + ((0 | SRC_CONST) << R300_ALU_SRC2A_SHIFT)) #define DRI_CONF_FP_OPTIMIZATION_SPEED 0 #define DRI_CONF_FP_OPTIMIZATION_QUALITY 1 @@ -117,42 +117,42 @@ typedef struct r300_fragment_program_swizzle { #define FP_SELC_MASK_XYZ 7 #define FP_SELC(destidx,regmask,outmask,src0,src1,src2) \ - (((destidx) << R300_FPI1_DSTC_SHIFT) | \ + (((destidx) << R300_ALU_DSTC_SHIFT) | \ (FP_SELC_MASK_##regmask << 23) | \ (FP_SELC_MASK_##outmask << 26) | \ - ((src0) << R300_FPI1_SRC0C_SHIFT) | \ - ((src1) << R300_FPI1_SRC1C_SHIFT) | \ - ((src2) << R300_FPI1_SRC2C_SHIFT)) + ((src0) << R300_ALU_SRC0C_SHIFT) | \ + ((src1) << R300_ALU_SRC1C_SHIFT) | \ + ((src2) << R300_ALU_SRC2C_SHIFT)) #define FP_SELA_MASK_NO 0 #define FP_SELA_MASK_W 1 #define FP_SELA(destidx,regmask,outmask,src0,src1,src2) \ - (((destidx) << R300_FPI3_DSTA_SHIFT) | \ + (((destidx) << R300_ALU_DSTA_SHIFT) | \ (FP_SELA_MASK_##regmask << 23) | \ (FP_SELA_MASK_##outmask << 24) | \ - ((src0) << R300_FPI3_SRC0A_SHIFT) | \ - ((src1) << R300_FPI3_SRC1A_SHIFT) | \ - ((src2) << R300_FPI3_SRC2A_SHIFT)) + ((src0) << R300_ALU_SRC0A_SHIFT) | \ + ((src1) << R300_ALU_SRC1A_SHIFT) | \ + ((src2) << R300_ALU_SRC2A_SHIFT)) /* Produce unshifted argument selectors */ -#define FP_ARGC(source) R300_FPI0_ARGC_##source -#define FP_ARGA(source) R300_FPI2_ARGA_##source +#define FP_ARGC(source) R300_ALU_ARGC_##source +#define FP_ARGA(source) R300_ALU_ARGA_##source #define FP_ABS(arg) ((arg) | (1 << 6)) #define FP_NEG(arg) ((arg) ^ (1 << 5)) /* Produce instruction dword */ #define FP_INSTRC(opcode,arg0,arg1,arg2) \ - (R300_FPI0_OUTC_##opcode | \ - ((arg0) << R300_FPI0_ARG0C_SHIFT) | \ - ((arg1) << R300_FPI0_ARG1C_SHIFT) | \ - ((arg2) << R300_FPI0_ARG2C_SHIFT)) + (R300_ALU_OUTC_##opcode | \ + ((arg0) << R300_ALU_ARG0C_SHIFT) | \ + ((arg1) << R300_ALU_ARG1C_SHIFT) | \ + ((arg2) << R300_ALU_ARG2C_SHIFT)) #define FP_INSTRA(opcode,arg0,arg1,arg2) \ - (R300_FPI2_OUTA_##opcode | \ - ((arg0) << R300_FPI2_ARG0A_SHIFT) | \ - ((arg1) << R300_FPI2_ARG1A_SHIFT) | \ - ((arg2) << R300_FPI2_ARG2A_SHIFT)) + (R300_ALU_OUTA_##opcode | \ + ((arg0) << R300_ALU_ARG0A_SHIFT) | \ + ((arg1) << R300_ALU_ARG1A_SHIFT) | \ + ((arg2) << R300_ALU_ARG2A_SHIFT)) #endif diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 1b405889c3c..b0225453d3d 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -118,7 +118,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) } R300_STATECHANGE(r300, zs); - reg_start(R300_RB3D_ZSTENCIL_CNTL_0, 2); + reg_start(R300_ZB_CNTL, 2); { uint32_t t1, t2; @@ -127,32 +127,32 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) t2 = 0x0; if (flags & CLEARBUFFER_DEPTH) { - t1 |= R300_RB3D_Z_WRITE_ONLY; + t1 |= R300_Z_ENABLE | R300_Z_WRITE_ENABLE; t2 |= - (R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); - } else { - t1 |= R300_RB3D_Z_DISABLED_1; // disable + (R300_ZS_ALWAYS << R300_Z_FUNC_SHIFT); + } else { //XXX + t1 |= R300_STENCIL_FRONT_BACK; // disable } if (flags & CLEARBUFFER_STENCIL) { - t1 |= R300_RB3D_STENCIL_ENABLE; + t1 |= R300_STENCIL_ENABLE; t2 |= (R300_ZS_ALWAYS << - R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | + R300_S_FRONT_FUNC_SHIFT) | (R300_ZS_REPLACE << - R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) | + R300_S_FRONT_SFAIL_OP_SHIFT) | (R300_ZS_REPLACE << - R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) | + R300_S_FRONT_ZPASS_OP_SHIFT) | (R300_ZS_REPLACE << - R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) | + R300_S_FRONT_ZFAIL_OP_SHIFT) | (R300_ZS_ALWAYS << - R300_RB3D_ZS1_BACK_FUNC_SHIFT) | + R300_S_BACK_FUNC_SHIFT) | (R300_ZS_REPLACE << - R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) | + R300_S_BACK_SFAIL_OP_SHIFT) | (R300_ZS_REPLACE << - R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) | + R300_S_BACK_ZPASS_OP_SHIFT) | (R300_ZS_REPLACE << - R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT); + R300_S_BACK_ZFAIL_OP_SHIFT); } e32(t1); @@ -186,10 +186,16 @@ static void r300EmitClearState(GLcontext * ctx) int cmd_written = 0; drm_radeon_cmd_header_t *cmd = NULL; int has_tcl = 1; + int is_r500 = 0; + GLuint vap_cntl; if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) has_tcl = 0; + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + is_r500 = 1; + + /* FIXME: the values written to R300_VAP_INPUT_ROUTE_0_0 and * R300_VAP_INPUT_ROUTE_0_1 are in fact known, however, the values are * quite complex; see the functions in r300_emit.c. @@ -199,25 +205,38 @@ static void r300EmitClearState(GLcontext * ctx) * these registers, as well as the actual values used for rendering. */ R300_STATECHANGE(r300, vir[0]); - reg_start(R300_VAP_INPUT_ROUTE_0_0, 0); + reg_start(R300_VAP_PROG_STREAM_CNTL_0, 0); if (!has_tcl) - e32(0x22030003); + e32(((((0 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_0_SHIFT) | + ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT))); else - e32(0x21030003); + e32(((((0 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_0_SHIFT) | + ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT))); /* disable fog */ R300_STATECHANGE(r300, fogs); - reg_start(FG_FOG_BLEND, 0); + reg_start(R300_FG_FOG_BLEND, 0); e32(0x0); R300_STATECHANGE(r300, vir[1]); - reg_start(R300_VAP_INPUT_ROUTE_1_0, 0); - e32(0xF688F688); + reg_start(R300_VAP_PROG_STREAM_CNTL_EXT_0, 0); + e32(((((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | + (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | + (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | + (R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) | + ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) + << R300_SWIZZLE0_SHIFT) | + (((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | + (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | + (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | + (R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) | + ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) + << R300_SWIZZLE1_SHIFT))); /* R300_VAP_INPUT_CNTL_0, R300_VAP_INPUT_CNTL_1 */ R300_STATECHANGE(r300, vic); - reg_start(R300_VAP_INPUT_CNTL_0, 1); - e32(R300_INPUT_CNTL_0_COLOR); + reg_start(R300_VAP_VTX_STATE_CNTL, 1); + e32((R300_SEL_USER_COLOR_0 << R300_COLOR_0_ASSEMBLY_SHIFT)); e32(R300_INPUT_CNTL_POS | R300_INPUT_CNTL_COLOR | R300_INPUT_CNTL_TC0); R300_STATECHANGE(r300, vte); @@ -229,7 +248,7 @@ static void r300EmitClearState(GLcontext * ctx) R300_VPORT_Z_OFFSET_ENA); e32(0x8); - reg_start(R300_VAP_PSC_SGN_NORM_CNTL, SGN_NORM_ZERO); + reg_start(R300_VAP_PSC_SGN_NORM_CNTL, 0); e32(0xaaaaaaaa); R300_STATECHANGE(r300, vof); @@ -252,7 +271,7 @@ static void r300EmitClearState(GLcontext * ctx) efloat(0.0); R300_STATECHANGE(r300, at); - reg_start(FG_ALPHA_FUNC, 0); + reg_start(R300_FG_ALPHA_FUNC, 0); e32(0x0); R300_STATECHANGE(r300, bld); @@ -263,7 +282,7 @@ static void r300EmitClearState(GLcontext * ctx) if (has_tcl) { R300_STATECHANGE(r300, vap_clip_cntl); reg_start(R300_VAP_CLIP_CNTL, 0); - e32(R300_221C_CLEAR); + e32(R300_PS_UCP_MODE_CLIP_AS_TRIFAN | R300_CLIP_DISABLE); } R300_STATECHANGE(r300, ps); @@ -271,59 +290,169 @@ static void r300EmitClearState(GLcontext * ctx) e32(((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) | ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT)); - R300_STATECHANGE(r300, ri); - reg_start(R300_RS_IP_0, 8); - for (i = 0; i < 8; ++i) { - e32(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3)); + if (!is_r500) { + R300_STATECHANGE(r300, ri); + reg_start(R300_RS_IP_0, 7); + for (i = 0; i < 8; ++i) { + e32(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3)); + } + + R300_STATECHANGE(r300, rc); + /* The second constant is needed to get glxgears display anything .. */ + reg_start(R300_RS_COUNT, 1); + e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN); + e32(0x0); + + R300_STATECHANGE(r300, rr); + reg_start(R300_RS_INST_0, 0); + e32(R300_RS_INST_COL_CN_WRITE); + } else { + + R300_STATECHANGE(r300, ri); + reg_start(R500_RS_IP_0, 7); + for (i = 0; i < 8; ++i) { + e32((R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) | + (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT)); + } + + R300_STATECHANGE(r300, rc); + /* The second constant is needed to get glxgears display anything .. */ + reg_start(R300_RS_COUNT, 1); + e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN); + e32(0x0); + + R300_STATECHANGE(r300, rr); + reg_start(R500_RS_INST_0, 0); + e32(R500_RS_INST_COL_CN_WRITE); + } - R300_STATECHANGE(r300, rc); - /* The second constant is needed to get glxgears display anything .. */ - reg_start(R300_RS_COUNT, 1); - e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN); - e32(0x0); + if (!is_r500) { + R300_STATECHANGE(r300, fp); + reg_start(R300_US_CONFIG, 2); + e32(0x0); + e32(0x0); + e32(0x0); + reg_start(R300_US_CODE_ADDR_0, 3); + e32(0x0); + e32(0x0); + e32(0x0); + e32(R300_RGBA_OUT); - R300_STATECHANGE(r300, rr); - reg_start(R300_RS_INST_0, 0); - e32(R300_RS_INST_COL_CN_WRITE); + R300_STATECHANGE(r300, fpi[0]); + R300_STATECHANGE(r300, fpi[1]); + R300_STATECHANGE(r300, fpi[2]); + R300_STATECHANGE(r300, fpi[3]); - R300_STATECHANGE(r300, fp); - reg_start(R300_PFS_CNTL_0, 2); - e32(0x0); - e32(0x0); - e32(0x0); - reg_start(R300_PFS_NODE_0, 3); - e32(0x0); - e32(0x0); - e32(0x0); - e32(R300_PFS_NODE_OUTPUT_COLOR); + reg_start(R300_US_ALU_RGB_INST_0, 0); + e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO))); - R300_STATECHANGE(r300, fpi[0]); - R300_STATECHANGE(r300, fpi[1]); - R300_STATECHANGE(r300, fpi[2]); - R300_STATECHANGE(r300, fpi[3]); + reg_start(R300_US_ALU_RGB_ADDR_0, 0); + e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0)); - reg_start(R300_PFS_INSTR0_0, 0); - e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO))); + reg_start(R300_US_ALU_ALPHA_INST_0, 0); + e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO))); - reg_start(R300_PFS_INSTR1_0, 0); - e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0)); + reg_start(R300_US_ALU_ALPHA_ADDR_0, 0); + e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0)); + } else { + R300_STATECHANGE(r300, fp); + reg_start(R500_US_CONFIG, 1); + e32(R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO); + e32(0x0); + reg_start(R500_US_CODE_ADDR, 2); + e32(R500_US_CODE_START_ADDR(0) | R500_US_CODE_END_ADDR(1)); + e32(R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(1)); + e32(R500_US_CODE_OFFSET_ADDR(0)); + + R300_STATECHANGE(r300, r500fp); + r500fp_start_fragment(0, 6); + + e32(R500_INST_TYPE_OUT | + R500_INST_TEX_SEM_WAIT | + R500_INST_LAST | + R500_INST_RGB_OMASK_R | + R500_INST_RGB_OMASK_G | + R500_INST_RGB_OMASK_B | + R500_INST_ALPHA_OMASK | + R500_INST_RGB_CLAMP | + R500_INST_ALPHA_CLAMP); + + e32(R500_RGB_ADDR0(0) | + R500_RGB_ADDR1(0) | + R500_RGB_ADDR1_CONST | + R500_RGB_ADDR2(0) | + R500_RGB_ADDR2_CONST); + + e32(R500_ALPHA_ADDR0(0) | + R500_ALPHA_ADDR1(0) | + R500_ALPHA_ADDR1_CONST | + R500_ALPHA_ADDR2(0) | + R500_ALPHA_ADDR2_CONST); + + e32(R500_ALU_RGB_SEL_A_SRC0 | + R500_ALU_RGB_R_SWIZ_A_R | + R500_ALU_RGB_G_SWIZ_A_G | + R500_ALU_RGB_B_SWIZ_A_B | + R500_ALU_RGB_SEL_B_SRC0 | + R500_ALU_RGB_R_SWIZ_B_R | + R500_ALU_RGB_B_SWIZ_B_G | + R500_ALU_RGB_G_SWIZ_B_B); + + e32(R500_ALPHA_OP_CMP | + R500_ALPHA_SWIZ_A_A | + R500_ALPHA_SWIZ_B_A); + + e32(R500_ALU_RGBA_OP_CMP | + R500_ALU_RGBA_R_SWIZ_0 | + R500_ALU_RGBA_G_SWIZ_0 | + R500_ALU_RGBA_B_SWIZ_0 | + R500_ALU_RGBA_A_SWIZ_0); + } - reg_start(R300_PFS_INSTR2_0, 0); - e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO))); + reg_start(R300_VAP_PVS_STATE_FLUSH_REG, 0); + e32(0x00000000); + if (has_tcl) { + vap_cntl = ((10 << R300_PVS_NUM_SLOTS_SHIFT) | + (5 << R300_PVS_NUM_CNTLRS_SHIFT) | + (12 << R300_VF_MAX_VTX_NUM_SHIFT)); + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + vap_cntl |= R500_TCL_STATE_OPTIMIZATION; + } else + vap_cntl = ((10 << R300_PVS_NUM_SLOTS_SHIFT) | + (5 << R300_PVS_NUM_CNTLRS_SHIFT) | + (5 << R300_VF_MAX_VTX_NUM_SHIFT)); + + if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV515) + vap_cntl |= (2 << R300_PVS_NUM_FPUS_SHIFT); + else if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530) || + (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV560)) + vap_cntl |= (5 << R300_PVS_NUM_FPUS_SHIFT); + else if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R420) + vap_cntl |= (6 << R300_PVS_NUM_FPUS_SHIFT); + else if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R520) || + (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R580) || + (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV570)) + vap_cntl |= (8 << R300_PVS_NUM_FPUS_SHIFT); + else + vap_cntl |= (4 << R300_PVS_NUM_FPUS_SHIFT); - reg_start(R300_PFS_INSTR3_0, 0); - e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0)); + R300_STATECHANGE(rmesa, vap_cntl); + reg_start(R300_VAP_CNTL, 0); + e32(vap_cntl); if (has_tcl) { R300_STATECHANGE(r300, pvs); - reg_start(R300_VAP_PVS_CNTL_1, 2); - - e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | - (0 << R300_PVS_CNTL_1_POS_END_SHIFT) | - (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT)); - e32(0x0); - e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT); + reg_start(R300_VAP_PVS_CODE_CNTL_0, 2); + + e32((0 << R300_PVS_FIRST_INST_SHIFT) | + (0 << R300_PVS_XYZW_VALID_INST_SHIFT) | + (1 << R300_PVS_LAST_INST_SHIFT)); + e32((0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | + (0 << R300_PVS_MAX_CONST_ADDR_SHIFT)); + e32(1 << R300_PVS_LAST_VTX_SRC_INST_SHIFT); R300_STATECHANGE(r300, vpi); vsf_start_fragment(0x0, 8); diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 2200cec6abe..21e1dc29de7 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -67,9 +67,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Vertex Array Processing (VAP) Control - * Stolen from r200 code from Christoph Brill (It's a guess!) */ #define R300_VAP_CNTL 0x2080 +# define R300_PVS_NUM_SLOTS_SHIFT 0 +# define R300_PVS_NUM_CNTLRS_SHIFT 4 +# define R300_PVS_NUM_FPUS_SHIFT 8 +# define R300_VF_MAX_VTX_NUM_SHIFT 18 +# define R300_GL_CLIP_SPACE_DEF (0 << 22) +# define R300_DX_CLIP_SPACE_DEF (1 << 22) +# define R500_TCL_STATE_OPTIMIZATION (1 << 23) /* This register is written directly and also starts data section * in many 3d CP_PACKET3's @@ -106,6 +112,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* number of vertices */ # define R300_VAP_VF_CNTL__NUM_VERTICES__SHIFT 16 +#define R500_VAP_INDEX_OFFSET 0x208c + #define R300_VAP_OUTPUT_VTX_FMT_0 0x2090 # define R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT (1<<0) # define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT (1<<1) @@ -125,24 +133,23 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_VAP_OUTPUT_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT 15 # define R300_VAP_OUTPUT_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18 # define R300_VAP_OUTPUT_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21 -# define R300_VAP_OUTPUT_VTX_FMT_1__NOT_PRESENT (1<<0) -# define R300_VAP_OUTPUT_VTX_FMT_1__1_COMPONENT (1<<1) -# define R300_VAP_OUTPUT_VTX_FMT_1__2_COMPONENTS (1<<2) -# define R300_VAP_OUTPUT_VTX_FMT_1__3_COMPONENTS (1<<3) -# define R300_VAP_OUTPUT_VTX_FMT_1__4_COMPONENTS (1<<4) +# define R300_VAP_OUTPUT_VTX_FMT_1__NOT_PRESENT 0 +# define R300_VAP_OUTPUT_VTX_FMT_1__1_COMPONENT 1 +# define R300_VAP_OUTPUT_VTX_FMT_1__2_COMPONENTS 2 +# define R300_VAP_OUTPUT_VTX_FMT_1__3_COMPONENTS 3 +# define R300_VAP_OUTPUT_VTX_FMT_1__4_COMPONENTS 4 #define R300_SE_VTE_CNTL 0x20b0 -# define R300_VPORT_X_SCALE_ENA 0x00000001 -# define R300_VPORT_X_OFFSET_ENA 0x00000002 -# define R300_VPORT_Y_SCALE_ENA 0x00000004 -# define R300_VPORT_Y_OFFSET_ENA 0x00000008 -# define R300_VPORT_Z_SCALE_ENA 0x00000010 -# define R300_VPORT_Z_OFFSET_ENA 0x00000020 -# define R300_VTX_XY_FMT 0x00000100 -# define R300_VTX_Z_FMT 0x00000200 -# define R300_VTX_W0_FMT 0x00000400 -# define R300_VTX_W0_NORMALIZE 0x00000800 -# define R300_VTX_ST_DENORMALIZED 0x00001000 +# define R300_VPORT_X_SCALE_ENA (1 << 0) +# define R300_VPORT_X_OFFSET_ENA (1 << 1) +# define R300_VPORT_Y_SCALE_ENA (1 << 2) +# define R300_VPORT_Y_OFFSET_ENA (1 << 3) +# define R300_VPORT_Z_SCALE_ENA (1 << 4) +# define R300_VPORT_Z_OFFSET_ENA (1 << 5) +# define R300_VTX_XY_FMT (1 << 8) +# define R300_VTX_Z_FMT (1 << 9) +# define R300_VTX_W0_FMT (1 << 10) +# define R300_SERIAL_PROC_ENA (1 << 11) /* BEGIN: Vertex data assembly - lots of uncertainties */ @@ -211,27 +218,31 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Always set COMPONENTS_4 in immediate mode. */ -#define R300_VAP_INPUT_ROUTE_0_0 0x2150 -# define R300_INPUT_ROUTE_COMPONENTS_1 (0 << 0) -# define R300_INPUT_ROUTE_COMPONENTS_2 (1 << 0) -# define R300_INPUT_ROUTE_COMPONENTS_3 (2 << 0) -# define R300_INPUT_ROUTE_COMPONENTS_4 (3 << 0) -# define R300_INPUT_ROUTE_COMPONENTS_RGBA (4 << 0) /* GUESS */ -# define R300_VAP_INPUT_ROUTE_IDX_SHIFT 8 -# define R300_VAP_INPUT_ROUTE_IDX_MASK (31 << 8) /* GUESS */ -# define R300_VAP_INPUT_ROUTE_END (1 << 13) -# define R300_INPUT_ROUTE_IMMEDIATE_MODE (0 << 14) /* GUESS */ -# define R300_INPUT_ROUTE_FLOAT (1 << 14) /* GUESS */ -# define R300_INPUT_ROUTE_UNSIGNED_BYTE (2 << 14) /* GUESS */ -# define R300_INPUT_ROUTE_FLOAT_COLOR (3 << 14) /* GUESS */ -#define R300_VAP_INPUT_ROUTE_0_1 0x2154 -#define R300_VAP_INPUT_ROUTE_0_2 0x2158 -#define R300_VAP_INPUT_ROUTE_0_3 0x215C -#define R300_VAP_INPUT_ROUTE_0_4 0x2160 -#define R300_VAP_INPUT_ROUTE_0_5 0x2164 -#define R300_VAP_INPUT_ROUTE_0_6 0x2168 -#define R300_VAP_INPUT_ROUTE_0_7 0x216C - +#define R300_VAP_PROG_STREAM_CNTL_0 0x2150 +# define R300_DATA_TYPE_0_SHIFT 0 +# define R300_DATA_TYPE_FLOAT_1 0 +# define R300_DATA_TYPE_FLOAT_2 1 +# define R300_DATA_TYPE_FLOAT_3 2 +# define R300_DATA_TYPE_FLOAT_4 3 +# define R300_DATA_TYPE_BYTE 4 +# define R300_DATA_TYPE_D3DCOLOR 5 +# define R300_DATA_TYPE_SHORT_2 6 +# define R300_DATA_TYPE_SHORT_4 7 +# define R300_DATA_TYPE_VECTOR_3_TTT 8 +# define R300_DATA_TYPE_VECTOR_3_EET 9 +# define R300_SKIP_DWORDS_SHIFT 4 +# define R300_DST_VEC_LOC_SHIFT 8 +# define R300_LAST_VEC (1 << 13) +# define R300_SIGNED (1 << 14) +# define R300_NORMALIZE (1 << 15) +# define R300_DATA_TYPE_1_SHIFT 16 +#define R300_VAP_PROG_STREAM_CNTL_1 0x2154 +#define R300_VAP_PROG_STREAM_CNTL_2 0x2158 +#define R300_VAP_PROG_STREAM_CNTL_3 0x215C +#define R300_VAP_PROG_STREAM_CNTL_4 0x2160 +#define R300_VAP_PROG_STREAM_CNTL_5 0x2164 +#define R300_VAP_PROG_STREAM_CNTL_6 0x2168 +#define R300_VAP_PROG_STREAM_CNTL_7 0x216C /* gap */ /* Notes: @@ -239,9 +250,26 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * if vertex program uses only position, fglrx will set normal, too * - INPUT_CNTL_0_COLOR and INPUT_CNTL_COLOR bits are always equal. */ -#define R300_VAP_INPUT_CNTL_0 0x2180 -# define R300_INPUT_CNTL_0_COLOR 0x00000001 -#define R300_VAP_INPUT_CNTL_1 0x2184 +#define R300_VAP_VTX_STATE_CNTL 0x2180 +# define R300_COLOR_0_ASSEMBLY_SHIFT 0 +# define R300_SEL_COLOR 0 +# define R300_SEL_USER_COLOR_0 1 +# define R300_SEL_USER_COLOR_1 2 +# define R300_COLOR_1_ASSEMBLY_SHIFT 2 +# define R300_COLOR_2_ASSEMBLY_SHIFT 4 +# define R300_COLOR_3_ASSEMBLY_SHIFT 6 +# define R300_COLOR_4_ASSEMBLY_SHIFT 8 +# define R300_COLOR_5_ASSEMBLY_SHIFT 10 +# define R300_COLOR_6_ASSEMBLY_SHIFT 12 +# define R300_COLOR_7_ASSEMBLY_SHIFT 14 +# define R300_UPDATE_USER_COLOR_0_ENA (1 << 16) + +/* + * Each bit in this field applies to the corresponding vector in the VSM + * memory (i.e. Bit 0 applies to VECTOR_0 (POSITION), etc.). If the bit + * is set, then the corresponding 4-Dword Vector is output into the Vertex Stream. + */ +#define R300_VAP_VSM_VTX_ASSM 0x2184 # define R300_INPUT_CNTL_POS 0x00000001 # define R300_INPUT_CNTL_NORMAL 0x00000002 # define R300_INPUT_CNTL_COLOR 0x00000004 @@ -269,26 +297,40 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * mode, the swizzling pattern is e.g. used to set zw components in texture * coordinates with only tweo components. */ -#define R300_VAP_INPUT_ROUTE_1_0 0x21E0 +#define R300_VAP_PROG_STREAM_CNTL_EXT_0 0x21e0 +# define R300_SWIZZLE0_SHIFT 0 +# define R300_SWIZZLE_SELECT_X_SHIFT 0 +# define R300_SWIZZLE_SELECT_Y_SHIFT 3 +# define R300_SWIZZLE_SELECT_Z_SHIFT 6 +# define R300_SWIZZLE_SELECT_W_SHIFT 9 + +# define R300_SWIZZLE_SELECT_X 0 +# define R300_SWIZZLE_SELECT_Y 1 +# define R300_SWIZZLE_SELECT_Z 2 +# define R300_SWIZZLE_SELECT_W 3 +# define R300_SWIZZLE_SELECT_FP_ZERO 4 +# define R300_SWIZZLE_SELECT_FP_ONE 5 +/* alternate forms for r300_emit.c */ # define R300_INPUT_ROUTE_SELECT_X 0 # define R300_INPUT_ROUTE_SELECT_Y 1 # define R300_INPUT_ROUTE_SELECT_Z 2 # define R300_INPUT_ROUTE_SELECT_W 3 # define R300_INPUT_ROUTE_SELECT_ZERO 4 # define R300_INPUT_ROUTE_SELECT_ONE 5 -# define R300_INPUT_ROUTE_SELECT_MASK 7 -# define R300_INPUT_ROUTE_X_SHIFT 0 -# define R300_INPUT_ROUTE_Y_SHIFT 3 -# define R300_INPUT_ROUTE_Z_SHIFT 6 -# define R300_INPUT_ROUTE_W_SHIFT 9 -# define R300_INPUT_ROUTE_ENABLE (15 << 12) -#define R300_VAP_INPUT_ROUTE_1_1 0x21E4 -#define R300_VAP_INPUT_ROUTE_1_2 0x21E8 -#define R300_VAP_INPUT_ROUTE_1_3 0x21EC -#define R300_VAP_INPUT_ROUTE_1_4 0x21F0 -#define R300_VAP_INPUT_ROUTE_1_5 0x21F4 -#define R300_VAP_INPUT_ROUTE_1_6 0x21F8 -#define R300_VAP_INPUT_ROUTE_1_7 0x21FC + +# define R300_WRITE_ENA_SHIFT 12 +# define R300_WRITE_ENA_X 1 +# define R300_WRITE_ENA_Y 2 +# define R300_WRITE_ENA_Z 4 +# define R300_WRITE_ENA_W 8 +# define R300_SWIZZLE1_SHIFT 16 +#define R300_VAP_PROG_STREAM_CNTL_EXT_1 0x21e4 +#define R300_VAP_PROG_STREAM_CNTL_EXT_2 0x21e8 +#define R300_VAP_PROG_STREAM_CNTL_EXT_3 0x21ec +#define R300_VAP_PROG_STREAM_CNTL_EXT_4 0x21f0 +#define R300_VAP_PROG_STREAM_CNTL_EXT_5 0x21f4 +#define R300_VAP_PROG_STREAM_CNTL_EXT_6 0x21f8 +#define R300_VAP_PROG_STREAM_CNTL_EXT_7 0x21fc /* END: Vertex data assembly */ @@ -320,25 +362,20 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Multiple vertex programs and parameter sets can be loaded at once, * which could explain the size discrepancy. */ -#define R300_VAP_PVS_UPLOAD_ADDRESS 0x2200 -# define R300_PVS_UPLOAD_PROGRAM 0x00000000 -/* gap */ -# define R300_PVS_UPLOAD_PARAMETERS 0x00000200 -/* gap */ -# define R300_PVS_UPLOAD_CLIP_PLANE0 0x00000400 -# define R300_PVS_UPLOAD_CLIP_PLANE1 0x00000401 -# define R300_PVS_UPLOAD_CLIP_PLANE2 0x00000402 -# define R300_PVS_UPLOAD_CLIP_PLANE3 0x00000403 -# define R300_PVS_UPLOAD_CLIP_PLANE4 0x00000404 -# define R300_PVS_UPLOAD_CLIP_PLANE5 0x00000405 -# define R300_PVS_UPLOAD_POINTSIZE 0x00000406 - -# define R500_PVS_UPLOAD_CLIP_PLANE0 0x00000600 -# define R500_PVS_UPLOAD_CLIP_PLANE1 0x00000601 -# define R500_PVS_UPLOAD_CLIP_PLANE2 0x00000602 -# define R500_PVS_UPLOAD_CLIP_PLANE3 0x00000603 -# define R500_PVS_UPLOAD_CLIP_PLANE4 0x00000604 -# define R500_PVS_UPLOAD_CLIP_PLANE5 0x00000605 +#define R300_VAP_PVS_VECTOR_INDX_REG 0x2200 +# define R300_PVS_CODE_START 0 +# define R300_MAX_PVS_CODE_LINES 256 +# define R500_MAX_PVS_CODE_LINES 1024 +# define R300_PVS_CONST_START 512 +# define R500_PVS_CONST_START 1024 +# define R300_MAX_PVS_CONST_VECS 256 +# define R500_MAX_PVS_CONST_VECS 1024 +# define R300_PVS_UCP_START 1024 +# define R500_PVS_UCP_START 1536 +# define R300_POINT_VPORT_SCALE_OFFSET 1030 +# define R500_POINT_VPORT_SCALE_OFFSET 1542 +# define R300_POINT_GEN_TEX_OFFSET 1031 +# define R500_POINT_GEN_TEX_OFFSET 1543 /* * These are obsolete defines form r300_context.h, but they might give some @@ -373,9 +410,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * See bug #9871. http://bugs.freedesktop.org/attachment.cgi?id=10672&action=view */ #define R300_VAP_CLIP_CNTL 0x221C -# define R300_221C_NORMAL 0x00000000 -# define R300_221C_CLEAR 0x0001C000 -#define R300_VAP_UCP_ENABLE_0 (1 << 0) +# define R300_VAP_UCP_ENABLE_0 (1 << 0) +# define R300_VAP_UCP_ENABLE_1 (1 << 1) +# define R300_VAP_UCP_ENABLE_2 (1 << 2) +# define R300_VAP_UCP_ENABLE_3 (1 << 3) +# define R300_VAP_UCP_ENABLE_4 (1 << 4) +# define R300_VAP_UCP_ENABLE_5 (1 << 5) +# define R300_PS_UCP_MODE_DIST_COP (0 << 14) +# define R300_PS_UCP_MODE_RADIUS_COP (1 << 14) +# define R300_PS_UCP_MODE_RADIUS_COP_CLIP (2 << 14) +# define R300_PS_UCP_MODE_CLIP_AS_TRIFAN (3 << 14) +# define R300_CLIP_DISABLE (1 << 16) +# define R300_UCP_CULL_ONLY_ENABLE (1 << 17) +# define R300_BOUNDARY_EDGE_FLAG_ENABLE (1 << 18) +# define R500_COLOR2_IS_TEXTURE (1 << 20) +# define R500_COLOR3_IS_TEXTURE (1 << 21) /* These seem to be per-pixel and per-vertex X and Y clipping planes. The first * plane is per-pixel and the second plane is per-vertex. @@ -384,10 +433,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * * These registers are called X_QUAD0_1_FL to X_QUAD0_4_FL by glxtest. */ -#define R300_VAP_CLIP_X_0 0x2220 -#define R300_VAP_CLIP_X_1 0x2224 -#define R300_VAP_CLIP_Y_0 0x2228 -#define R300_VAP_CLIP_Y_1 0x222c +#define R300_VAP_GB_VERT_CLIP_ADJ 0x2220 +#define R300_VAP_GB_VERT_DISC_ADJ 0x2224 +#define R300_VAP_GB_HORZ_CLIP_ADJ 0x2228 +#define R300_VAP_GB_HORZ_DISC_ADJ 0x222c /* gap */ @@ -396,7 +445,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Therefore, I suspect writing zero to 0x2284 synchronizes the engine and * avoids bugs caused by still running shaders reading bad data from memory. */ -#define R300_VAP_PVS_WAITIDLE 0x2284 /* GUESS */ +#define R300_VAP_PVS_STATE_FLUSH_REG 0x2284 /* This register is used to define the number of core clocks to wait for a * vertex to be received by the VAP input controller (while the primitive @@ -426,17 +475,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * is sometimes accepted other instruction that have no relationship with * position calculations. */ -#define R300_VAP_PVS_CNTL_1 0x22D0 -# define R300_PVS_CNTL_1_PROGRAM_START_SHIFT 0 -# define R300_PVS_CNTL_1_POS_END_SHIFT 10 -# define R300_PVS_CNTL_1_PROGRAM_END_SHIFT 20 +#define R300_VAP_PVS_CODE_CNTL_0 0x22D0 +# define R300_PVS_FIRST_INST_SHIFT 0 +# define R300_PVS_XYZW_VALID_INST_SHIFT 10 +# define R300_PVS_LAST_INST_SHIFT 20 /* Addresses are relative the the vertex program parameters area. */ -#define R300_VAP_PVS_CNTL_2 0x22D4 -# define R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT 0 -# define R300_PVS_CNTL_2_PARAM_COUNT_SHIFT 16 -#define R300_VAP_PVS_CNTL_3 0x22D8 -# define R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT 10 -# define R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT 0 +#define R300_VAP_PVS_CONST_CNTL 0x22D4 +# define R300_PVS_CONST_BASE_OFFSET_SHIFT 0 +# define R300_PVS_MAX_CONST_ADDR_SHIFT 16 +#define R300_VAP_PVS_CODE_CNTL_1 0x22D8 +# define R300_PVS_LAST_VTX_SRC_INST_SHIFT 0 +#define R300_VAP_PVS_FLOW_CNTL_OPC 0x22DC /* The entire range from 0x2300 to 0x2AC inclusive seems to be used for * immediate vertices @@ -657,7 +706,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* This table specifies the source location and format for up to 16 texture * addresses (i[0]:i[15]) and four colors (c[0]:c[3]) */ -#define R500_RS_IP_0 0x4074
+#define R500_RS_IP_0 0x4074 #define R500_RS_IP_1 0x4078 #define R500_RS_IP_2 0x407C #define R500_RS_IP_3 0x4080 @@ -673,31 +722,24 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R500_RS_IP_13 0x40A8 #define R500_RS_IP_14 0x40AC #define R500_RS_IP_15 0x40B0 -#define R500_RS_IP_TEX_PTR_S_SHIFT 0
-#define R500_RS_IP_TEX_PTR_T_SHIFT 6
-#define R500_RS_IP_TEX_PTR_R_SHIFT 12
-#define R500_RS_IP_TEX_PTR_Q_SHIFT 18
-#define R500_RS_IP_COL_PTR_SHIFT 24
-#define R500_RS_IP_COL_FMT_SHIFT 27
-#define R500_RS_IP_COL_FMT_RGBA (0 << 27) -#define R500_RS_IP_COL_FMT_RGB0 (1 << 27) -#define R500_RS_IP_COL_FMT_RGB1 (2 << 27) -/* gap */ -#define R500_RS_IP_COL_FMT_000A (4 << 27) -#define R500_RS_IP_COL_FMT_0000 (5 << 27) -#define R500_RS_IP_COL_FMT_0001 (6 << 27) -/* gap */ -#define R500_RS_IP_COL_FMT_111A (8 << 27) -#define R500_RS_IP_COL_FMT_1110 (9 << 27) -#define R500_RS_IP_COL_FMT_1111 (10 << 27) +#define R500_RS_IP_PTR_K0 62 +#define R500_RS_IP_PTR_K1 63 +#define R500_RS_IP_TEX_PTR_S_SHIFT 0 +#define R500_RS_IP_TEX_PTR_T_SHIFT 6 +#define R500_RS_IP_TEX_PTR_R_SHIFT 12 +#define R500_RS_IP_TEX_PTR_Q_SHIFT 18 +#define R500_RS_IP_COL_PTR_SHIFT 24 +#define R500_RS_IP_COL_FMT_SHIFT 27 +# define R500_RS_COL_PTR(x) (x << 24) +# define R500_RS_COL_FMT(x) (x << 27) /* gap */ #define R500_RS_IP_OFFSET_DIS (0 << 31) -#define R500_RS_IP_OFFSET_EN (1 << 31)
+#define R500_RS_IP_OFFSET_EN (1 << 31) /* gap */ /* Zero to flush caches. */ -#define R300_TX_CNTL 0x4100 +#define R300_TX_INVALTAGS 0x4100 #define R300_TX_FLUSH 0x0 /* The upper enable bits are guessed, based on fglrx reported limits. */ @@ -728,25 +770,25 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R500_TX_DIRECTION_VERITCAL (1<<27) /* S Texture Coordinate of Vertex 0 for Point texture stuffing (LLC) */ -#define GA_POINT_S0 0x4200 +#define R300_GA_POINT_S0 0x4200 /* T Texture Coordinate of Vertex 0 for Point texture stuffing (LLC) */ -#define GA_POINT_T0 0x4204 +#define R300_GA_POINT_T0 0x4204 /* S Texture Coordinate of Vertex 2 for Point texture stuffing (URC) */ -#define GA_POINT_S1 0x4208 +#define R300_GA_POINT_S1 0x4208 /* T Texture Coordinate of Vertex 2 for Point texture stuffing (URC) */ -#define GA_POINT_T1 0x420c +#define R300_GA_POINT_T1 0x420c /* Specifies amount to shift integer position of vertex (screen space) before * converting to float for triangle stipple. */ -#define GA_TRIANGLE_STIPPLE 0x4214 -# define GA_TRIANGLE_STIPPLE_X_SHIFT_SHIFT 0 -# define GA_TRIANGLE_STIPPLE_X_SHIFT_MASK 0x0000000f -# define GA_TRIANGLE_STIPPLE_Y_SHIFT_SHIFT 16 -# define GA_TRIANGLE_STIPPLE_Y_SHIFT_MASK 0x000f0000 +#define R300_GA_TRIANGLE_STIPPLE 0x4214 +# define R300_GA_TRIANGLE_STIPPLE_X_SHIFT_SHIFT 0 +# define R300_GA_TRIANGLE_STIPPLE_X_SHIFT_MASK 0x0000000f +# define R300_GA_TRIANGLE_STIPPLE_Y_SHIFT_SHIFT 16 +# define R300_GA_TRIANGLE_STIPPLE_Y_SHIFT_MASK 0x000f0000 /* The pointsize is given in multiples of 6. The pointsize can be enormous: * Clear() renders a single point that fills the entire framebuffer. @@ -761,16 +803,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_POINTSIZE_MAX (R300_POINTSIZE_Y_MASK / 6) /* Blue fill color */ -#define GA_FILL_R 0x4220 +#define R500_GA_FILL_R 0x4220 /* Blue fill color */ -#define GA_FILL_G 0x4224 +#define R500_GA_FILL_G 0x4224 /* Blue fill color */ -#define GA_FILL_B 0x4228 +#define R500_GA_FILL_B 0x4228 /* Alpha fill color */ -#define GA_FILL_A 0x422c +#define R500_GA_FILL_A 0x422c /* Specifies maximum and minimum point & sprite sizes for per vertex size @@ -791,159 +833,159 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * VE: vertical or horizontal * HO & VE: no classification */ -#define GA_LINE_CNTL 0x4234 -# define GA_LINE_CNTL_WIDTH_SHIFT 0 -# define GA_LINE_CNTL_WIDTH_MASK 0x0000ffff -# define GA_LINE_CNTL_END_TYPE_HOR (0 << 16) -# define GA_LINE_CNTL_END_TYPE_VER (1 << 16) -# define GA_LINE_CNTL_END_TYPE_SQR (2 << 16) /* horizontal or vertical depending upon slope */ -# define GA_LINE_CNTL_END_TYPE_COMP (3 << 16) /* Computed (perpendicular to slope) */ -# define GA_LINE_CNTL_SORT_NO (0 << 18) -# define GA_LINE_CNTL_SORT_MINX_MINY (1 << 18) +#define R300_GA_LINE_CNTL 0x4234 +# define R300_GA_LINE_CNTL_WIDTH_SHIFT 0 +# define R300_GA_LINE_CNTL_WIDTH_MASK 0x0000ffff +# define R300_GA_LINE_CNTL_END_TYPE_HOR (0 << 16) +# define R300_GA_LINE_CNTL_END_TYPE_VER (1 << 16) +# define R300_GA_LINE_CNTL_END_TYPE_SQR (2 << 16) /* horizontal or vertical depending upon slope */ +# define R300_GA_LINE_CNTL_END_TYPE_COMP (3 << 16) /* Computed (perpendicular to slope) */ +# define R500_GA_LINE_CNTL_SORT_NO (0 << 18) +# define R500_GA_LINE_CNTL_SORT_MINX_MINY (1 << 18) /** TODO: looks wrong */ -# define R300_LINESIZE_MAX (GA_LINE_CNTL_WIDTH_MASK / 6) +# define R300_LINESIZE_MAX (R300_GA_LINE_CNTL_WIDTH_MASK / 6) /** TODO: looks wrong */ # define R300_LINE_CNT_HO (1 << 16) /** TODO: looks wrong */ # define R300_LINE_CNT_VE (1 << 17) /* Line Stipple configuration information. */ -#define GA_LINE_STIPPLE_CONFIG 0x4238 -# define GA_LINE_STIPPLE_CONFIG_LINE_RESET_NO (0 << 0) -# define GA_LINE_STIPPLE_CONFIG_LINE_RESET_LINE (1 << 0) -# define GA_LINE_STIPPLE_CONFIG_LINE_RESET_PACKET (2 << 0) -# define GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_SHIFT 2 -# define GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_MASK 0xfffffffc +#define R300_GA_LINE_STIPPLE_CONFIG 0x4238 +# define R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_NO (0 << 0) +# define R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_LINE (1 << 0) +# define R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_PACKET (2 << 0) +# define R300_GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_SHIFT 2 +# define R300_GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_MASK 0xfffffffc /* Used to load US instructions and constants */ #define R500_GA_US_VECTOR_INDEX 0x4250 -# define GA_US_VECTOR_INDEX_SHIFT 0 -# define GA_US_VECTOR_INDEX_MASK 0x000000ff -# define GA_US_VECTOR_INDEX_TYPE_INSTR (0 << 16) -# define GA_US_VECTOR_INDEX_TYPE_CONST (1 << 16) -# define GA_US_VECTOR_INDEX_CLAMP_NO (0 << 17) -# define GA_US_VECTOR_INDEX_CLAMP_CONST (1 << 17) +# define R500_GA_US_VECTOR_INDEX_SHIFT 0 +# define R500_GA_US_VECTOR_INDEX_MASK 0x000000ff +# define R500_GA_US_VECTOR_INDEX_TYPE_INSTR (0 << 16) +# define R500_GA_US_VECTOR_INDEX_TYPE_CONST (1 << 16) +# define R500_GA_US_VECTOR_INDEX_CLAMP_NO (0 << 17) +# define R500_GA_US_VECTOR_INDEX_CLAMP_CONST (1 << 17) /* Data register for loading US instructions and constants */ #define R500_GA_US_VECTOR_DATA 0x4254 /* Specifies color properties and mappings of textures. */ -#define GA_COLOR_CONTROL_PS3 0x4258 -# define TEX0_SHADING_PS3_SOLID (0 << 0) -# define TEX0_SHADING_PS3_FLAT (1 << 0) -# define TEX0_SHADING_PS3_GOURAUD (2 << 0) -# define TEX1_SHADING_PS3_SOLID (0 << 2) -# define TEX1_SHADING_PS3_FLAT (1 << 2) -# define TEX1_SHADING_PS3_GOURAUD (2 << 2) -# define TEX2_SHADING_PS3_SOLID (0 << 4) -# define TEX2_SHADING_PS3_FLAT (1 << 4) -# define TEX2_SHADING_PS3_GOURAUD (2 << 4) -# define TEX3_SHADING_PS3_SOLID (0 << 6) -# define TEX3_SHADING_PS3_FLAT (1 << 6) -# define TEX3_SHADING_PS3_GOURAUD (2 << 6) -# define TEX4_SHADING_PS3_SOLID (0 << 8) -# define TEX4_SHADING_PS3_FLAT (1 << 8) -# define TEX4_SHADING_PS3_GOURAUD (2 << 8) -# define TEX5_SHADING_PS3_SOLID (0 << 10) -# define TEX5_SHADING_PS3_FLAT (1 << 10) -# define TEX5_SHADING_PS3_GOURAUD (2 << 10) -# define TEX6_SHADING_PS3_SOLID (0 << 12) -# define TEX6_SHADING_PS3_FLAT (1 << 12) -# define TEX6_SHADING_PS3_GOURAUD (2 << 12) -# define TEX7_SHADING_PS3_SOLID (0 << 14) -# define TEX7_SHADING_PS3_FLAT (1 << 14) -# define TEX7_SHADING_PS3_GOURAUD (2 << 14) -# define TEX8_SHADING_PS3_SOLID (0 << 16) -# define TEX8_SHADING_PS3_FLAT (1 << 16) -# define TEX8_SHADING_PS3_GOURAUD (2 << 16) -# define TEX9_SHADING_PS3_SOLID (0 << 18) -# define TEX9_SHADING_PS3_FLAT (1 << 18) -# define TEX9_SHADING_PS3_GOURAUD (2 << 18) -# define TEX10_SHADING_PS3_SOLID (0 << 20) -# define TEX10_SHADING_PS3_FLAT (1 << 20) -# define TEX10_SHADING_PS3_GOURAUD (2 << 20) -# define COLOR0_TEX_OVERRIDE_NO (0 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_0 (1 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_1 (2 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_2 (3 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_3 (4 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_4 (5 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_5 (6 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_6 (7 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_7 (8 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_8_C2 (9 << 22) -# define COLOR0_TEX_OVERRIDE_TEX_9_C3 (10 << 22) -# define COLOR1_TEX_OVERRIDE_NO (0 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_0 (1 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_1 (2 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_2 (3 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_3 (4 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_4 (5 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_5 (6 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_6 (7 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_7 (8 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_8_C2 (9 << 26) -# define COLOR1_TEX_OVERRIDE_TEX_9_C3 (10 << 26) +#define R500_GA_COLOR_CONTROL_PS3 0x4258 +# define R500_TEX0_SHADING_PS3_SOLID (0 << 0) +# define R500_TEX0_SHADING_PS3_FLAT (1 << 0) +# define R500_TEX0_SHADING_PS3_GOURAUD (2 << 0) +# define R500_TEX1_SHADING_PS3_SOLID (0 << 2) +# define R500_TEX1_SHADING_PS3_FLAT (1 << 2) +# define R500_TEX1_SHADING_PS3_GOURAUD (2 << 2) +# define R500_TEX2_SHADING_PS3_SOLID (0 << 4) +# define R500_TEX2_SHADING_PS3_FLAT (1 << 4) +# define R500_TEX2_SHADING_PS3_GOURAUD (2 << 4) +# define R500_TEX3_SHADING_PS3_SOLID (0 << 6) +# define R500_TEX3_SHADING_PS3_FLAT (1 << 6) +# define R500_TEX3_SHADING_PS3_GOURAUD (2 << 6) +# define R500_TEX4_SHADING_PS3_SOLID (0 << 8) +# define R500_TEX4_SHADING_PS3_FLAT (1 << 8) +# define R500_TEX4_SHADING_PS3_GOURAUD (2 << 8) +# define R500_TEX5_SHADING_PS3_SOLID (0 << 10) +# define R500_TEX5_SHADING_PS3_FLAT (1 << 10) +# define R500_TEX5_SHADING_PS3_GOURAUD (2 << 10) +# define R500_TEX6_SHADING_PS3_SOLID (0 << 12) +# define R500_TEX6_SHADING_PS3_FLAT (1 << 12) +# define R500_TEX6_SHADING_PS3_GOURAUD (2 << 12) +# define R500_TEX7_SHADING_PS3_SOLID (0 << 14) +# define R500_TEX7_SHADING_PS3_FLAT (1 << 14) +# define R500_TEX7_SHADING_PS3_GOURAUD (2 << 14) +# define R500_TEX8_SHADING_PS3_SOLID (0 << 16) +# define R500_TEX8_SHADING_PS3_FLAT (1 << 16) +# define R500_TEX8_SHADING_PS3_GOURAUD (2 << 16) +# define R500_TEX9_SHADING_PS3_SOLID (0 << 18) +# define R500_TEX9_SHADING_PS3_FLAT (1 << 18) +# define R500_TEX9_SHADING_PS3_GOURAUD (2 << 18) +# define R500_TEX10_SHADING_PS3_SOLID (0 << 20) +# define R500_TEX10_SHADING_PS3_FLAT (1 << 20) +# define R500_TEX10_SHADING_PS3_GOURAUD (2 << 20) +# define R500_COLOR0_TEX_OVERRIDE_NO (0 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_0 (1 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_1 (2 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_2 (3 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_3 (4 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_4 (5 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_5 (6 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_6 (7 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_7 (8 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_8_C2 (9 << 22) +# define R500_COLOR0_TEX_OVERRIDE_TEX_9_C3 (10 << 22) +# define R500_COLOR1_TEX_OVERRIDE_NO (0 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_0 (1 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_1 (2 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_2 (3 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_3 (4 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_4 (5 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_5 (6 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_6 (7 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_7 (8 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_8_C2 (9 << 26) +# define R500_COLOR1_TEX_OVERRIDE_TEX_9_C3 (10 << 26) /* Returns idle status of various G3D block, captured when GA_IDLE written or * when hard or soft reset asserted. */ -#define GA_IDLE 0x425c -# define GA_IDLE_PIPE3_Z_IDLE (0 << 0) -# define GA_IDLE_PIPE2_Z_IDLE (0 << 1) -# define GA_IDLE_PIPE3_CD_IDLE (0 << 2) -# define GA_IDLE_PIPE2_CD_IDLE (0 << 3) -# define GA_IDLE_PIPE3_FG_IDLE (0 << 4) -# define GA_IDLE_PIPE2_FG_IDLE (0 << 5) -# define GA_IDLE_PIPE3_US_IDLE (0 << 6) -# define GA_IDLE_PIPE2_US_IDLE (0 << 7) -# define GA_IDLE_PIPE3_SC_IDLE (0 << 8) -# define GA_IDLE_PIPE2_SC_IDLE (0 << 9) -# define GA_IDLE_PIPE3_RS_IDLE (0 << 10) -# define GA_IDLE_PIPE2_RS_IDLE (0 << 11) -# define GA_IDLE_PIPE1_Z_IDLE (0 << 12) -# define GA_IDLE_PIPE0_Z_IDLE (0 << 13) -# define GA_IDLE_PIPE1_CD_IDLE (0 << 14) -# define GA_IDLE_PIPE0_CD_IDLE (0 << 15) -# define GA_IDLE_PIPE1_FG_IDLE (0 << 16) -# define GA_IDLE_PIPE0_FG_IDLE (0 << 17) -# define GA_IDLE_PIPE1_US_IDLE (0 << 18) -# define GA_IDLE_PIPE0_US_IDLE (0 << 19) -# define GA_IDLE_PIPE1_SC_IDLE (0 << 20) -# define GA_IDLE_PIPE0_SC_IDLE (0 << 21) -# define GA_IDLE_PIPE1_RS_IDLE (0 << 22) -# define GA_IDLE_PIPE0_RS_IDLE (0 << 23) -# define GA_IDLE_SU_IDLE (0 << 24) -# define GA_IDLE_GA_IDLE (0 << 25) -# define GA_IDLE_GA_UNIT2_IDLE (0 << 26) +#define R500_GA_IDLE 0x425c +# define R500_GA_IDLE_PIPE3_Z_IDLE (0 << 0) +# define R500_GA_IDLE_PIPE2_Z_IDLE (0 << 1) +# define R500_GA_IDLE_PIPE3_CD_IDLE (0 << 2) +# define R500_GA_IDLE_PIPE2_CD_IDLE (0 << 3) +# define R500_GA_IDLE_PIPE3_FG_IDLE (0 << 4) +# define R500_GA_IDLE_PIPE2_FG_IDLE (0 << 5) +# define R500_GA_IDLE_PIPE3_US_IDLE (0 << 6) +# define R500_GA_IDLE_PIPE2_US_IDLE (0 << 7) +# define R500_GA_IDLE_PIPE3_SC_IDLE (0 << 8) +# define R500_GA_IDLE_PIPE2_SC_IDLE (0 << 9) +# define R500_GA_IDLE_PIPE3_RS_IDLE (0 << 10) +# define R500_GA_IDLE_PIPE2_RS_IDLE (0 << 11) +# define R500_GA_IDLE_PIPE1_Z_IDLE (0 << 12) +# define R500_GA_IDLE_PIPE0_Z_IDLE (0 << 13) +# define R500_GA_IDLE_PIPE1_CD_IDLE (0 << 14) +# define R500_GA_IDLE_PIPE0_CD_IDLE (0 << 15) +# define R500_GA_IDLE_PIPE1_FG_IDLE (0 << 16) +# define R500_GA_IDLE_PIPE0_FG_IDLE (0 << 17) +# define R500_GA_IDLE_PIPE1_US_IDLE (0 << 18) +# define R500_GA_IDLE_PIPE0_US_IDLE (0 << 19) +# define R500_GA_IDLE_PIPE1_SC_IDLE (0 << 20) +# define R500_GA_IDLE_PIPE0_SC_IDLE (0 << 21) +# define R500_GA_IDLE_PIPE1_RS_IDLE (0 << 22) +# define R500_GA_IDLE_PIPE0_RS_IDLE (0 << 23) +# define R500_GA_IDLE_SU_IDLE (0 << 24) +# define R500_GA_IDLE_GA_IDLE (0 << 25) +# define R500_GA_IDLE_GA_UNIT2_IDLE (0 << 26) /* Current value of stipple accumulator. */ #define R300_GA_LINE_STIPPLE_VALUE 0x4260 /* S Texture Coordinate Value for Vertex 0 of Line (stuff textures -- i.e. AA) */ -#define GA_LINE_S0 0x4264 +#define R300_GA_LINE_S0 0x4264 /* S Texture Coordinate Value for Vertex 1 of Lines (V2 of parallelogram -- stuff textures -- i.e. AA) */ -#define GA_LINE_S1 0x4268 +#define R300_GA_LINE_S1 0x4268 /* GA Input fifo high water marks */ -#define GA_FIFO_CNTL 0x4270 -# define GA_FIFO_CNTL_VERTEX_FIFO_MASK 0x00000007 -# define GA_FIFO_CNTL_VERTEX_FIFO_SHIFT 0 -# define GA_FIFO_CNTL_VERTEX_INDEX_MASK 0x00000038 -# define GA_FIFO_CNTL_VERTEX_INDEX_SHIFT 3 -# define GA_FIFO_CNTL_VERTEX_REG_MASK 0x00003fc0 -# define GA_FIFO_CNTL_VERTEX_REG_SHIFT 6 - -/* Something shade related */ -#define GA_ENHANCE 0x4274 -# define GA_ENHANCE_DEADLOCK_CNTL_NO_EFFECT (0 << 0) -# define GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL (1 << 0) /* Prevents TCL interface from deadlocking on GA side. */ -# define GA_ENHANCE_FASTSYNC_CNTL_NO_EFFECT (0 << 1) -# define GA_ENHANCE_FASTSYNC_CNTL_ENABLE (1 << 1) /* Enables high-performance register/primitive switching. */ -# define GA_ENHANCE_REG_READWRITE_NO_EFFECT (0 << 2) /* R520+ only */ -# define GA_ENHANCE_REG_READWRITE_ENABLE (1 << 2) /* R520+ only, Enables GA support of simultaneous register reads and writes. */ -# define GA_ENHANCE_REG_NOSTALL_NO_EFFECT (0 << 3) -# define GA_ENHANCE_REG_NOSTALL_ENABLE (1 << 3) /* Enables GA support of no-stall reads for register read back. */ +#define R500_GA_FIFO_CNTL 0x4270 +# define R500_GA_FIFO_CNTL_VERTEX_FIFO_MASK 0x00000007 +# define R500_GA_FIFO_CNTL_VERTEX_FIFO_SHIFT 0 +# define R500_GA_FIFO_CNTL_VERTEX_INDEX_MASK 0x00000038 +# define R500_GA_FIFO_CNTL_VERTEX_INDEX_SHIFT 3 +# define R500_GA_FIFO_CNTL_VERTEX_REG_MASK 0x00003fc0 +# define R500_GA_FIFO_CNTL_VERTEX_REG_SHIFT 6 + +/* GA enhance/tweaks */ +#define R300_GA_ENHANCE 0x4274 +# define R300_GA_ENHANCE_DEADLOCK_CNTL_NO_EFFECT (0 << 0) +# define R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL (1 << 0) /* Prevents TCL interface from deadlocking on GA side. */ +# define R300_GA_ENHANCE_FASTSYNC_CNTL_NO_EFFECT (0 << 1) +# define R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE (1 << 1) /* Enables high-performance register/primitive switching. */ +# define R500_GA_ENHANCE_REG_READWRITE_NO_EFFECT (0 << 2) /* R520+ only */ +# define R500_GA_ENHANCE_REG_READWRITE_ENABLE (1 << 2) /* R520+ only, Enables GA support of simultaneous register reads and writes. */ +# define R500_GA_ENHANCE_REG_NOSTALL_NO_EFFECT (0 << 3) +# define R500_GA_ENHANCE_REG_NOSTALL_ENABLE (1 << 3) /* Enables GA support of no-stall reads for register read back. */ #define R300_GA_COLOR_CONTROL 0x4278 # define R300_GA_COLOR_CONTROL_RGB0_SHADING_SOLID (0 << 0) @@ -1006,46 +1048,48 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Polygon Mode * Dangerous */ -#define GA_POLY_MODE 0x4288 -# define GA_POLY_MODE_DISABLE (0 << 0) -# define GA_POLY_MODE_DUAL (1 << 0) /* send 2 sets of 3 polys with specified poly type */ +#define R300_GA_POLY_MODE 0x4288 +# define R300_GA_POLY_MODE_DISABLE (0 << 0) +# define R300_GA_POLY_MODE_DUAL (1 << 0) /* send 2 sets of 3 polys with specified poly type */ /* reserved */ -# define GA_POLY_MODE_FRONT_PTYPE_POINT (0 << 4) -# define GA_POLY_MODE_FRONT_PTYPE_LINE (1 << 4) -# define GA_POLY_MODE_FRONT_PTYPE_TRI (2 << 4) +# define R300_GA_POLY_MODE_FRONT_PTYPE_POINT (0 << 4) +# define R300_GA_POLY_MODE_FRONT_PTYPE_LINE (1 << 4) +# define R300_GA_POLY_MODE_FRONT_PTYPE_TRI (2 << 4) /* reserved */ -# define GA_POLY_MODE_BACK_PTYPE_POINT (0 << 7) -# define GA_POLY_MODE_BACK_PTYPE_LINE (1 << 7) -# define GA_POLY_MODE_BACK_PTYPE_TRI (2 << 7) +# define R300_GA_POLY_MODE_BACK_PTYPE_POINT (0 << 7) +# define R300_GA_POLY_MODE_BACK_PTYPE_LINE (1 << 7) +# define R300_GA_POLY_MODE_BACK_PTYPE_TRI (2 << 7) /* reserved */ /* Specifies the rouding mode for geometry & color SPFP to FP conversions. */ -#define GA_ROUND_MODE 0x428c -# define GA_ROUND_MODE_GEOMETRY_ROUND_TRUNC (0 << 0) -# define GA_ROUND_MODE_GEOMETRY_ROUND_NEAREST (1 << 0) -# define GA_ROUND_MODE_COLOR_ROUND_TRUNC (0 << 2) -# define GA_ROUND_MODE_COLOR_ROUND_NEAREST (1 << 2) -# define GA_ROUND_MODE_RGB_CLAMP_RGB (0 << 4) -# define GA_ROUND_MODE_RGB_CLAMP_FP20 (1 << 4) -# define GA_ROUND_MODE_ALPHA_CLAMP_RGB (0 << 5) -# define GA_ROUND_MODE_ALPHA_CLAMP_FP20 (1 << 5) -# define GA_ROUND_MODE_GEOMETRY_MASK_SHIFT 6 -# define GA_ROUND_MODE_GEOMETRY_MASK_MASK 0x000003c0 +#define R300_GA_ROUND_MODE 0x428c +# define R300_GA_ROUND_MODE_GEOMETRY_ROUND_TRUNC (0 << 0) +# define R300_GA_ROUND_MODE_GEOMETRY_ROUND_NEAREST (1 << 0) +# define R300_GA_ROUND_MODE_COLOR_ROUND_TRUNC (0 << 2) +# define R300_GA_ROUND_MODE_COLOR_ROUND_NEAREST (1 << 2) +# define R300_GA_ROUND_MODE_RGB_CLAMP_RGB (0 << 4) +# define R300_GA_ROUND_MODE_RGB_CLAMP_FP20 (1 << 4) +# define R300_GA_ROUND_MODE_ALPHA_CLAMP_RGB (0 << 5) +# define R300_GA_ROUND_MODE_ALPHA_CLAMP_FP20 (1 << 5) +# define R500_GA_ROUND_MODE_GEOMETRY_MASK_SHIFT 6 +# define R500_GA_ROUND_MODE_GEOMETRY_MASK_MASK 0x000003c0 /* Specifies x & y offsets for vertex data after conversion to FP. * Offsets are in S15 format (subpixels -- 1/12 or 1/16, even in 8b * subprecision). */ -#define GA_OFFSET 0x4290 -# define GA_OFFSET_X_OFFSET_SHIFT 0 -# define GA_OFFSET_X_OFFSET_MASK 0x0000ffff -# define GA_OFFSET_Y_OFFSET_SHIFT 16 -# define GA_OFFSET_Y_OFFSET_MASK 0xffff0000 +#define R300_GA_OFFSET 0x4290 +# define R300_GA_OFFSET_X_OFFSET_SHIFT 0 +# define R300_GA_OFFSET_X_OFFSET_MASK 0x0000ffff +# define R300_GA_OFFSET_Y_OFFSET_SHIFT 16 +# define R300_GA_OFFSET_Y_OFFSET_MASK 0xffff0000 /* Specifies the scale to apply to fog. */ -#define R300_RE_FOG_SCALE 0x4294 +#define R300_GA_FOG_SCALE 0x4294 /* Specifies the offset to apply to fog. */ -#define R300_RE_FOG_START 0x4298 +#define R300_GA_FOG_OFFSET 0x4298 +/* Specifies number of cycles to assert reset, and also causes RB3D soft reset to assert. */ +#define R300_GA_SOFT_RESET 0x429c /* Not sure why there are duplicate of factor and constant values. * My best guess so far is that there are seperate zbiases for test and write. @@ -1053,11 +1097,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Some of the tests indicate that fgl has a fallback implementation of zbias * via pixel shaders. */ -#define R300_RE_ZBIAS_CNTL 0x42A0 /* GUESS */ -#define R300_RE_ZBIAS_T_FACTOR 0x42A4 -#define R300_RE_ZBIAS_T_CONSTANT 0x42A8 -#define R300_RE_ZBIAS_W_FACTOR 0x42AC -#define R300_RE_ZBIAS_W_CONSTANT 0x42B0 +#define R300_SU_TEX_WRAP 0x42A0 +#define R300_SU_POLY_OFFSET_FRONT_SCALE 0x42A4 +#define R300_SU_POLY_OFFSET_FRONT_OFFSET 0x42A8 +#define R300_SU_POLY_OFFSET_BACK_SCALE 0x42AC +#define R300_SU_POLY_OFFSET_BACK_OFFSET 0x42B0 /* This register needs to be set to (1<<1) for RV350 to correctly * perform depth test (see --vb-triangles in r300_demo) @@ -1068,10 +1112,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * One to enable depth test and one for depth write. * Yet this doesnt explain why depth writes work ... */ -#define R300_RE_OCCLUSION_CNTL 0x42B4 -# define R300_OCCLUSION_ON (1<<1) +#define R300_SU_POLY_OFFSET_ENABLE 0x42B4 +# define R300_FRONT_ENABLE (1 << 0) +# define R300_BACK_ENABLE (1 << 1) +# define R300_PARA_ENABLE (1 << 2) -#define R300_RE_CULL_CNTL 0x42B8 +#define R300_SU_CULL_MODE 0x42B8 # define R300_CULL_FRONT (1 << 0) # define R300_CULL_BACK (1 << 1) # define R300_FRONT_FACE_CCW (0 << 2) @@ -1126,32 +1172,32 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_RS_IP_3 0x431C # define R300_RS_INTERP_SRC_SHIFT 2 /* TODO: check for removal */ # define R300_RS_INTERP_SRC_MASK (7 << 2) /* TODO: check for removal */ -# define R300_RS_TEX_PTR(x) (x << 0)
-# define R300_RS_COL_PTR(x) (x << 6)
-# define R300_RS_COL_FMT(x) (x << 9)
-# define R300_RS_COL_FMT_RGBA 0
-# define R300_RS_COL_FMT_RGB0 2
-# define R300_RS_COL_FMT_RGB1 3
-# define R300_RS_COL_FMT_000A 4
-# define R300_RS_COL_FMT_0000 5
-# define R300_RS_COL_FMT_0001 6
-# define R300_RS_COL_FMT_111A 8
-# define R300_RS_COL_FMT_1110 9
-# define R300_RS_COL_FMT_1111 10
-# define R300_RS_SEL_S(x) (x << 13)
-# define R300_RS_SEL_T(x) (x << 16)
-# define R300_RS_SEL_R(x) (x << 19)
-# define R300_RS_SEL_Q(x) (x << 22)
-# define R300_RS_SEL_C0 0
-# define R300_RS_SEL_C1 1
-# define R300_RS_SEL_C2 2
-# define R300_RS_SEL_C3 3
-# define R300_RS_SEL_K0 4
-# define R300_RS_SEL_K1 5
+# define R300_RS_TEX_PTR(x) (x << 0) +# define R300_RS_COL_PTR(x) (x << 6) +# define R300_RS_COL_FMT(x) (x << 9) +# define R300_RS_COL_FMT_RGBA 0 +# define R300_RS_COL_FMT_RGB0 1 +# define R300_RS_COL_FMT_RGB1 2 +# define R300_RS_COL_FMT_000A 4 +# define R300_RS_COL_FMT_0000 5 +# define R300_RS_COL_FMT_0001 6 +# define R300_RS_COL_FMT_111A 8 +# define R300_RS_COL_FMT_1110 9 +# define R300_RS_COL_FMT_1111 10 +# define R300_RS_SEL_S(x) (x << 13) +# define R300_RS_SEL_T(x) (x << 16) +# define R300_RS_SEL_R(x) (x << 19) +# define R300_RS_SEL_Q(x) (x << 22) +# define R300_RS_SEL_C0 0 +# define R300_RS_SEL_C1 1 +# define R300_RS_SEL_C2 2 +# define R300_RS_SEL_C3 3 +# define R300_RS_SEL_K0 4 +# define R300_RS_SEL_K1 5 /* */ -#define R500_RS_INST_0 0x4320
+#define R500_RS_INST_0 0x4320 #define R500_RS_INST_1 0x4324 #define R500_RS_INST_2 0x4328 #define R500_RS_INST_3 0x432c @@ -1167,17 +1213,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R500_RS_INST_13 0x4354 #define R500_RS_INST_14 0x4358 #define R500_RS_INST_15 0x435c -#define R500_RS_INST_TEX_ID_SHIFT 0
-#define R500_RS_INST_TEX_CN_WRITE (1 << 4)
-#define R500_RS_INST_TEX_ADDR_SHIFT 5
-#define R500_RS_INST_COL_ID_SHIFT 12
-#define R500_RS_INST_COL_CN_NO_WRITE (0 << 16)
-#define R500_RS_INST_COL_CN_WRITE (1 << 16)
-#define R500_RS_INST_COL_CN_WRITE_FBUFFER (2 << 16)
-#define R500_RS_INST_COL_CN_WRITE_BACKFACE (3 << 16)
-#define R500_RS_INST_COL_ADDR_SHIFT 18
-#define R500_RS_INST_TEX_ADJ (1 << 25)
-#define R500_RS_INST_W_CN (1 << 26)
+#define R500_RS_INST_TEX_ID_SHIFT 0 +#define R500_RS_INST_TEX_CN_WRITE (1 << 4) +#define R500_RS_INST_TEX_ADDR_SHIFT 5 +#define R500_RS_INST_COL_ID_SHIFT 12 +#define R500_RS_INST_COL_CN_NO_WRITE (0 << 16) +#define R500_RS_INST_COL_CN_WRITE (1 << 16) +#define R500_RS_INST_COL_CN_WRITE_FBUFFER (2 << 16) +#define R500_RS_INST_COL_CN_WRITE_BACKFACE (3 << 16) +#define R500_RS_INST_COL_ADDR_SHIFT 18 +#define R500_RS_INST_TEX_ADJ (1 << 25) +#define R500_RS_INST_W_CN (1 << 26) /* These DWORDs control how vertex data is routed into fragment program * registers, after interpolators. @@ -1220,6 +1266,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_SC_HYPERZ_HZ_Z0MAX_NO (0 << 6) # define R300_SC_HYPERZ_HZ_Z0MAX (1 << 6) +#define R300_SC_EDGERULE 0x43a8 /* BEGIN: Scissors and cliprects */ @@ -1237,21 +1284,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * For some reason, the top-left corner of the framebuffer is at (1440, 1440) * for the purpose of clipping and scissors. */ -#define R300_RE_CLIPRECT_TL_0 0x43B0 -#define R300_RE_CLIPRECT_BR_0 0x43B4 -#define R300_RE_CLIPRECT_TL_1 0x43B8 -#define R300_RE_CLIPRECT_BR_1 0x43BC -#define R300_RE_CLIPRECT_TL_2 0x43C0 -#define R300_RE_CLIPRECT_BR_2 0x43C4 -#define R300_RE_CLIPRECT_TL_3 0x43C8 -#define R300_RE_CLIPRECT_BR_3 0x43CC +#define R300_SC_CLIPRECT_TL_0 0x43B0 +#define R300_SC_CLIPRECT_BR_0 0x43B4 +#define R300_SC_CLIPRECT_TL_1 0x43B8 +#define R300_SC_CLIPRECT_BR_1 0x43BC +#define R300_SC_CLIPRECT_TL_2 0x43C0 +#define R300_SC_CLIPRECT_BR_2 0x43C4 +#define R300_SC_CLIPRECT_TL_3 0x43C8 +#define R300_SC_CLIPRECT_BR_3 0x43CC # define R300_CLIPRECT_OFFSET 1440 # define R300_CLIPRECT_MASK 0x1FFF # define R300_CLIPRECT_X_SHIFT 0 # define R300_CLIPRECT_X_MASK (0x1FFF << 0) # define R300_CLIPRECT_Y_SHIFT 13 # define R300_CLIPRECT_Y_MASK (0x1FFF << 13) -#define R300_RE_CLIPRECT_CNTL 0x43D0 +#define R300_SC_CLIP_RULE 0x43D0 # define R300_CLIP_OUT (1 << 0) # define R300_CLIP_0 (1 << 1) # define R300_CLIP_1 (1 << 2) @@ -1271,8 +1318,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* gap */ -#define R300_RE_SCISSORS_TL 0x43E0 -#define R300_RE_SCISSORS_BR 0x43E4 +#define R300_SC_SCISSORS_TL 0x43E0 +#define R300_SC_SCISSORS_BR 0x43E4 # define R300_SCISSORS_OFFSET 1440 # define R300_SCISSORS_X_SHIFT 0 # define R300_SCISSORS_X_MASK (0x1FFF << 0) @@ -1556,23 +1603,23 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * offsets into the respective instruction streams, while *_END points to the * last instruction relative to this offset. */ -#define R300_PFS_CNTL_0 0x4600 +#define R300_US_CONFIG 0x4600 # define R300_PFS_CNTL_LAST_NODES_SHIFT 0 # define R300_PFS_CNTL_LAST_NODES_MASK (3 << 0) # define R300_PFS_CNTL_FIRST_NODE_HAS_TEX (1 << 3) -#define R300_PFS_CNTL_1 0x4604 +#define R300_US_PIXSIZE 0x4604 /* There is an unshifted value here which has so far always been equal to the * index of the highest used temporary register. */ -#define R300_PFS_CNTL_2 0x4608 +#define R300_US_CODE_OFFSET 0x4608 # define R300_PFS_CNTL_ALU_OFFSET_SHIFT 0 # define R300_PFS_CNTL_ALU_OFFSET_MASK (63 << 0) # define R300_PFS_CNTL_ALU_END_SHIFT 6 # define R300_PFS_CNTL_ALU_END_MASK (63 << 6) -# define R300_PFS_CNTL_TEX_OFFSET_SHIFT 12 -# define R300_PFS_CNTL_TEX_OFFSET_MASK (31 << 12) /* GUESS */ +# define R300_PFS_CNTL_TEX_OFFSET_SHIFT 13 +# define R300_PFS_CNTL_TEX_OFFSET_MASK (31 << 13) # define R300_PFS_CNTL_TEX_END_SHIFT 18 -# define R300_PFS_CNTL_TEX_END_MASK (31 << 18) /* GUESS */ +# define R300_PFS_CNTL_TEX_END_MASK (31 << 18) /* gap */ @@ -1583,70 +1630,65 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * * Offsets are relative to the master offset from PFS_CNTL_2. */ -#define R300_PFS_NODE_0 0x4610 -#define R300_PFS_NODE_1 0x4614 -#define R300_PFS_NODE_2 0x4618 -#define R300_PFS_NODE_3 0x461C -# define R300_PFS_NODE_ALU_OFFSET_SHIFT 0 -# define R300_PFS_NODE_ALU_OFFSET_MASK (63 << 0) -# define R300_PFS_NODE_ALU_END_SHIFT 6 -# define R300_PFS_NODE_ALU_END_MASK (63 << 6) -# define R300_PFS_NODE_TEX_OFFSET_SHIFT 12 -# define R300_PFS_NODE_TEX_OFFSET_MASK (31 << 12) -# define R300_PFS_NODE_TEX_END_SHIFT 17 -# define R300_PFS_NODE_TEX_END_MASK (31 << 17) -# define R300_PFS_NODE_OUTPUT_COLOR (1 << 22) -# define R300_PFS_NODE_OUTPUT_DEPTH (1 << 23) +#define R300_US_CODE_ADDR_0 0x4610 +#define R300_US_CODE_ADDR_1 0x4614 +#define R300_US_CODE_ADDR_2 0x4618 +#define R300_US_CODE_ADDR_3 0x461C +# define R300_ALU_START_SHIFT 0 +# define R300_ALU_START_MASK (63 << 0) +# define R300_ALU_SIZE_SHIFT 6 +# define R300_ALU_SIZE_MASK (63 << 6) +# define R300_TEX_START_SHIFT 12 +# define R300_TEX_START_MASK (31 << 12) +# define R300_TEX_SIZE_SHIFT 17 +# define R300_TEX_SIZE_MASK (31 << 17) +# define R300_RGBA_OUT (1 << 22) +# define R300_W_OUT (1 << 23) /* TEX * As far as I can tell, texture instructions cannot write into output * registers directly. A subsequent ALU instruction is always necessary, * even if it's just MAD o0, r0, 1, 0 */ -#define R300_PFS_TEXI_0 0x4620 -# define R300_FPITX_SRC_SHIFT 0 -# define R300_FPITX_SRC_MASK (31 << 0) - /* GUESS */ -# define R300_FPITX_SRC_CONST (1 << 5) -# define R300_FPITX_DST_SHIFT 6 -# define R300_FPITX_DST_MASK (31 << 6) -# define R300_FPITX_IMAGE_SHIFT 11 - /* GUESS based on layout and native limits */ -# define R300_FPITX_IMAGE_MASK (15 << 11) -/* Unsure if these are opcodes, or some kind of bitfield, but this is how - * they were set when I checked - */ -# define R300_FPITX_OPCODE_SHIFT 15 -# define R300_FPITX_OP_TEX 1 -# define R300_FPITX_OP_KIL 2 -# define R300_FPITX_OP_TXP 3 -# define R300_FPITX_OP_TXB 4 -# define R300_FPITX_OPCODE_MASK (7 << 15) +#define R300_US_TEX_INST_0 0x4620 +# define R300_SRC_ADDR_SHIFT 0 +# define R300_SRC_ADDR_MASK (31 << 0) +# define R300_DST_ADDR_SHIFT 6 +# define R300_DST_ADDR_MASK (31 << 6) +# define R300_TEX_ID_SHIFT 11 +# define R300_TEX_ID_MASK (15 << 11) +# define R300_TEX_INST_SHIFT 15 +# define R300_TEX_OP_NOP 0 +# define R300_TEX_OP_LD 1 +# define R300_TEX_OP_KIL 2 +# define R300_TEX_OP_TXP 3 +# define R300_TEX_OP_TXB 4 +# define R300_TEX_INST_MASK (7 << 15) /* Output format from the unfied shader */ -#define R500_US_OUT_FMT 0x46A4 -# define R500_US_OUT_FMT_C4_8 (0 << 0) -# define R500_US_OUT_FMT_C4_10 (1 << 0) -# define R500_US_OUT_FMT_C4_10_GAMMA (2 << 0) -# define R500_US_OUT_FMT_C_16 (3 << 0) -# define R500_US_OUT_FMT_C2_16 (4 << 0) -# define R500_US_OUT_FMT_C4_16 (5 << 0) -# define R500_US_OUT_FMT_C_16_MPEG (6 << 0) -# define R500_US_OUT_FMT_C2_16_MPEG (7 << 0) -# define R500_US_OUT_FMT_C2_4 (8 << 0) -# define R500_US_OUT_FMT_C_3_3_2 (9 << 0) -# define R500_US_OUT_FMT_C_6_5_6 (10 << 0) -# define R500_US_OUT_FMT_C_11_11_10 (11 << 0) -# define R500_US_OUT_FMT_C_10_11_11 (12 << 0) -# define R500_US_OUT_FMT_C_2_10_10_10 (13 << 0) +#define R300_US_OUT_FMT 0x46A4 +# define R300_US_OUT_FMT_C4_8 (0 << 0) +# define R300_US_OUT_FMT_C4_10 (1 << 0) +# define R300_US_OUT_FMT_C4_10_GAMMA (2 << 0) +# define R300_US_OUT_FMT_C_16 (3 << 0) +# define R300_US_OUT_FMT_C2_16 (4 << 0) +# define R300_US_OUT_FMT_C4_16 (5 << 0) +# define R300_US_OUT_FMT_C_16_MPEG (6 << 0) +# define R300_US_OUT_FMT_C2_16_MPEG (7 << 0) +# define R300_US_OUT_FMT_C2_4 (8 << 0) +# define R300_US_OUT_FMT_C_3_3_2 (9 << 0) +# define R300_US_OUT_FMT_C_6_5_6 (10 << 0) +# define R300_US_OUT_FMT_C_11_11_10 (11 << 0) +# define R300_US_OUT_FMT_C_10_11_11 (12 << 0) +# define R300_US_OUT_FMT_C_2_10_10_10 (13 << 0) /* reserved */ -# define R500_US_OUT_FMT_UNUSED (15 << 0) -# define R500_US_OUT_FMT_C_16_FP (16 << 0) -# define R500_US_OUT_FMT_C2_16_FP (17 << 0) -# define R500_US_OUT_FMT_C4_16_FP (18 << 0) -# define R500_US_OUT_FMT_C_32_FP (19 << 0) -# define R500_US_OUT_FMT_C2_32_FP (20 << 0) -# define R500_US_OUT_FMT_C4_32_FP (20 << 0) +# define R300_US_OUT_FMT_UNUSED (15 << 0) +# define R300_US_OUT_FMT_C_16_FP (16 << 0) +# define R300_US_OUT_FMT_C2_16_FP (17 << 0) +# define R300_US_OUT_FMT_C4_16_FP (18 << 0) +# define R300_US_OUT_FMT_C_32_FP (19 << 0) +# define R300_US_OUT_FMT_C2_32_FP (20 << 0) +# define R300_US_OUT_FMT_C4_32_FP (20 << 0) /* ALU * The ALU instructions register blocks are enumerated according to the order @@ -1712,204 +1754,247 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * - Set FPI0/FPI2_SPECIAL_LRP * Arbitrary LRP (including support for swizzling) requires vanilla MAD+MAD */ -#define R300_PFS_INSTR1_0 0x46C0 -# define R300_FPI1_SRC0C_SHIFT 0 -# define R300_FPI1_SRC0C_MASK (31 << 0) -# define R300_FPI1_SRC0C_CONST (1 << 5) -# define R300_FPI1_SRC1C_SHIFT 6 -# define R300_FPI1_SRC1C_MASK (31 << 6) -# define R300_FPI1_SRC1C_CONST (1 << 11) -# define R300_FPI1_SRC2C_SHIFT 12 -# define R300_FPI1_SRC2C_MASK (31 << 12) -# define R300_FPI1_SRC2C_CONST (1 << 17) -# define R300_FPI1_SRC_MASK 0x0003ffff -# define R300_FPI1_DSTC_SHIFT 18 -# define R300_FPI1_DSTC_MASK (31 << 18) -# define R300_FPI1_DSTC_REG_MASK_SHIFT 23 -# define R300_FPI1_DSTC_REG_X (1 << 23) -# define R300_FPI1_DSTC_REG_Y (1 << 24) -# define R300_FPI1_DSTC_REG_Z (1 << 25) -# define R300_FPI1_DSTC_OUTPUT_MASK_SHIFT 26 -# define R300_FPI1_DSTC_OUTPUT_X (1 << 26) -# define R300_FPI1_DSTC_OUTPUT_Y (1 << 27) -# define R300_FPI1_DSTC_OUTPUT_Z (1 << 28) - -#define R300_PFS_INSTR3_0 0x47C0 -# define R300_FPI3_SRC0A_SHIFT 0 -# define R300_FPI3_SRC0A_MASK (31 << 0) -# define R300_FPI3_SRC0A_CONST (1 << 5) -# define R300_FPI3_SRC1A_SHIFT 6 -# define R300_FPI3_SRC1A_MASK (31 << 6) -# define R300_FPI3_SRC1A_CONST (1 << 11) -# define R300_FPI3_SRC2A_SHIFT 12 -# define R300_FPI3_SRC2A_MASK (31 << 12) -# define R300_FPI3_SRC2A_CONST (1 << 17) -# define R300_FPI3_SRC_MASK 0x0003ffff -# define R300_FPI3_DSTA_SHIFT 18 -# define R300_FPI3_DSTA_MASK (31 << 18) -# define R300_FPI3_DSTA_REG (1 << 23) -# define R300_FPI3_DSTA_OUTPUT (1 << 24) -# define R300_FPI3_DSTA_DEPTH (1 << 27) - -#define R300_PFS_INSTR0_0 0x48C0 -# define R300_FPI0_ARGC_SRC0C_XYZ 0 -# define R300_FPI0_ARGC_SRC0C_XXX 1 -# define R300_FPI0_ARGC_SRC0C_YYY 2 -# define R300_FPI0_ARGC_SRC0C_ZZZ 3 -# define R300_FPI0_ARGC_SRC1C_XYZ 4 -# define R300_FPI0_ARGC_SRC1C_XXX 5 -# define R300_FPI0_ARGC_SRC1C_YYY 6 -# define R300_FPI0_ARGC_SRC1C_ZZZ 7 -# define R300_FPI0_ARGC_SRC2C_XYZ 8 -# define R300_FPI0_ARGC_SRC2C_XXX 9 -# define R300_FPI0_ARGC_SRC2C_YYY 10 -# define R300_FPI0_ARGC_SRC2C_ZZZ 11 -# define R300_FPI0_ARGC_SRC0A 12 -# define R300_FPI0_ARGC_SRC1A 13 -# define R300_FPI0_ARGC_SRC2A 14 -# define R300_FPI0_ARGC_SRC1C_LRP 15 -# define R300_FPI0_ARGC_ZERO 20 -# define R300_FPI0_ARGC_ONE 21 - /* GUESS */ -# define R300_FPI0_ARGC_HALF 22 -# define R300_FPI0_ARGC_SRC0C_YZX 23 -# define R300_FPI0_ARGC_SRC1C_YZX 24 -# define R300_FPI0_ARGC_SRC2C_YZX 25 -# define R300_FPI0_ARGC_SRC0C_ZXY 26 -# define R300_FPI0_ARGC_SRC1C_ZXY 27 -# define R300_FPI0_ARGC_SRC2C_ZXY 28 -# define R300_FPI0_ARGC_SRC0CA_WZY 29 -# define R300_FPI0_ARGC_SRC1CA_WZY 30 -# define R300_FPI0_ARGC_SRC2CA_WZY 31 - -# define R300_FPI0_ARG0C_SHIFT 0 -# define R300_FPI0_ARG0C_MASK (31 << 0) -# define R300_FPI0_ARG0C_NEG (1 << 5) -# define R300_FPI0_ARG0C_ABS (1 << 6) -# define R300_FPI0_ARG1C_SHIFT 7 -# define R300_FPI0_ARG1C_MASK (31 << 7) -# define R300_FPI0_ARG1C_NEG (1 << 12) -# define R300_FPI0_ARG1C_ABS (1 << 13) -# define R300_FPI0_ARG2C_SHIFT 14 -# define R300_FPI0_ARG2C_MASK (31 << 14) -# define R300_FPI0_ARG2C_NEG (1 << 19) -# define R300_FPI0_ARG2C_ABS (1 << 20) -# define R300_FPI0_SPECIAL_LRP (1 << 21) -# define R300_FPI0_OUTC_MAD (0 << 23) -# define R300_FPI0_OUTC_DP3 (1 << 23) -# define R300_FPI0_OUTC_DP4 (2 << 23) -# define R300_FPI0_OUTC_MIN (4 << 23) -# define R300_FPI0_OUTC_MAX (5 << 23) -# define R300_FPI0_OUTC_CMPH (7 << 23) -# define R300_FPI0_OUTC_CMP (8 << 23) -# define R300_FPI0_OUTC_FRC (9 << 23) -# define R300_FPI0_OUTC_REPL_ALPHA (10 << 23) -# define R300_FPI0_OUTC_SAT (1 << 30) -# define R300_FPI0_INSERT_NOP (1 << 31) - -#define R300_PFS_INSTR2_0 0x49C0 -# define R300_FPI2_ARGA_SRC0C_X 0 -# define R300_FPI2_ARGA_SRC0C_Y 1 -# define R300_FPI2_ARGA_SRC0C_Z 2 -# define R300_FPI2_ARGA_SRC1C_X 3 -# define R300_FPI2_ARGA_SRC1C_Y 4 -# define R300_FPI2_ARGA_SRC1C_Z 5 -# define R300_FPI2_ARGA_SRC2C_X 6 -# define R300_FPI2_ARGA_SRC2C_Y 7 -# define R300_FPI2_ARGA_SRC2C_Z 8 -# define R300_FPI2_ARGA_SRC0A 9 -# define R300_FPI2_ARGA_SRC1A 10 -# define R300_FPI2_ARGA_SRC2A 11 -# define R300_FPI2_ARGA_SRC1A_LRP 15 -# define R300_FPI2_ARGA_ZERO 16 -# define R300_FPI2_ARGA_ONE 17 - /* GUESS */ -# define R300_FPI2_ARGA_HALF 18 -# define R300_FPI2_ARG0A_SHIFT 0 -# define R300_FPI2_ARG0A_MASK (31 << 0) -# define R300_FPI2_ARG0A_NEG (1 << 5) - /* GUESS */ -# define R300_FPI2_ARG0A_ABS (1 << 6) -# define R300_FPI2_ARG1A_SHIFT 7 -# define R300_FPI2_ARG1A_MASK (31 << 7) -# define R300_FPI2_ARG1A_NEG (1 << 12) - /* GUESS */ -# define R300_FPI2_ARG1A_ABS (1 << 13) -# define R300_FPI2_ARG2A_SHIFT 14 -# define R300_FPI2_ARG2A_MASK (31 << 14) -# define R300_FPI2_ARG2A_NEG (1 << 19) - /* GUESS */ -# define R300_FPI2_ARG2A_ABS (1 << 20) -# define R300_FPI2_SPECIAL_LRP (1 << 21) -# define R300_FPI2_OUTA_MAD (0 << 23) -# define R300_FPI2_OUTA_DP4 (1 << 23) -# define R300_FPI2_OUTA_MIN (2 << 23) -# define R300_FPI2_OUTA_MAX (3 << 23) -# define R300_FPI2_OUTA_CMP (6 << 23) -# define R300_FPI2_OUTA_FRC (7 << 23) -# define R300_FPI2_OUTA_EX2 (8 << 23) -# define R300_FPI2_OUTA_LG2 (9 << 23) -# define R300_FPI2_OUTA_RCP (10 << 23) -# define R300_FPI2_OUTA_RSQ (11 << 23) -# define R300_FPI2_OUTA_SAT (1 << 30) -# define R300_FPI2_UNKNOWN_31 (1 << 31) +#define R300_US_ALU_RGB_ADDR_0 0x46C0 +# define R300_ALU_SRC0C_SHIFT 0 +# define R300_ALU_SRC0C_MASK (31 << 0) +# define R300_ALU_SRC0C_CONST (1 << 5) +# define R300_ALU_SRC1C_SHIFT 6 +# define R300_ALU_SRC1C_MASK (31 << 6) +# define R300_ALU_SRC1C_CONST (1 << 11) +# define R300_ALU_SRC2C_SHIFT 12 +# define R300_ALU_SRC2C_MASK (31 << 12) +# define R300_ALU_SRC2C_CONST (1 << 17) +# define R300_ALU_SRC_MASK 0x0003ffff +# define R300_ALU_DSTC_SHIFT 18 +# define R300_ALU_DSTC_MASK (31 << 18) +# define R300_ALU_DSTC_REG_MASK_SHIFT 23 +# define R300_ALU_DSTC_REG_X (1 << 23) +# define R300_ALU_DSTC_REG_Y (1 << 24) +# define R300_ALU_DSTC_REG_Z (1 << 25) +# define R300_ALU_DSTC_OUTPUT_MASK_SHIFT 26 +# define R300_ALU_DSTC_OUTPUT_X (1 << 26) +# define R300_ALU_DSTC_OUTPUT_Y (1 << 27) +# define R300_ALU_DSTC_OUTPUT_Z (1 << 28) + +#define R300_US_ALU_ALPHA_ADDR_0 0x47C0 +# define R300_ALU_SRC0A_SHIFT 0 +# define R300_ALU_SRC0A_MASK (31 << 0) +# define R300_ALU_SRC0A_CONST (1 << 5) +# define R300_ALU_SRC1A_SHIFT 6 +# define R300_ALU_SRC1A_MASK (31 << 6) +# define R300_ALU_SRC1A_CONST (1 << 11) +# define R300_ALU_SRC2A_SHIFT 12 +# define R300_ALU_SRC2A_MASK (31 << 12) +# define R300_ALU_SRC2A_CONST (1 << 17) +# define R300_ALU_SRC_MASK 0x0003ffff +# define R300_ALU_DSTA_SHIFT 18 +# define R300_ALU_DSTA_MASK (31 << 18) +# define R300_ALU_DSTA_REG (1 << 23) +# define R300_ALU_DSTA_OUTPUT (1 << 24) +# define R300_ALU_DSTA_DEPTH (1 << 27) + +#define R300_US_ALU_RGB_INST_0 0x48C0 +# define R300_ALU_ARGC_SRC0C_XYZ 0 +# define R300_ALU_ARGC_SRC0C_XXX 1 +# define R300_ALU_ARGC_SRC0C_YYY 2 +# define R300_ALU_ARGC_SRC0C_ZZZ 3 +# define R300_ALU_ARGC_SRC1C_XYZ 4 +# define R300_ALU_ARGC_SRC1C_XXX 5 +# define R300_ALU_ARGC_SRC1C_YYY 6 +# define R300_ALU_ARGC_SRC1C_ZZZ 7 +# define R300_ALU_ARGC_SRC2C_XYZ 8 +# define R300_ALU_ARGC_SRC2C_XXX 9 +# define R300_ALU_ARGC_SRC2C_YYY 10 +# define R300_ALU_ARGC_SRC2C_ZZZ 11 +# define R300_ALU_ARGC_SRC0A 12 +# define R300_ALU_ARGC_SRC1A 13 +# define R300_ALU_ARGC_SRC2A 14 +# define R300_ALU_ARGC_SRCP_XYZ 15 +# define R300_ALU_ARGC_SRCP_XXX 16 +# define R300_ALU_ARGC_SRCP_YYY 17 +# define R300_ALU_ARGC_SRCP_ZZZ 18 +# define R300_ALU_ARGC_SRCP_WWW 19 +# define R300_ALU_ARGC_ZERO 20 +# define R300_ALU_ARGC_ONE 21 +# define R300_ALU_ARGC_HALF 22 +# define R300_ALU_ARGC_SRC0C_YZX 23 +# define R300_ALU_ARGC_SRC1C_YZX 24 +# define R300_ALU_ARGC_SRC2C_YZX 25 +# define R300_ALU_ARGC_SRC0C_ZXY 26 +# define R300_ALU_ARGC_SRC1C_ZXY 27 +# define R300_ALU_ARGC_SRC2C_ZXY 28 +# define R300_ALU_ARGC_SRC0CA_WZY 29 +# define R300_ALU_ARGC_SRC1CA_WZY 30 +# define R300_ALU_ARGC_SRC2CA_WZY 31 + +# define R300_ALU_ARG0C_SHIFT 0 +# define R300_ALU_ARG0C_MASK (31 << 0) +# define R300_ALU_ARG0C_NOP (0 << 5) +# define R300_ALU_ARG0C_NEG (1 << 5) +# define R300_ALU_ARG0C_ABS (2 << 5) +# define R300_ALU_ARG0C_NAB (3 << 5) +# define R300_ALU_ARG1C_SHIFT 7 +# define R300_ALU_ARG1C_MASK (31 << 7) +# define R300_ALU_ARG1C_NOP (0 << 12) +# define R300_ALU_ARG1C_NEG (1 << 12) +# define R300_ALU_ARG1C_ABS (2 << 12) +# define R300_ALU_ARG1C_NAB (3 << 12) +# define R300_ALU_ARG2C_SHIFT 14 +# define R300_ALU_ARG2C_MASK (31 << 14) +# define R300_ALU_ARG2C_NOP (0 << 19) +# define R300_ALU_ARG2C_NEG (1 << 19) +# define R300_ALU_ARG2C_ABS (2 << 19) +# define R300_ALU_ARG2C_NAB (3 << 19) +# define R300_ALU_SRCP_1_MINUS_2_SRC0 (0 << 21) +# define R300_ALU_SRCP_SRC1_MINUS_SRC0 (1 << 21) +# define R300_ALU_SRCP_SRC1_PLUS_SRC0 (2 << 21) +# define R300_ALU_SRCP_1_MINUS_SRC0 (3 << 21) + +# define R300_ALU_OUTC_MAD (0 << 23) +# define R300_ALU_OUTC_DP3 (1 << 23) +# define R300_ALU_OUTC_DP4 (2 << 23) +# define R300_ALU_OUTC_D2A (3 << 23) +# define R300_ALU_OUTC_MIN (4 << 23) +# define R300_ALU_OUTC_MAX (5 << 23) +# define R300_ALU_OUTC_CMPH (7 << 23) +# define R300_ALU_OUTC_CMP (8 << 23) +# define R300_ALU_OUTC_FRC (9 << 23) +# define R300_ALU_OUTC_REPL_ALPHA (10 << 23) + +# define R300_ALU_OUTC_MOD_NOP (0 << 27) +# define R300_ALU_OUTC_MOD_MUL2 (1 << 27) +# define R300_ALU_OUTC_MOD_MUL4 (2 << 27) +# define R300_ALU_OUTC_MOD_MUL8 (3 << 27) +# define R300_ALU_OUTC_MOD_DIV2 (4 << 27) +# define R300_ALU_OUTC_MOD_DIV4 (5 << 27) +# define R300_ALU_OUTC_MOD_DIV8 (6 << 27) + +# define R300_ALU_OUTC_CLAMP (1 << 30) +# define R300_ALU_INSERT_NOP (1 << 31) + +#define R300_US_ALU_ALPHA_INST_0 0x49C0 +# define R300_ALU_ARGA_SRC0C_X 0 +# define R300_ALU_ARGA_SRC0C_Y 1 +# define R300_ALU_ARGA_SRC0C_Z 2 +# define R300_ALU_ARGA_SRC1C_X 3 +# define R300_ALU_ARGA_SRC1C_Y 4 +# define R300_ALU_ARGA_SRC1C_Z 5 +# define R300_ALU_ARGA_SRC2C_X 6 +# define R300_ALU_ARGA_SRC2C_Y 7 +# define R300_ALU_ARGA_SRC2C_Z 8 +# define R300_ALU_ARGA_SRC0A 9 +# define R300_ALU_ARGA_SRC1A 10 +# define R300_ALU_ARGA_SRC2A 11 +# define R300_ALU_ARGA_SRCP_X 12 +# define R300_ALU_ARGA_SRCP_Y 13 +# define R300_ALU_ARGA_SRCP_Z 14 +# define R300_ALU_ARGA_SRCP_W 15 + +# define R300_ALU_ARGA_ZERO 16 +# define R300_ALU_ARGA_ONE 17 +# define R300_ALU_ARGA_HALF 18 +# define R300_ALU_ARG0A_SHIFT 0 +# define R300_ALU_ARG0A_MASK (31 << 0) +# define R300_ALU_ARG0A_NOP (0 << 5) +# define R300_ALU_ARG0A_NEG (1 << 5) +# define R300_ALU_ARG0A_ABS (2 << 5) +# define R300_ALU_ARG0A_NAB (3 << 5) +# define R300_ALU_ARG1A_SHIFT 7 +# define R300_ALU_ARG1A_MASK (31 << 7) +# define R300_ALU_ARG1A_NOP (0 << 12) +# define R300_ALU_ARG1A_NEG (1 << 12) +# define R300_ALU_ARG1A_ABS (2 << 12) +# define R300_ALU_ARG1A_NAB (3 << 12) +# define R300_ALU_ARG2A_SHIFT 14 +# define R300_ALU_ARG2A_MASK (31 << 14) +# define R300_ALU_ARG2A_NOP (0 << 19) +# define R300_ALU_ARG2A_NEG (1 << 19) +# define R300_ALU_ARG2A_ABS (2 << 19) +# define R300_ALU_ARG2A_NAB (3 << 19) +# define R300_ALU_SRCP_1_MINUS_2_SRC0 (0 << 21) +# define R300_ALU_SRCP_SRC1_MINUS_SRC0 (1 << 21) +# define R300_ALU_SRCP_SRC1_PLUS_SRC0 (2 << 21) +# define R300_ALU_SRCP_1_MINUS_SRC0 (3 << 21) + +# define R300_ALU_OUTA_MAD (0 << 23) +# define R300_ALU_OUTA_DP4 (1 << 23) +# define R300_ALU_OUTA_MIN (2 << 23) +# define R300_ALU_OUTA_MAX (3 << 23) +# define R300_ALU_OUTA_CND (5 << 23) +# define R300_ALU_OUTA_CMP (6 << 23) +# define R300_ALU_OUTA_FRC (7 << 23) +# define R300_ALU_OUTA_EX2 (8 << 23) +# define R300_ALU_OUTA_LG2 (9 << 23) +# define R300_ALU_OUTA_RCP (10 << 23) +# define R300_ALU_OUTA_RSQ (11 << 23) + +# define R300_ALU_OUTA_MOD_NOP (0 << 27) +# define R300_ALU_OUTA_MOD_MUL2 (1 << 27) +# define R300_ALU_OUTA_MOD_MUL4 (2 << 27) +# define R300_ALU_OUTA_MOD_MUL8 (3 << 27) +# define R300_ALU_OUTA_MOD_DIV2 (4 << 27) +# define R300_ALU_OUTA_MOD_DIV4 (5 << 27) +# define R300_ALU_OUTA_MOD_DIV8 (6 << 27) + +# define R300_ALU_OUTA_CLAMP (1 << 30) /* END: Fragment program instruction set */ /* Fog: Fog Blending Enable */ -#define FG_FOG_BLEND 0x4bc0 -# define FG_FOG_BLEND_DISABLE (0 << 0) -# define FG_FOG_BLEND_ENABLE (1 << 0) -# define FG_FOG_BLEND_FN_LINEAR (0 << 1) -# define FG_FOG_BLEND_FN_EXP (1 << 1) -# define FG_FOG_BLEND_FN_EXP2 (2 << 1) -# define FG_FOG_BLEND_FN_CONSTANT (3 << 1) -# define FG_FOG_BLEND_FN_MASK 0x00000006 +#define R300_FG_FOG_BLEND 0x4bc0 +# define R300_FG_FOG_BLEND_DISABLE (0 << 0) +# define R300_FG_FOG_BLEND_ENABLE (1 << 0) +# define R300_FG_FOG_BLEND_FN_LINEAR (0 << 1) +# define R300_FG_FOG_BLEND_FN_EXP (1 << 1) +# define R300_FG_FOG_BLEND_FN_EXP2 (2 << 1) +# define R300_FG_FOG_BLEND_FN_CONSTANT (3 << 1) +# define R300_FG_FOG_BLEND_FN_MASK (3 << 1) /* Fog: Red Component of Fog Color */ -#define FG_FOG_COLOR_R 0x4bc8 +#define R300_FG_FOG_COLOR_R 0x4bc8 /* Fog: Green Component of Fog Color */ -#define FG_FOG_COLOR_G 0x4bcc +#define R300_FG_FOG_COLOR_G 0x4bcc /* Fog: Blue Component of Fog Color */ -#define FG_FOG_COLOR_B 0x4bd0 -# define FG_FOG_COLOR_MASK 0x000001ff +#define R300_FG_FOG_COLOR_B 0x4bd0 +# define R300_FG_FOG_COLOR_MASK 0x000003ff /* Fog: Constant Factor for Fog Blending */ -#define FG_FOG_FACTOR 0x4bc4 -# define FG_FOG_FACTOR_MASK 0x000001ff +#define R300_FG_FOG_FACTOR 0x4bc4 +# define FG_FOG_FACTOR_MASK 0x000003ff /* Fog: Alpha function */ -#define FG_ALPHA_FUNC 0x4bd4 -# define R300_REF_ALPHA_MASK 0x000000ff -# define FG_ALPHA_FUNC_NEVER (0 << 8) -# define FG_ALPHA_FUNC_LESS (1 << 8) -# define FG_ALPHA_FUNC_EQUAL (2 << 8) -# define FG_ALPHA_FUNC_LE (3 << 8) -# define FG_ALPHA_FUNC_GREATER (4 << 8) -# define FG_ALPHA_FUNC_NOTEQUAL (5 << 8) -# define FG_ALPHA_FUNC_GE (6 << 8) -# define FG_ALPHA_FUNC_ALWAYS (7 << 8) -# define R300_ALPHA_TEST_OP_MASK (7 << 8) -# define FG_ALPHA_FUNC_DISABLE (0 << 11) -# define FG_ALPHA_FUNC_ENABLE (1 << 11) -# define FG_ALPHA_FUNC_10BIT (0 << 12) -# define FG_ALPHA_FUNC_8BIT (1 << 12) -/* gap in AMD spec */ -# define FG_ALPHA_FUNC_MASK_DISABLE (0 << 16) -# define FG_ALPHA_FUNC_MASK_ENABLE (1 << 16) -# define FG_ALPHA_FUNC_CFG_2_OF_4 (0 << 17) -# define FG_ALPHA_FUNC_CFG_3_OF_6 (1 << 17) -/* gap in AMD spec */ -# define FG_ALPHA_FUNC_DITH_DISABLE (0 << 20) -# define FG_ALPHA_FUNC_DITH_ENABLE (1 << 20) -/* gap in AMD spec */ -# define FG_ALPHA_FUNC_OFFSET_DISABLE (0 << 24) /* Not supported in R520. Default R300 and RV350 behaviour. */ -# define FG_ALPHA_FUNC_OFFSET_ENABLE (1 << 24) /* Not supported in R520 */ -# define FG_ALPHA_FUNC_DISC_ZERO_MASK_DISABLE (0 << 25) -# define FG_ALPHA_FUNC_DISC_ZERO_MASK_ENABLE (1 << 25) -/* gap in AMD spec */ -# define FG_ALPHA_FUNC_FP16_DISABLE (0 << 28) -# define FG_ALPHA_FUNC_FP16_ENABLE (1 << 28) -/* gap in AMD spec */ +#define R300_FG_ALPHA_FUNC 0x4bd4 +# define R300_FG_ALPHA_FUNC_VAL_MASK 0x000000ff +# define R300_FG_ALPHA_FUNC_NEVER (0 << 8) +# define R300_FG_ALPHA_FUNC_LESS (1 << 8) +# define R300_FG_ALPHA_FUNC_EQUAL (2 << 8) +# define R300_FG_ALPHA_FUNC_LE (3 << 8) +# define R300_FG_ALPHA_FUNC_GREATER (4 << 8) +# define R300_FG_ALPHA_FUNC_NOTEQUAL (5 << 8) +# define R300_FG_ALPHA_FUNC_GE (6 << 8) +# define R300_FG_ALPHA_FUNC_ALWAYS (7 << 8) +# define R300_ALPHA_TEST_OP_MASK (7 << 8) +# define R300_FG_ALPHA_FUNC_DISABLE (0 << 11) +# define R300_FG_ALPHA_FUNC_ENABLE (1 << 11) + +# define R500_FG_ALPHA_FUNC_10BIT (0 << 12) +# define R500_FG_ALPHA_FUNC_8BIT (1 << 12) + +# define R300_FG_ALPHA_FUNC_MASK_DISABLE (0 << 16) +# define R300_FG_ALPHA_FUNC_MASK_ENABLE (1 << 16) +# define R300_FG_ALPHA_FUNC_CFG_2_OF_4 (0 << 17) +# define R300_FG_ALPHA_FUNC_CFG_3_OF_6 (1 << 17) + +# define R300_FG_ALPHA_FUNC_DITH_DISABLE (0 << 20) +# define R300_FG_ALPHA_FUNC_DITH_ENABLE (1 << 20) + +# define R500_FG_ALPHA_FUNC_OFFSET_DISABLE (0 << 24) +# define R500_FG_ALPHA_FUNC_OFFSET_ENABLE (1 << 24) /* Not supported in R520 */ +# define R500_FG_ALPHA_FUNC_DISC_ZERO_MASK_DISABLE (0 << 25) +# define R500_FG_ALPHA_FUNC_DISC_ZERO_MASK_ENABLE (1 << 25) + +# define R500_FG_ALPHA_FUNC_FP16_DISABLE (0 << 28) +# define R500_FG_ALPHA_FUNC_FP16_ENABLE (1 << 28) + /* Fog: Where does the depth come from? */ #define R300_FG_DEPTH_SRC 0x4bd8 @@ -1917,8 +2002,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_FG_DEPTH_SRC_SHADER (1 << 0) /* Fog: Alpha Compare Value */ -#define FG_ALPHA_VALUE 0x4be0 -# define FG_ALPHA_VALUE_MASK 0x0000ffff +#define R500_FG_ALPHA_VALUE 0x4be0 +# define R500_FG_ALPHA_VALUE_MASK 0x0000ffff /* gap */ @@ -1927,7 +2012,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_PFS_PARAM_0_Y 0x4C04 #define R300_PFS_PARAM_0_Z 0x4C08 #define R300_PFS_PARAM_0_W 0x4C0C -/* GUESS: PARAM_31 is last, based on native limits reported by fglrx */ +/* last consts */ #define R300_PFS_PARAM_31_X 0x4DF0 #define R300_PFS_PARAM_31_Y 0x4DF4 #define R300_PFS_PARAM_31_Z 0x4DF8 @@ -1935,14 +2020,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Unpipelined. */ #define R300_RB3D_CCTL 0x4e00 -/* gap in AMD docs */ # define R300_RB3D_CCTL_NUM_MULTIWRITES_1_BUFFER (0 << 5) # define R300_RB3D_CCTL_NUM_MULTIWRITES_2_BUFFERS (1 << 5) # define R300_RB3D_CCTL_NUM_MULTIWRITES_3_BUFFERS (2 << 5) # define R300_RB3D_CCTL_NUM_MULTIWRITES_4_BUFFERS (3 << 5) # define R300_RB3D_CCTL_CLRCMP_FLIPE_DISABLE (0 << 7) # define R300_RB3D_CCTL_CLRCMP_FLIPE_ENABLE (1 << 7) -/* gap in AMD docs */ # define R300_RB3D_CCTL_AA_COMPRESSION_DISABLE (0 << 9) # define R300_RB3D_CCTL_AA_COMPRESSION_ENABLE (1 << 9) # define R300_RB3D_CCTL_CMASK_DISABLE (0 << 10) @@ -1967,9 +2050,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_RB3D_CBLEND 0x4E04 #define R300_RB3D_ABLEND 0x4E08 /* the following only appear in CBLEND */ -# define R300_BLEND_ENABLE (1 << 0) -# define R300_BLEND_UNKNOWN (3 << 1) -# define R300_BLEND_NO_SEPARATE (1 << 3) +# define R300_ALPHA_BLEND_ENABLE (1 << 0) +# define R300_SEPARATE_ALPHA_ENABLE (1 << 1) +# define R300_READ_ENABLE (1 << 2) +# define R300_DISCARD_SRC_PIXELS_DIS (0 << 3) +# define R300_DISCARD_SRC_PIXELS_SRC_ALPHA_0 (1 << 3) +# define R300_DISCARD_SRC_PIXELS_SRC_COLOR_0 (2 << 3) +# define R300_DISCARD_SRC_PIXELS_SRC_ALPHA_COLOR_0 (3 << 3) +# define R300_DISCARD_SRC_PIXELS_SRC_ALPHA_1 (4 << 3) +# define R300_DISCARD_SRC_PIXELS_SRC_COLOR_1 (5 << 3) +# define R300_DISCARD_SRC_PIXELS_SRC_ALPHA_COLOR_1 (6 << 3) + /* the following are shared between CBLEND and ABLEND */ # define R300_FCN_MASK (3 << 12) # define R300_COMB_FCN_ADD_CLAMP (0 << 12) @@ -2044,7 +2135,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Color Buffer Address Offset of multibuffer 0. Unpipelined. */ #define R300_RB3D_COLOROFFSET0 0x4E28 -# define R300_COLOROFFSET_MASK 0xFFFFFFF0 /* GUESS */ +# define R300_COLOROFFSET_MASK 0xFFFFFFE0 /* Color Buffer Address Offset of multibuffer 1. Unpipelined. */ #define R300_RB3D_COLOROFFSET1 0x4E2C /* Color Buffer Address Offset of multibuffer 2. Unpipelined. */ @@ -2061,7 +2152,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Bit 18: Extremely weird tile like, but some pixels duplicated? */ #define R300_RB3D_COLORPITCH0 0x4E38 -# define R300_COLORPITCH_MASK 0x00001FF8 /* GUESS, should be 13:1 */ +# define R300_COLORPITCH_MASK 0x00003FFE # define R300_COLOR_TILE_DISABLE (0 << 16) # define R300_COLOR_TILE_ENABLE (1 << 16) # define R300_COLOR_MICROTILE_DISABLE (0 << 17) @@ -2071,12 +2162,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_COLOR_ENDIAN_WORD_SWAP (1 << 19) # define R300_COLOR_ENDIAN_DWORD_SWAP (2 << 19) # define R300_COLOR_ENDIAN_HALF_DWORD_SWAP (3 << 19) -# define R300_COLOR_FORMAT_ARGB10101010 (0 << 21) -# define R300_COLOR_FORMAT_UV1010 (1 << 21) -# define R300_COLOR_FORMAT_CI8 (2 << 21) /* 2D only */ +# define R500_COLOR_FORMAT_ARGB10101010 (0 << 21) +# define R500_COLOR_FORMAT_UV1010 (1 << 21) +# define R500_COLOR_FORMAT_CI8 (2 << 21) /* 2D only */ # define R300_COLOR_FORMAT_ARGB1555 (3 << 21) # define R300_COLOR_FORMAT_RGB565 (4 << 21) -# define R300_COLOR_FORMAT_ARGB2101010 (5 << 21) +# define R500_COLOR_FORMAT_ARGB2101010 (5 << 21) # define R300_COLOR_FORMAT_ARGB8888 (6 << 21) # define R300_COLOR_FORMAT_ARGB32323232 (7 << 21) /* reserved */ @@ -2085,7 +2176,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_COLOR_FORMAT_VYUY (11 << 21) # define R300_COLOR_FORMAT_YVYU (12 << 21) # define R300_COLOR_FORMAT_UV88 (13 << 21) -# define R300_COLOR_FORMAT_I10 (14 << 21) +# define R500_COLOR_FORMAT_I10 (14 << 21) # define R300_COLOR_FORMAT_ARGB4444 (15 << 21) #define R300_RB3D_COLORPITCH1 0x4E3C #define R300_RB3D_COLORPITCH2 0x4E40 @@ -2104,16 +2195,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Set to 0A before 3D operations, set to 02 afterwards. */ #define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c -# define RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_NO_EFFECT (0 << 0) -# define RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_NO_EFFECT_1 (1 << 0) -# define RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D (2 << 0) -# define RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D_1 (3 << 0) -# define RB3D_DSTCACHE_CTLSTAT_DC_FREE_NO_EFFECT (0 << 2) -# define RB3D_DSTCACHE_CTLSTAT_DC_FREE_NO_EFFECT_1 (1 << 2) -# define RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS (2 << 2) -# define RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS_1 (3 << 2) -# define RB3D_DSTCACHE_CTLSTAT_DC_FINISH_NO_SIGNAL (0 << 4) -# define RB3D_DSTCACHE_CTLSTAT_DC_FINISH_SIGNAL (1 << 4) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_NO_EFFECT (0 << 0) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_NO_EFFECT_1 (1 << 0) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D (2 << 0) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D_1 (3 << 0) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_NO_EFFECT (0 << 2) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_NO_EFFECT_1 (1 << 2) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS (2 << 2) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS_1 (3 << 2) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FINISH_NO_SIGNAL (0 << 4) +# define R300_RB3D_DSTCACHE_CTLSTAT_DC_FINISH_SIGNAL (1 << 4) #define R300_RB3D_DITHER_CTL 0x4E50 # define R300_RB3D_DITHER_CTL_DITHER_MODE_TRUNCATE (0 << 0) @@ -2128,87 +2219,81 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Resolve buffer destination address. The cache must be empty before changing * this register if the cb is in resolve mode. Unpipelined */ -#define RB3D_AARESOLVE_OFFSET 0x4e80 -# define RB3D_AARESOLVE_OFFSET_SHIFT 5 -# define RB3D_AARESOLVE_OFFSET_MASK 0xffffffe0 /* At least according to the calculations of Christoph Brill */ +#define R300_RB3D_AARESOLVE_OFFSET 0x4e80 +# define R300_RB3D_AARESOLVE_OFFSET_SHIFT 5 +# define R300_RB3D_AARESOLVE_OFFSET_MASK 0xffffffe0 /* At least according to the calculations of Christoph Brill */ /* Resolve Buffer Pitch and Tiling Control. The cache must be empty before * changing this register if the cb is in resolve mode. Unpipelined */ -#define RB3D_AARESOLVE_PITCH 0x4e84 -# define RB3D_AARESOLVE_PITCH_SHIFT 1 -# define RB3D_AARESOLVE_PITCH_MASK 0x00003ffe /* At least according to the calculations of Christoph Brill */ +#define R300_RB3D_AARESOLVE_PITCH 0x4e84 +# define R300_RB3D_AARESOLVE_PITCH_SHIFT 1 +# define R300_RB3D_AARESOLVE_PITCH_MASK 0x00003ffe /* At least according to the calculations of Christoph Brill */ /* Resolve Buffer Control. Unpipelined */ -#define RB3D_AARESOLVE_CTL 0x4e88 -# define RB3D_AARESOLVE_CTL_AARESOLVE_MODE_NORMAL (0 << 0) -# define RB3D_AARESOLVE_CTL_AARESOLVE_MODE_RESOLVE (1 << 0) -# define RB3D_AARESOLVE_CTL_AARESOLVE_GAMMA_10 (0 << 1) -# define RB3D_AARESOLVE_CTL_AARESOLVE_GAMMA_22 (1 << 1) -# define RB3D_AARESOLVE_CTL_AARESOLVE_ALPHA_SAMPLE0 (0 << 2) -# define RB3D_AARESOLVE_CTL_AARESOLVE_ALPHA_AVERAGE (1 << 2) +#define R300_RB3D_AARESOLVE_CTL 0x4e88 +# define R300_RB3D_AARESOLVE_CTL_AARESOLVE_MODE_NORMAL (0 << 0) +# define R300_RB3D_AARESOLVE_CTL_AARESOLVE_MODE_RESOLVE (1 << 0) +# define R300_RB3D_AARESOLVE_CTL_AARESOLVE_GAMMA_10 (0 << 1) +# define R300_RB3D_AARESOLVE_CTL_AARESOLVE_GAMMA_22 (1 << 1) +# define R300_RB3D_AARESOLVE_CTL_AARESOLVE_ALPHA_SAMPLE0 (0 << 2) +# define R300_RB3D_AARESOLVE_CTL_AARESOLVE_ALPHA_AVERAGE (1 << 2) /* Discard src pixels less than or equal to threshold. */ -#define RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD 0x4ea0 +#define R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD 0x4ea0 /* Discard src pixels greater than or equal to threshold. */ -#define RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD 0x4ea4 -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_BLUE_SHIFT 0 -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_BLUE_MASK 0x000000ff -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_GREEN_SHIFT 8 -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_GREEN_MASK 0x0000ff00 -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_RED_SHIFT 16 -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_RED_MASK 0x00ff0000 -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_ALPHA_SHIFT 24 -# define RB3D_DISCARD_SRC_PIXEL_THRESHOLD_ALPHA_MASK 0xff000000 +#define R500_RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD 0x4ea4 +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_BLUE_SHIFT 0 +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_BLUE_MASK 0x000000ff +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_GREEN_SHIFT 8 +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_GREEN_MASK 0x0000ff00 +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_RED_SHIFT 16 +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_RED_MASK 0x00ff0000 +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_ALPHA_SHIFT 24 +# define R500_RB3D_DISCARD_SRC_PIXEL_THRESHOLD_ALPHA_MASK 0xff000000 /* 3D ROP Control. Stalls the 2d/3d datapath until it is idle. */ -#define RB3D_ROPCNTL 0x4e18 +#define R300_RB3D_ROPCNTL 0x4e18 /* TODO: fill in content here */ /* Color Compare Flip. Stalls the 2d/3d datapath until it is idle. */ -#define RB3D_CLRCMP_FLIPE 0x4e1c +#define R300_RB3D_CLRCMP_FLIPE 0x4e1c /* Sets the fifo sizes */ -#define RB3D_FIFO_SIZE 0x4ef4 -# define RB3D_FIFO_SIZE_OP_FIFO_SIZE_FULL (0 << 0) -# define RB3D_FIFO_SIZE_OP_FIFO_SIZE_HALF (1 << 0) -# define RB3D_FIFO_SIZE_OP_FIFO_SIZE_QUATER (2 << 0) -# define RB3D_FIFO_SIZE_OP_FIFO_SIZE_EIGTHS (3 << 0) -/* gap in AMD spec */ +#define R500_RB3D_FIFO_SIZE 0x4ef4 +# define R500_RB3D_FIFO_SIZE_OP_FIFO_SIZE_FULL (0 << 0) +# define R500_RB3D_FIFO_SIZE_OP_FIFO_SIZE_HALF (1 << 0) +# define R500_RB3D_FIFO_SIZE_OP_FIFO_SIZE_QUATER (2 << 0) +# define R500_RB3D_FIFO_SIZE_OP_FIFO_SIZE_EIGTHS (3 << 0) /* Constant color used by the blender. Pipelined through the blender. */ -#define RB3D_CONSTANT_COLOR_AR 0x4ef8 -# define RB3D_CONSTANT_COLOR_AR_RED_MASK 0x0000ffff -# define RB3D_CONSTANT_COLOR_AR_RED_SHIFT 0 -# define RB3D_CONSTANT_COLOR_AR_ALPHA_MASK 0xffff0000 -# define RB3D_CONSTANT_COLOR_AR_ALPHA_SHIFT 16 +#define R500_RB3D_CONSTANT_COLOR_AR 0x4ef8 +# define R500_RB3D_CONSTANT_COLOR_AR_RED_MASK 0x0000ffff +# define R500_RB3D_CONSTANT_COLOR_AR_RED_SHIFT 0 +# define R500_RB3D_CONSTANT_COLOR_AR_ALPHA_MASK 0xffff0000 +# define R500_RB3D_CONSTANT_COLOR_AR_ALPHA_SHIFT 16 /* Constant color used by the blender. Pipelined through the blender. */ -#define RB3D_CONSTANT_COLOR_GB 0x4efc -# define RB3D_CONSTANT_COLOR_AR_BLUE_MASK 0x0000ffff -# define RB3D_CONSTANT_COLOR_AR_BLUE_SHIFT 0 -# define RB3D_CONSTANT_COLOR_AR_GREEN_MASK 0xffff0000 -# define RB3D_CONSTANT_COLOR_AR_GREEN_SHIFT 16 +#define R500_RB3D_CONSTANT_COLOR_GB 0x4efc +# define R500_RB3D_CONSTANT_COLOR_AR_BLUE_MASK 0x0000ffff +# define R500_RB3D_CONSTANT_COLOR_AR_BLUE_SHIFT 0 +# define R500_RB3D_CONSTANT_COLOR_AR_GREEN_MASK 0xffff0000 +# define R500_RB3D_CONSTANT_COLOR_AR_GREEN_SHIFT 16 /* gap */ /* There seems to be no "write only" setting, so use Z-test = ALWAYS * for this. * Bit (1<<8) is the "test" bit. so plain write is 6 - vd */ -#define R300_RB3D_ZSTENCIL_CNTL_0 0x4F00 -# define R300_RB3D_Z_DISABLED_1 0x00000010 -# define R300_RB3D_Z_DISABLED_2 0x00000014 -# define R300_RB3D_Z_TEST 0x00000012 -# define R300_RB3D_Z_TEST_AND_WRITE 0x00000016 -# define R300_RB3D_Z_WRITE_ONLY 0x00000006 - -# define R300_RB3D_Z_TEST 0x00000012 -# define R300_RB3D_Z_TEST_AND_WRITE 0x00000016 -# define R300_RB3D_Z_WRITE_ONLY 0x00000006 -# define R300_RB3D_STENCIL_ENABLE 0x00000001 - -#define R300_RB3D_ZSTENCIL_CNTL_1 0x4f04 +#define R300_ZB_CNTL 0x4F00 +# define R300_STENCIL_ENABLE (1 << 0) +# define R300_Z_ENABLE (1 << 1) +# define R300_Z_WRITE_ENABLE (1 << 2) +# define R300_Z_SIGNED_COMPARE (1 << 3) +# define R300_STENCIL_FRONT_BACK (1 << 4) + +#define R300_ZB_ZSTENCILCNTL 0x4f04 /* functions */ # define R300_ZS_NEVER 0 # define R300_ZS_LESS 1 @@ -2228,51 +2313,49 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_ZS_INVERT 5 # define R300_ZS_INCR_WRAP 6 # define R300_ZS_DECR_WRAP 7 +# define R300_Z_FUNC_SHIFT 0 /* front and back refer to operations done for front and back faces, i.e. separate stencil function support */ -# define R300_RB3D_ZS1_DEPTH_FUNC_SHIFT 0 -# define R300_RB3D_ZS1_FRONT_FUNC_SHIFT 3 -# define R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT 6 -# define R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT 9 -# define R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT 12 -# define R300_RB3D_ZS1_BACK_FUNC_SHIFT 15 -# define R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT 18 -# define R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT 21 -# define R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT 24 - -#define ZB_STENCILREFMASK 0x4f08 -# define ZB_STENCILREFMASK_STENCILREF_SHIFT 0 -# define ZB_STENCILREFMASK_STENCIL_MASK 0xff -# define ZB_STENCILREFMASK_STENCILREF_MASK 0x000000ff -# define ZB_STENCILREFMASK_STENCILMASK_SHIFT 8 -# define ZB_STENCILREFMASK_STENCILMASK_MASK 0x0000ff00 -# define ZB_STENCILREFMASK_STENCILWRITEMASK_SHIFT 16 -# define ZB_STENCILREFMASK_STENCILWRITEMASK_MASK 0xffff0000 +# define R300_S_FRONT_FUNC_SHIFT 3 +# define R300_S_FRONT_SFAIL_OP_SHIFT 6 +# define R300_S_FRONT_ZPASS_OP_SHIFT 9 +# define R300_S_FRONT_ZFAIL_OP_SHIFT 12 +# define R300_S_BACK_FUNC_SHIFT 15 +# define R300_S_BACK_SFAIL_OP_SHIFT 18 +# define R300_S_BACK_ZPASS_OP_SHIFT 21 +# define R300_S_BACK_ZFAIL_OP_SHIFT 24 + +#define R300_ZB_STENCILREFMASK 0x4f08 +# define R300_STENCILREF_SHIFT 0 +# define R300_STENCILREF_MASK 0x000000ff +# define R300_STENCILMASK_SHIFT 8 +# define R300_STENCILMASK_MASK 0x0000ff00 +# define R300_STENCILWRITEMASK_SHIFT 16 +# define R300_STENCILWRITEMASK_MASK 0x00ff0000 /* gap */ -#define ZB_FORMAT 0x4f10 -# define ZB_FORMAR_DEPTHFORMAT_16BIT_INT_Z (0 << 0) -# define ZB_FORMAR_DEPTHFORMAT_16BIT_13E3 (1 << 0) -# define ZB_FORMAR_DEPTHFORMAT_24BIT_INT_Z (2 << 0) +#define R300_ZB_FORMAT 0x4f10 +# define R300_DEPTHFORMAT_16BIT_INT_Z (0 << 0) +# define R300_DEPTHFORMAT_16BIT_13E3 (1 << 0) +# define R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL (2 << 0) /* reserved up to (15 << 0) */ -# define ZB_FORMAR_INVERT_13E3_LEADING_ONES (0 << 4) -# define ZB_FORMAR_INVERT_13E3_LEADING_ZEROS (1 << 4) -# define ZB_FORMAR_PEQ8_UNUSED (1 << 5) +# define R300_INVERT_13E3_LEADING_ONES (0 << 4) +# define R300_INVERT_13E3_LEADING_ZEROS (1 << 4) -#define R300_RB3D_EARLY_Z 0x4F14 -# define R300_EARLY_Z_DISABLE (0 << 0) -# define R300_EARLY_Z_ENABLE (1 << 0) +#define R300_ZB_ZTOP 0x4F14 +# define R300_ZTOP_DISABLE (0 << 0) +# define R300_ZTOP_ENABLE (1 << 0) /* gap */ -#define ZB_ZCACHE_CTLSTAT 0x4f18 -# define ZB_ZCACHE_CTLSTAT_ZC_FLUSH_NO_EFFECT (0 << 0) -# define ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE (1 << 0) -# define ZB_ZCACHE_CTLSTAT_ZC_FREE_NO_EFFECT (0 << 1) -# define ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE (1 << 1) -# define ZB_ZCACHE_CTLSTAT_ZC_BUSY_IDLE (0 << 31) -# define ZB_ZCACHE_CTLSTAT_ZC_BUSY_BUSY (1 << 31) +#define R300_ZB_ZCACHE_CTLSTAT 0x4f18 +# define R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_NO_EFFECT (0 << 0) +# define R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE (1 << 0) +# define R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_NO_EFFECT (0 << 1) +# define R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE (1 << 1) +# define R300_ZB_ZCACHE_CTLSTAT_ZC_BUSY_IDLE (0 << 31) +# define R300_ZB_ZCACHE_CTLSTAT_ZC_BUSY_BUSY (1 << 31) #define R300_ZB_BW_CNTL 0x4f1c # define R300_HIZ_DISABLE (0 << 0) @@ -2289,31 +2372,32 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_ZB_CB_CLEAR_CACHE_LINEAR (1 << 5) # define R300_FORCE_COMPRESSED_STENCIL_VALUE_DISABLE (0 << 6) # define R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE (1 << 6) -# define R300_ZEQUAL_OPTIMIZE_ENABLE (0 << 7) -# define R300_ZEQUAL_OPTIMIZE_DISABLE (1 << 7) -# define R300_SEQUAL_OPTIMIZE_ENABLE (0 << 8) -# define R300_SEQUAL_OPTIMIZE_DISABLE (1 << 8) -/* gap in AMD docs */ -# define R300_BMASK_ENABLE (0 << 10) -# define R300_BMASK_DISABLE (1 << 10) -# define R300_HIZ_EQUAL_REJECT_DISABLE (0 << 11) -# define R300_HIZ_EQUAL_REJECT_ENABLE (1 << 11) -# define R300_HIZ_FP_EXP_BITS_DISABLE (0 << 12) -# define R300_HIZ_FP_EXP_BITS_1 (1 << 12) -# define R300_HIZ_FP_EXP_BITS_2 (2 << 12) -# define R300_HIZ_FP_EXP_BITS_3 (3 << 12) -# define R300_HIZ_FP_EXP_BITS_4 (4 << 12) -# define R300_HIZ_FP_EXP_BITS_5 (5 << 12) -# define R300_HIZ_FP_INVERT_LEADING_ONES (0 << 15) -# define R300_HIZ_FP_INVERT_LEADING_ZEROS (1 << 15) -# define R300_TILE_OVERWRITE_RECOMPRESSION_ENABLE (0 << 16) -# define R300_TILE_OVERWRITE_RECOMPRESSION_DISABLE (1 << 16) -# define R300_CONTIGUOUS_6XAA_SAMPLES_ENABLE (0 << 17) -# define R300_CONTIGUOUS_6XAA_SAMPLES_DISABLE (1 << 17) -# define R300_PEQ_PACKING_DISABLE (0 << 18) -# define R300_PEQ_PACKING_ENABLE (1 << 18) -# define R300_COVERED_PTR_MASKING_DISABLE (0 << 18) -# define R300_COVERED_PTR_MASKING_ENABLE (1 << 18) + +# define R500_ZEQUAL_OPTIMIZE_ENABLE (0 << 7) +# define R500_ZEQUAL_OPTIMIZE_DISABLE (1 << 7) +# define R500_SEQUAL_OPTIMIZE_ENABLE (0 << 8) +# define R500_SEQUAL_OPTIMIZE_DISABLE (1 << 8) + +# define R500_BMASK_ENABLE (0 << 10) +# define R500_BMASK_DISABLE (1 << 10) +# define R500_HIZ_EQUAL_REJECT_DISABLE (0 << 11) +# define R500_HIZ_EQUAL_REJECT_ENABLE (1 << 11) +# define R500_HIZ_FP_EXP_BITS_DISABLE (0 << 12) +# define R500_HIZ_FP_EXP_BITS_1 (1 << 12) +# define R500_HIZ_FP_EXP_BITS_2 (2 << 12) +# define R500_HIZ_FP_EXP_BITS_3 (3 << 12) +# define R500_HIZ_FP_EXP_BITS_4 (4 << 12) +# define R500_HIZ_FP_EXP_BITS_5 (5 << 12) +# define R500_HIZ_FP_INVERT_LEADING_ONES (0 << 15) +# define R500_HIZ_FP_INVERT_LEADING_ZEROS (1 << 15) +# define R500_TILE_OVERWRITE_RECOMPRESSION_ENABLE (0 << 16) +# define R500_TILE_OVERWRITE_RECOMPRESSION_DISABLE (1 << 16) +# define R500_CONTIGUOUS_6XAA_SAMPLES_ENABLE (0 << 17) +# define R500_CONTIGUOUS_6XAA_SAMPLES_DISABLE (1 << 17) +# define R500_PEQ_PACKING_DISABLE (0 << 18) +# define R500_PEQ_PACKING_ENABLE (1 << 18) +# define R500_COVERED_PTR_MASKING_DISABLE (0 << 18) +# define R500_COVERED_PTR_MASKING_ENABLE (1 << 18) /* gap */ @@ -2321,67 +2405,68 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Z Buffer Address Offset. * Bits 31 to 5 are used for aligned Z buffer address offset for macro tiles. */ -#define ZB_DEPTHOFFSET 0x4f20 +#define R300_ZB_DEPTHOFFSET 0x4f20 /* Z Buffer Pitch and Endian Control */ -#define ZB_DEPTHPITCH 0x4f24 -# define R300_DEPTHPITCH_MASK 0x00001FF8 /* TODO: should be (13:2) */ -# define ZB_DEPTHPITCH_DEPTHMACROTILE_DISABLE (0 << 16) -# define ZB_DEPTHPITCH_DEPTHMACROTILE_ENABLE (1 << 16) -# define ZB_DEPTHPITCH_DEPTHMICROTILE_LINEAR (0 << 17) -# define ZB_DEPTHPITCH_DEPTHMICROTILE_TILED (1 << 17) -# define ZB_DEPTHPITCH_DEPTHMICROTILE_TILED_SQUARE (2 << 17) -# define ZB_DEPTHPITCH_DEPTHENDIAN_NO_SWAP (0 << 18) -# define ZB_DEPTHPITCH_DEPTHENDIAN_WORD_SWAP (1 << 18) -# define ZB_DEPTHPITCH_DEPTHENDIAN_DWORD_SWAP (2 << 18) -# define ZB_DEPTHPITCH_DEPTHENDIAN_HALF_DWORD_SWAP (3 << 18) +#define R300_ZB_DEPTHPITCH 0x4f24 +# define R300_DEPTHPITCH_MASK 0x00003FFC +# define R300_DEPTHMACROTILE_DISABLE (0 << 16) +# define R300_DEPTHMACROTILE_ENABLE (1 << 16) +# define R300_DEPTHMICROTILE_LINEAR (0 << 17) +# define R300_DEPTHMICROTILE_TILED (1 << 17) +# define R300_DEPTHMICROTILE_TILED_SQUARE (2 << 17) +# define R300_DEPTHENDIAN_NO_SWAP (0 << 18) +# define R300_DEPTHENDIAN_WORD_SWAP (1 << 18) +# define R300_DEPTHENDIAN_DWORD_SWAP (2 << 18) +# define R300_DEPTHENDIAN_HALF_DWORD_SWAP (3 << 18) /* Z Buffer Clear Value */ -#define ZB_DEPTHCLEARVALUE 0x4f28 +#define R300_ZB_DEPTHCLEARVALUE 0x4f28 /* Hierarchical Z Memory Offset */ -#define ZB_HIZ_OFFSET 0x4f44 +#define R300_ZB_HIZ_OFFSET 0x4f44 -/* Hierarchical Z Read Index */ -#define ZB_HIZ_RDINDEX 0x4f48 +/* Hierarchical Z Write Index */ +#define R300_ZB_HIZ_WRINDEX 0x4f48 /* Hierarchical Z Data */ -#define ZB_HIZ_DWORD 0x4f4c +#define R300_ZB_HIZ_DWORD 0x4f4c -/* Hierarchical Z Write Index */ -#define ZB_HIZ_WRINDEX 0x4f50 +/* Hierarchical Z Read Index */ +#define R300_ZB_HIZ_RDINDEX 0x4f50 /* Hierarchical Z Pitch */ -#define ZB_HIZ_PITCH 0x4f54 +#define R300_ZB_HIZ_PITCH 0x4f54 /* Z Buffer Z Pass Counter Data */ -#define ZB_ZPASS_DATA 0x4f58 +#define R300_ZB_ZPASS_DATA 0x4f58 /* Z Buffer Z Pass Counter Address */ -#define ZB_ZPASS_ADDR 0x4f5c +#define R300_ZB_ZPASS_ADDR 0x4f5c /* Depth buffer X and Y coordinate offset */ -#define ZB_DEPTHXY_OFFSET 0x4f60 -# define ZB_DEPTHX_OFFSET_SHIFT 1 -# define ZB_DEPTHX_OFFSET_MASK 0x000007FE -# define ZB_DEPTHY_OFFSET_SHIFT 17 -# define ZB_DEPTHY_OFFSET_MASK 0x07FE0000 +#define R300_ZB_DEPTHXY_OFFSET 0x4f60 +# define R300_DEPTHX_OFFSET_SHIFT 1 +# define R300_DEPTHX_OFFSET_MASK 0x000007FE +# define R300_DEPTHY_OFFSET_SHIFT 17 +# define R300_DEPTHY_OFFSET_MASK 0x07FE0000 /* Sets the fifo sizes */ -#define ZB_FIFO_SIZE 0x4fd0 -# define ZB_FIFO_SIZE_OP_FIFO_SIZE_FULL (0 << 0) -# define ZB_FIFO_SIZE_OP_FIFO_SIZE_HALF (1 << 0) -# define ZB_FIFO_SIZE_OP_FIFO_SIZE_QUATER (2 << 0) -# define ZB_FIFO_SIZE_OP_FIFO_SIZE_EIGTHS (4 << 0) +#define R500_ZB_FIFO_SIZE 0x4fd0 +# define R500_OP_FIFO_SIZE_FULL (0 << 0) +# define R500_OP_FIFO_SIZE_HALF (1 << 0) +# define R500_OP_FIFO_SIZE_QUATER (2 << 0) +# define R500_OP_FIFO_SIZE_EIGTHS (4 << 0) /* Stencil Reference Value and Mask for backfacing quads */ -#define ZB_STENCILREFMASK_BF 0x4fd4 -# define ZB_STENCILREFMASK_BF_STENCILREF_SHIFT 0 -# define ZB_STENCILREFMASK_BF_STENCILREF_MASK 0x000000ff -# define ZB_STENCILREFMASK_BF_STENCILMASK_SHIFT 8 -# define ZB_STENCILREFMASK_BF_STENCILMASK_MASK 0x0000ff00 -# define ZB_STENCILREFMASK_BF_STENCILWRITEMASK_SHIFT 16 -# define ZB_STENCILREFMASK_BF_STENCILWRITEMASK_MASK 0xffff0000 +/* R300_ZB_STENCILREFMASK handles front face */ +#define R500_ZB_STENCILREFMASK_BF 0x4fd4 +# define R500_STENCILREF_SHIFT 0 +# define R500_STENCILREF_MASK 0x000000ff +# define R500_STENCILMASK_SHIFT 8 +# define R500_STENCILMASK_MASK 0x0000ff00 +# define R500_STENCILWRITEMASK_SHIFT 16 +# define R500_STENCILWRITEMASK_MASK 0x00ff0000 /** * \defgroup R3XX_R5XX_PROGRAMMABLE_VERTEX_SHADER_DESCRIPTION R3XX-R5XX PROGRAMMABLE VERTEX SHADER DESCRIPTION @@ -2598,6 +2683,479 @@ enum { #define R300_PRIM_NUM_VERTICES_SHIFT 16 #define R300_PRIM_NUM_VERTICES_MASK 0xffff + + +/* + * The R500 unified shader (US) registers come in banks of 512 each, one + * for each instruction slot in the shader. You can't touch them directly. + * R500_US_VECTOR_INDEX() sets the base instruction to modify; successive + * writes to R500_GA_US_VECTOR_DATA autoincrement the index after the + * instruction is fully specified. + */ +#define R500_US_ALU_ALPHA_INST_0 0xa800 +# define R500_ALPHA_OP_MAD 0 +# define R500_ALPHA_OP_DP 1 +# define R500_ALPHA_OP_MIN 2 +# define R500_ALPHA_OP_MAX 3 +/* #define R500_ALPHA_OP_RESERVED 4 */ +# define R500_ALPHA_OP_CND 5 +# define R500_ALPHA_OP_CMP 6 +# define R500_ALPHA_OP_FRC 7 +# define R500_ALPHA_OP_EX2 8 +# define R500_ALPHA_OP_LN2 9 +# define R500_ALPHA_OP_RCP 10 +# define R500_ALPHA_OP_RSQ 11 +# define R500_ALPHA_OP_SIN 12 +# define R500_ALPHA_OP_COS 13 +# define R500_ALPHA_OP_MDH 14 +# define R500_ALPHA_OP_MDV 15 +# define R500_ALPHA_ADDRD(x) (x << 4) +# define R500_ALPHA_ADDRD_REL (1 << 11) +# define R500_ALPHA_SEL_A_SRC0 (0 << 12) +# define R500_ALPHA_SEL_A_SRC1 (1 << 12) +# define R500_ALPHA_SEL_A_SRC2 (2 << 12) +# define R500_ALPHA_SEL_A_SRCP (3 << 12) +# define R500_ALPHA_SWIZ_A_R (0 << 14) +# define R500_ALPHA_SWIZ_A_G (1 << 14) +# define R500_ALPHA_SWIZ_A_B (2 << 14) +# define R500_ALPHA_SWIZ_A_A (3 << 14) +# define R500_ALPHA_SWIZ_A_0 (4 << 14) +# define R500_ALPHA_SWIZ_A_HALF (5 << 14) +# define R500_ALPHA_SWIZ_A_1 (6 << 14) +/* #define R500_ALPHA_SWIZ_A_UNUSED (7 << 14) */ +# define R500_ALPHA_MOD_A_NOP (0 << 17) +# define R500_ALPHA_MOD_A_NEG (1 << 17) +# define R500_ALPHA_MOD_A_ABS (2 << 17) +# define R500_ALPHA_MOD_A_NAB (3 << 17) +# define R500_ALPHA_SEL_B_SRC0 (0 << 19) +# define R500_ALPHA_SEL_B_SRC1 (1 << 19) +# define R500_ALPHA_SEL_B_SRC2 (2 << 19) +# define R500_ALPHA_SEL_B_SRCP (3 << 19) +# define R500_ALPHA_SWIZ_B_R (0 << 21) +# define R500_ALPHA_SWIZ_B_G (1 << 21) +# define R500_ALPHA_SWIZ_B_B (2 << 21) +# define R500_ALPHA_SWIZ_B_A (3 << 21) +# define R500_ALPHA_SWIZ_B_0 (4 << 21) +# define R500_ALPHA_SWIZ_B_HALF (5 << 21) +# define R500_ALPHA_SWIZ_B_1 (6 << 21) +/* #define R500_ALPHA_SWIZ_B_UNUSED (7 << 21) */ +# define R500_ALPHA_MOD_B_NOP (0 << 24) +# define R500_ALPHA_MOD_B_NEG (1 << 24) +# define R500_ALPHA_MOD_B_ABS (2 << 24) +# define R500_ALPHA_MOD_B_NAB (3 << 24) +# define R500_ALPHA_OMOD_IDENTITY (0 << 26) +# define R500_ALPHA_OMOD_MUL_2 (1 << 26) +# define R500_ALPHA_OMOD_MUL_4 (2 << 26) +# define R500_ALPHA_OMOD_MUL_8 (3 << 26) +# define R500_ALPHA_OMOD_DIV_2 (4 << 26) +# define R500_ALPHA_OMOD_DIV_4 (5 << 26) +# define R500_ALPHA_OMOD_DIV_8 (6 << 26) +# define R500_ALPHA_OMOD_DISABLE (7 << 26) +# define R500_ALPHA_TARGET(x) (x << 29) +# define R500_ALPHA_W_OMASK (1 << 31) +#define R500_US_ALU_ALPHA_ADDR_0 0x9800 +# define R500_ALPHA_ADDR0(x) (x << 0) +# define R500_ALPHA_ADDR0_CONST (1 << 8) +# define R500_ALPHA_ADDR0_REL (1 << 9) +# define R500_ALPHA_ADDR1(x) (x << 10) +# define R500_ALPHA_ADDR1_CONST (1 << 18) +# define R500_ALPHA_ADDR1_REL (1 << 19) +# define R500_ALPHA_ADDR2(x) (x << 20) +# define R500_ALPHA_ADDR2_CONST (1 << 28) +# define R500_ALPHA_ADDR2_REL (1 << 29) +# define R500_ALPHA_SRCP_OP_1_MINUS_2A0 (0 << 30) +# define R500_ALPHA_SRCP_OP_A1_MINUS_A0 (1 << 30) +# define R500_ALPHA_SRCP_OP_A1_PLUS_A0 (2 << 30) +# define R500_ALPHA_SRCP_OP_1_MINUS_A0 (3 << 30) +#define R500_US_ALU_RGBA_INST_0 0xb000 +# define R500_ALU_RGBA_OP_MAD (0 << 0) +# define R500_ALU_RGBA_OP_DP3 (1 << 0) +# define R500_ALU_RGBA_OP_DP4 (2 << 0) +# define R500_ALU_RGBA_OP_D2A (3 << 0) +# define R500_ALU_RGBA_OP_MIN (4 << 0) +# define R500_ALU_RGBA_OP_MAX (5 << 0) +/* #define R500_ALU_RGBA_OP_RESERVED (6 << 0) */ +# define R500_ALU_RGBA_OP_CND (7 << 0) +# define R500_ALU_RGBA_OP_CMP (8 << 0) +# define R500_ALU_RGBA_OP_FRC (9 << 0) +# define R500_ALU_RGBA_OP_SOP (10 << 0) +# define R500_ALU_RGBA_OP_MDH (11 << 0) +# define R500_ALU_RGBA_OP_MDV (12 << 0) +# define R500_ALU_RGBA_ADDRD(x) (x << 4) +# define R500_ALU_RGBA_ADDRD_REL (1 << 11) +# define R500_ALU_RGBA_SEL_C_SRC0 (0 << 12) +# define R500_ALU_RGBA_SEL_C_SRC1 (1 << 12) +# define R500_ALU_RGBA_SEL_C_SRC2 (2 << 12) +# define R500_ALU_RGBA_SEL_C_SRCP (3 << 12) +# define R500_ALU_RGBA_R_SWIZ_R (0 << 14) +# define R500_ALU_RGBA_R_SWIZ_G (1 << 14) +# define R500_ALU_RGBA_R_SWIZ_B (2 << 14) +# define R500_ALU_RGBA_R_SWIZ_A (3 << 14) +# define R500_ALU_RGBA_R_SWIZ_0 (4 << 14) +# define R500_ALU_RGBA_R_SWIZ_HALF (5 << 14) +# define R500_ALU_RGBA_R_SWIZ_1 (6 << 14) +/* #define R500_ALU_RGBA_R_SWIZ_UNUSED (7 << 14) */ +# define R500_ALU_RGBA_G_SWIZ_R (0 << 17) +# define R500_ALU_RGBA_G_SWIZ_G (1 << 17) +# define R500_ALU_RGBA_G_SWIZ_B (2 << 17) +# define R500_ALU_RGBA_G_SWIZ_A (3 << 17) +# define R500_ALU_RGBA_G_SWIZ_0 (4 << 17) +# define R500_ALU_RGBA_G_SWIZ_HALF (5 << 17) +# define R500_ALU_RGBA_G_SWIZ_1 (6 << 17) +/* #define R500_ALU_RGBA_G_SWIZ_UNUSED (7 << 17) */ +# define R500_ALU_RGBA_B_SWIZ_R (0 << 20) +# define R500_ALU_RGBA_B_SWIZ_G (1 << 20) +# define R500_ALU_RGBA_B_SWIZ_B (2 << 20) +# define R500_ALU_RGBA_B_SWIZ_A (3 << 20) +# define R500_ALU_RGBA_B_SWIZ_0 (4 << 20) +# define R500_ALU_RGBA_B_SWIZ_HALF (5 << 20) +# define R500_ALU_RGBA_B_SWIZ_1 (6 << 20) +/* #define R500_ALU_RGBA_B_SWIZ_UNUSED (7 << 20) */ +# define R500_ALU_RGBA_MOD_C_NOP (0 << 23) +# define R500_ALU_RGBA_MOD_C_NEG (1 << 23) +# define R500_ALU_RGBA_MOD_C_ABS (2 << 23) +# define R500_ALU_RGBA_MOD_C_NAB (3 << 23) +# define R500_ALU_RGBA_ALPHA_SEL_C_SRC0 (0 << 25) +# define R500_ALU_RGBA_ALPHA_SEL_C_SRC1 (1 << 25) +# define R500_ALU_RGBA_ALPHA_SEL_C_SRC2 (2 << 25) +# define R500_ALU_RGBA_ALPHA_SEL_C_SRCP (3 << 25) +# define R500_ALU_RGBA_A_SWIZ_R (0 << 27) +# define R500_ALU_RGBA_A_SWIZ_G (1 << 27) +# define R500_ALU_RGBA_A_SWIZ_B (2 << 27) +# define R500_ALU_RGBA_A_SWIZ_A (3 << 27) +# define R500_ALU_RGBA_A_SWIZ_0 (4 << 27) +# define R500_ALU_RGBA_A_SWIZ_HALF (5 << 27) +# define R500_ALU_RGBA_A_SWIZ_1 (6 << 27) +/* #define R500_ALU_RGBA_A_SWIZ_UNUSED (7 << 27) */ +# define R500_ALU_RGBA_ALPHA_MOD_C_NOP (0 << 30) +# define R500_ALU_RGBA_ALPHA_MOD_C_NEG (1 << 30) +# define R500_ALU_RGBA_ALPHA_MOD_C_ABS (2 << 30) +# define R500_ALU_RGBA_ALPHA_MOD_C_NAB (3 << 30) +#define R500_US_ALU_RGB_INST_0 0xa000 +# define R500_ALU_RGB_SEL_A_SRC0 (0 << 0) +# define R500_ALU_RGB_SEL_A_SRC1 (1 << 0) +# define R500_ALU_RGB_SEL_A_SRC2 (2 << 0) +# define R500_ALU_RGB_SEL_A_SRCP (3 << 0) +# define R500_ALU_RGB_R_SWIZ_A_R (0 << 2) +# define R500_ALU_RGB_R_SWIZ_A_G (1 << 2) +# define R500_ALU_RGB_R_SWIZ_A_B (2 << 2) +# define R500_ALU_RGB_R_SWIZ_A_A (3 << 2) +# define R500_ALU_RGB_R_SWIZ_A_0 (4 << 2) +# define R500_ALU_RGB_R_SWIZ_A_HALF (5 << 2) +# define R500_ALU_RGB_R_SWIZ_A_1 (6 << 2) +/* #define R500_ALU_RGB_R_SWIZ_A_UNUSED (7 << 2) */ +# define R500_ALU_RGB_G_SWIZ_A_R (0 << 5) +# define R500_ALU_RGB_G_SWIZ_A_G (1 << 5) +# define R500_ALU_RGB_G_SWIZ_A_B (2 << 5) +# define R500_ALU_RGB_G_SWIZ_A_A (3 << 5) +# define R500_ALU_RGB_G_SWIZ_A_0 (4 << 5) +# define R500_ALU_RGB_G_SWIZ_A_HALF (5 << 5) +# define R500_ALU_RGB_G_SWIZ_A_1 (6 << 5) +/* #define R500_ALU_RGB_G_SWIZ_A_UNUSED (7 << 5) */ +# define R500_ALU_RGB_B_SWIZ_A_R (0 << 8) +# define R500_ALU_RGB_B_SWIZ_A_G (1 << 8) +# define R500_ALU_RGB_B_SWIZ_A_B (2 << 8) +# define R500_ALU_RGB_B_SWIZ_A_A (3 << 8) +# define R500_ALU_RGB_B_SWIZ_A_0 (4 << 8) +# define R500_ALU_RGB_B_SWIZ_A_HALF (5 << 8) +# define R500_ALU_RGB_B_SWIZ_A_1 (6 << 8) +/* #define R500_ALU_RGB_B_SWIZ_A_UNUSED (7 << 8) */ +# define R500_ALU_RGB_MOD_A_NOP (0 << 11) +# define R500_ALU_RGB_MOD_A_NEG (1 << 11) +# define R500_ALU_RGB_MOD_A_ABS (2 << 11) +# define R500_ALU_RGB_MOD_A_NAB (3 << 11) +# define R500_ALU_RGB_SEL_B_SRC0 (0 << 13) +# define R500_ALU_RGB_SEL_B_SRC1 (1 << 13) +# define R500_ALU_RGB_SEL_B_SRC2 (2 << 13) +# define R500_ALU_RGB_SEL_B_SRCP (3 << 13) +# define R500_ALU_RGB_R_SWIZ_B_R (0 << 15) +# define R500_ALU_RGB_R_SWIZ_B_G (1 << 15) +# define R500_ALU_RGB_R_SWIZ_B_B (2 << 15) +# define R500_ALU_RGB_R_SWIZ_B_A (3 << 15) +# define R500_ALU_RGB_R_SWIZ_B_0 (4 << 15) +# define R500_ALU_RGB_R_SWIZ_B_HALF (5 << 15) +# define R500_ALU_RGB_R_SWIZ_B_1 (6 << 15) +/* #define R500_ALU_RGB_R_SWIZ_B_UNUSED (7 << 15) */ +# define R500_ALU_RGB_G_SWIZ_B_R (0 << 18) +# define R500_ALU_RGB_G_SWIZ_B_G (1 << 18) +# define R500_ALU_RGB_G_SWIZ_B_B (2 << 18) +# define R500_ALU_RGB_G_SWIZ_B_A (3 << 18) +# define R500_ALU_RGB_G_SWIZ_B_0 (4 << 18) +# define R500_ALU_RGB_G_SWIZ_B_HALF (5 << 18) +# define R500_ALU_RGB_G_SWIZ_B_1 (6 << 18) +/* #define R500_ALU_RGB_G_SWIZ_B_UNUSED (7 << 18) */ +# define R500_ALU_RGB_B_SWIZ_B_R (0 << 21) +# define R500_ALU_RGB_B_SWIZ_B_G (1 << 21) +# define R500_ALU_RGB_B_SWIZ_B_B (2 << 21) +# define R500_ALU_RGB_B_SWIZ_B_A (3 << 21) +# define R500_ALU_RGB_B_SWIZ_B_0 (4 << 21) +# define R500_ALU_RGB_B_SWIZ_B_HALF (5 << 21) +# define R500_ALU_RGB_B_SWIZ_B_1 (6 << 21) +/* #define R500_ALU_RGB_B_SWIZ_B_UNUSED (7 << 21) */ +# define R500_ALU_RGB_MOD_B_NOP (0 << 24) +# define R500_ALU_RGB_MOD_B_NEG (1 << 24) +# define R500_ALU_RGB_MOD_B_ABS (2 << 24) +# define R500_ALU_RGB_MOD_B_NAB (3 << 24) +# define R500_ALU_RGB_OMOD_IDENTITY (0 << 26) +# define R500_ALU_RGB_OMOD_MUL_2 (1 << 26) +# define R500_ALU_RGB_OMOD_MUL_4 (2 << 26) +# define R500_ALU_RGB_OMOD_MUL_8 (3 << 26) +# define R500_ALU_RGB_OMOD_DIV_2 (4 << 26) +# define R500_ALU_RGB_OMOD_DIV_4 (5 << 26) +# define R500_ALU_RGB_OMOD_DIV_8 (6 << 26) +# define R500_ALU_RGB_OMOD_DISABLE (7 << 26) +# define R500_ALU_RGB_TARGET(x) (x << 29) +# define R500_ALU_RGB_WMASK (1 << 31) +#define R500_US_ALU_RGB_ADDR_0 0x9000 +# define R500_RGB_ADDR0(x) (x << 0) +# define R500_RGB_ADDR0_CONST (1 << 8) +# define R500_RGB_ADDR0_REL (1 << 9) +# define R500_RGB_ADDR1(x) (x << 10) +# define R500_RGB_ADDR1_CONST (1 << 18) +# define R500_RGB_ADDR1_REL (1 << 19) +# define R500_RGB_ADDR2(x) (x << 20) +# define R500_RGB_ADDR2_CONST (1 << 28) +# define R500_RGB_ADDR2_REL (1 << 29) +# define R500_RGB_SRCP_OP_1_MINUS_2RGB0 (0 << 30) +# define R500_RGB_SRCP_OP_RGB1_MINUS_RGB0 (1 << 30) +# define R500_RGB_SRCP_OP_RGB1_PLUS_RGB0 (2 << 30) +# define R500_RGB_SRCP_OP_1_MINUS_RGB0 (3 << 30) +#define R500_US_CMN_INST_0 0xb800 +# define R500_INST_TYPE_ALU (0 << 0) +# define R500_INST_TYPE_OUT (1 << 0) +# define R500_INST_TYPE_FC (2 << 0) +# define R500_INST_TYPE_TEX (3 << 0) +# define R500_INST_TEX_SEM_WAIT (1 << 2) +# define R500_INST_RGB_PRED_SEL_NONE (0 << 3) +# define R500_INST_RGB_PRED_SEL_RGBA (1 << 3) +# define R500_INST_RGB_PRED_SEL_RRRR (2 << 3) +# define R500_INST_RGB_PRED_SEL_GGGG (3 << 3) +# define R500_INST_RGB_PRED_SEL_BBBB (4 << 3) +# define R500_INST_RGB_PRED_SEL_AAAA (5 << 3) +# define R500_INST_RGB_PRED_INV (1 << 6) +# define R500_INST_WRITE_INACTIVE (1 << 7) +# define R500_INST_LAST (1 << 8) +# define R500_INST_NOP (1 << 9) +# define R500_INST_ALU_WAIT (1 << 10) +# define R500_INST_RGB_WMASK_R (1 << 11) +# define R500_INST_RGB_WMASK_G (1 << 12) +# define R500_INST_RGB_WMASK_B (1 << 13) +# define R500_INST_ALPHA_WMASK (1 << 14) +# define R500_INST_RGB_OMASK_R (1 << 15) +# define R500_INST_RGB_OMASK_G (1 << 16) +# define R500_INST_RGB_OMASK_B (1 << 17) +# define R500_INST_ALPHA_OMASK (1 << 18) +# define R500_INST_RGB_CLAMP (1 << 19) +# define R500_INST_ALPHA_CLAMP (1 << 20) +# define R500_INST_ALU_RESULT_SEL (1 << 21) +# define R500_INST_ALPHA_PRED_INV (1 << 22) +# define R500_INST_ALU_RESULT_OP_EQ (0 << 23) +# define R500_INST_ALU_RESULT_OP_LT (1 << 23) +# define R500_INST_ALU_RESULT_OP_GE (2 << 23) +# define R500_INST_ALU_RESULT_OP_NE (3 << 23) +# define R500_INST_ALPHA_PRED_SEL_NONE (0 << 25) +# define R500_INST_ALPHA_PRED_SEL_RGBA (1 << 25) +# define R500_INST_ALPHA_PRED_SEL_RRRR (2 << 25) +# define R500_INST_ALPHA_PRED_SEL_GGGG (3 << 25) +# define R500_INST_ALPHA_PRED_SEL_BBBB (4 << 25) +# define R500_INST_ALPHA_PRED_SEL_AAAA (5 << 25) +/* XXX next four are kind of guessed */ +# define R500_INST_STAT_WE_R (1 << 28) +# define R500_INST_STAT_WE_G (1 << 29) +# define R500_INST_STAT_WE_B (1 << 30) +# define R500_INST_STAT_WE_A (1 << 31) + +/* note that these are 8 bit lengths, despite the offsets, at least for R500 */ +#define R500_US_CODE_ADDR 0x4630 +# define R500_US_CODE_START_ADDR(x) (x << 0) +# define R500_US_CODE_END_ADDR(x) (x << 16) +#define R500_US_CODE_OFFSET 0x4638 +# define R500_US_CODE_OFFSET_ADDR(x) (x << 0) +#define R500_US_CODE_RANGE 0x4634 +# define R500_US_CODE_RANGE_ADDR(x) (x << 0) +# define R500_US_CODE_RANGE_SIZE(x) (x << 16) +#define R500_US_CONFIG 0x4600 +# define R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO (1 << 1) +#define R500_US_FC_ADDR_0 0xa000 +# define R500_FC_BOOL_ADDR(x) (x << 0) +# define R500_FC_INT_ADDR(x) (x << 8) +# define R500_FC_JUMP_ADDR(x) (x << 16) +# define R500_FC_JUMP_GLOBAL (1 << 31) +#define R500_US_FC_BOOL_CONST 0x4620 +# define R500_FC_KBOOL(x) (x) +#define R500_US_FC_CTRL 0x4624 +# define R500_FC_TEST_EN (1 << 30) +# define R500_FC_FULL_FC_EN (1 << 31) +#define R500_US_FC_INST_0 0x9800 +# define R500_FC_OP_JUMP (0 << 0) +# define R500_FC_OP_LOOP (1 << 0) +# define R500_FC_OP_ENDLOOP (2 << 0) +# define R500_FC_OP_REP (3 << 0) +# define R500_FC_OP_ENDREP (4 << 0) +# define R500_FC_OP_BREAKLOOP (5 << 0) +# define R500_FC_OP_BREAKREP (6 << 0) +# define R500_FC_OP_CONTINUE (7 << 0) +# define R500_FC_B_ELSE (1 << 4) +# define R500_FC_JUMP_ANY (1 << 5) +# define R500_FC_A_OP_NONE (0 << 6) +# define R500_FC_A_OP_POP (1 << 6) +# define R500_FC_A_OP_PUSH (2 << 6) +# define R500_FC_JUMP_FUNC(x) (x << 8) +# define R500_FC_B_POP_CNT(x) (x << 16) +# define R500_FC_B_OP0_NONE (0 << 24) +# define R500_FC_B_OP0_DECR (1 << 24) +# define R500_FC_B_OP0_INCR (2 << 24) +# define R500_FC_B_OP1_DECR (0 << 26) +# define R500_FC_B_OP1_NONE (1 << 26) +# define R500_FC_B_OP1_INCR (2 << 26) +# define R500_FC_IGNORE_UNCOVERED (1 << 28) +#define R500_US_FC_INT_CONST_0 0x4c00 +# define R500_FC_INT_CONST_KR(x) (x << 0) +# define R500_FC_INT_CONST_KG(x) (x << 8) +# define R500_FC_INT_CONST_KB(x) (x << 16) +/* _0 through _15 */ +#define R500_US_FORMAT0_0 0x4640 +# define R500_FORMAT_TXWIDTH(x) (x << 0) +# define R500_FORMAT_TXHEIGHT(x) (x << 11) +# define R500_FORMAT_TXDEPTH(x) (x << 22) +/* _0 through _3 */ +#define R500_US_OUT_FMT_0 0x46a4 +# define R500_OUT_FMT_C4_8 (0 << 0) +# define R500_OUT_FMT_C4_10 (1 << 0) +# define R500_OUT_FMT_C4_10_GAMMA (2 << 0) +# define R500_OUT_FMT_C_16 (3 << 0) +# define R500_OUT_FMT_C2_16 (4 << 0) +# define R500_OUT_FMT_C4_16 (5 << 0) +# define R500_OUT_FMT_C_16_MPEG (6 << 0) +# define R500_OUT_FMT_C2_16_MPEG (7 << 0) +# define R500_OUT_FMT_C2_4 (8 << 0) +# define R500_OUT_FMT_C_3_3_2 (9 << 0) +# define R500_OUT_FMT_C_6_5_6 (10 << 0) +# define R500_OUT_FMT_C_11_11_10 (11 << 0) +# define R500_OUT_FMT_C_10_11_11 (12 << 0) +# define R500_OUT_FMT_C_2_10_10_10 (13 << 0) +/* #define R500_OUT_FMT_RESERVED (14 << 0) */ +# define R500_OUT_FMT_UNUSED (15 << 0) +# define R500_OUT_FMT_C_16_FP (16 << 0) +# define R500_OUT_FMT_C2_16_FP (17 << 0) +# define R500_OUT_FMT_C4_16_FP (18 << 0) +# define R500_OUT_FMT_C_32_FP (19 << 0) +# define R500_OUT_FMT_C2_32_FP (20 << 0) +# define R500_OUT_FMT_C4_32_FP (21 << 0) +# define R500_C0_SEL_A (0 << 8) +# define R500_C0_SEL_R (1 << 8) +# define R500_C0_SEL_G (2 << 8) +# define R500_C0_SEL_B (3 << 8) +# define R500_C1_SEL_A (0 << 10) +# define R500_C1_SEL_R (1 << 10) +# define R500_C1_SEL_G (2 << 10) +# define R500_C1_SEL_B (3 << 10) +# define R500_C2_SEL_A (0 << 12) +# define R500_C2_SEL_R (1 << 12) +# define R500_C2_SEL_G (2 << 12) +# define R500_C2_SEL_B (3 << 12) +# define R500_C3_SEL_A (0 << 14) +# define R500_C3_SEL_R (1 << 14) +# define R500_C3_SEL_G (2 << 14) +# define R500_C3_SEL_B (3 << 14) +# define R500_OUT_SIGN(x) (x << 16) +# define R500_ROUND_ADJ (1 << 20) +#define R500_US_PIXSIZE 0x4604 +# define R500_PIX_SIZE(x) (x) +#define R500_US_TEX_ADDR_0 0x9800 +# define R500_TEX_SRC_ADDR(x) (x << 0) +# define R500_TEX_SRC_ADDR_REL (1 << 7) +# define R500_TEX_SRC_S_SWIZ_R (0 << 8) +# define R500_TEX_SRC_S_SWIZ_G (1 << 8) +# define R500_TEX_SRC_S_SWIZ_B (2 << 8) +# define R500_TEX_SRC_S_SWIZ_A (3 << 8) +# define R500_TEX_SRC_T_SWIZ_R (0 << 10) +# define R500_TEX_SRC_T_SWIZ_G (1 << 10) +# define R500_TEX_SRC_T_SWIZ_B (2 << 10) +# define R500_TEX_SRC_T_SWIZ_A (3 << 10) +# define R500_TEX_SRC_R_SWIZ_R (0 << 12) +# define R500_TEX_SRC_R_SWIZ_G (1 << 12) +# define R500_TEX_SRC_R_SWIZ_B (2 << 12) +# define R500_TEX_SRC_R_SWIZ_A (3 << 12) +# define R500_TEX_SRC_Q_SWIZ_R (0 << 14) +# define R500_TEX_SRC_Q_SWIZ_G (1 << 14) +# define R500_TEX_SRC_Q_SWIZ_B (2 << 14) +# define R500_TEX_SRC_Q_SWIZ_A (3 << 14) +# define R500_TEX_DST_ADDR(x) (x << 16) +# define R500_TEX_DST_ADDR_REL (1 << 23) +# define R500_TEX_DST_R_SWIZ_R (0 << 24) +# define R500_TEX_DST_R_SWIZ_G (1 << 24) +# define R500_TEX_DST_R_SWIZ_B (2 << 24) +# define R500_TEX_DST_R_SWIZ_A (3 << 24) +# define R500_TEX_DST_G_SWIZ_R (0 << 26) +# define R500_TEX_DST_G_SWIZ_G (1 << 26) +# define R500_TEX_DST_G_SWIZ_B (2 << 26) +# define R500_TEX_DST_G_SWIZ_A (3 << 26) +# define R500_TEX_DST_B_SWIZ_R (0 << 28) +# define R500_TEX_DST_B_SWIZ_G (1 << 28) +# define R500_TEX_DST_B_SWIZ_B (2 << 28) +# define R500_TEX_DST_B_SWIZ_A (3 << 28) +# define R500_TEX_DST_A_SWIZ_R (0 << 30) +# define R500_TEX_DST_A_SWIZ_G (1 << 30) +# define R500_TEX_DST_A_SWIZ_B (2 << 30) +# define R500_TEX_DST_A_SWIZ_A (3 << 30) +#define R500_US_TEX_ADDR_DXDY_0 0xa000 +# define R500_DX_ADDR(x) (x << 0) +# define R500_DX_ADDR_REL (1 << 7) +# define R500_DX_S_SWIZ_R (0 << 8) +# define R500_DX_S_SWIZ_G (1 << 8) +# define R500_DX_S_SWIZ_B (2 << 8) +# define R500_DX_S_SWIZ_A (3 << 8) +# define R500_DX_T_SWIZ_R (0 << 10) +# define R500_DX_T_SWIZ_G (1 << 10) +# define R500_DX_T_SWIZ_B (2 << 10) +# define R500_DX_T_SWIZ_A (3 << 10) +# define R500_DX_R_SWIZ_R (0 << 12) +# define R500_DX_R_SWIZ_G (1 << 12) +# define R500_DX_R_SWIZ_B (2 << 12) +# define R500_DX_R_SWIZ_A (3 << 12) +# define R500_DX_Q_SWIZ_R (0 << 14) +# define R500_DX_Q_SWIZ_G (1 << 14) +# define R500_DX_Q_SWIZ_B (2 << 14) +# define R500_DX_Q_SWIZ_A (3 << 14) +# define R500_DY_ADDR(x) (x << 16) +# define R500_DY_ADDR_REL (1 << 17) +# define R500_DY_S_SWIZ_R (0 << 24) +# define R500_DY_S_SWIZ_G (1 << 24) +# define R500_DY_S_SWIZ_B (2 << 24) +# define R500_DY_S_SWIZ_A (3 << 24) +# define R500_DY_T_SWIZ_R (0 << 26) +# define R500_DY_T_SWIZ_G (1 << 26) +# define R500_DY_T_SWIZ_B (2 << 26) +# define R500_DY_T_SWIZ_A (3 << 26) +# define R500_DY_R_SWIZ_R (0 << 28) +# define R500_DY_R_SWIZ_G (1 << 28) +# define R500_DY_R_SWIZ_B (2 << 28) +# define R500_DY_R_SWIZ_A (3 << 28) +# define R500_DY_Q_SWIZ_R (0 << 30) +# define R500_DY_Q_SWIZ_G (1 << 30) +# define R500_DY_Q_SWIZ_B (2 << 30) +# define R500_DY_Q_SWIZ_A (3 << 30) +#define R500_US_TEX_INST_0 0x9000 +# define R500_TEX_ID(x) (x << 16) +# define R500_TEX_INST_NOP (0 << 22) +# define R500_TEX_INST_LD (1 << 22) +# define R500_TEX_INST_TEXKILL (2 << 22) +# define R500_TEX_INST_PROJ (3 << 22) +# define R500_TEX_INST_LODBIAS (4 << 22) +# define R500_TEX_INST_LOD (5 << 22) +# define R500_TEX_INST_DXDY (6 << 22) +# define R500_TEX_SEM_ACQUIRE (1 << 25) +# define R500_TEX_IGNORE_UNCOVERED (1 << 26) +# define R500_TEX_UNSCALED (1 << 27) +#define R300_US_W_FMT 0x46b4 +# define R300_W_FMT_W0 (0 << 0) +# define R300_W_FMT_W24 (1 << 0) +# define R300_W_FMT_W24FP (2 << 0) +# define R300_W_SRC_US (0 << 2) +# define R300_W_SRC_RAS (1 << 2) + + /* Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR. * Two parameter dwords: * 0. VAP_VTX_FMT: The first parameter is not written to hardware diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index eee1e803a00..fc07105c560 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -334,13 +334,26 @@ static GLboolean r300RunRender(GLcontext * ctx, static int r300Fallback(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); - struct r300_fragment_program *fp = (struct r300_fragment_program *) + /* Do we need to use new-style shaders? + * Also is there a better way to do this? */ + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + struct r500_fragment_program *fp = (struct r500_fragment_program *) (char *)ctx->FragmentProgram._Current; - - if (fp) { - if (!fp->translated) - r300TranslateFragmentShader(r300, fp); - FALLBACK_IF(!fp->translated); + if (fp) { + if (!fp->translated) { + r500TranslateFragmentShader(r300, fp); + FALLBACK_IF(!fp->translated); + } + } + } else { + struct r300_fragment_program *fp = (struct r300_fragment_program *) + (char *)ctx->FragmentProgram._Current; + if (fp) { + if (!fp->translated) { + r300TranslateFragmentShader(r300, fp); + FALLBACK_IF(!fp->translated); + } + } } FALLBACK_IF(ctx->RenderMode != GL_RENDER); diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index 77abf86a8ee..5c8fd8a5e58 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -9,8 +9,10 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, GLuint id) { + r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program_cont *vp; - struct r300_fragment_program *fp; + struct r300_fragment_program *r300_fp; + struct r500_fragment_program *r500_fp; switch (target) { case GL_VERTEX_STATE_PROGRAM_NV: @@ -19,14 +21,28 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id); case GL_FRAGMENT_PROGRAM_ARB: - fp = CALLOC_STRUCT(r300_fragment_program); - fp->ctx = ctx; - return _mesa_init_fragment_program(ctx, &fp->mesa_program, - target, id); + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + r500_fp = CALLOC_STRUCT(r500_fragment_program); + r500_fp->ctx = ctx; + return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program, + target, id); + } else { + r300_fp = CALLOC_STRUCT(r300_fragment_program); + r300_fp->ctx = ctx; + return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program, + target, id); + } + case GL_FRAGMENT_PROGRAM_NV: - fp = CALLOC_STRUCT(r300_fragment_program); - return _mesa_init_fragment_program(ctx, &fp->mesa_program, - target, id); + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + r500_fp = CALLOC_STRUCT(r500_fragment_program); + return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program, + target, id); + } else { + r300_fp = CALLOC_STRUCT(r300_fragment_program); + return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program, + target, id); + } default: _mesa_problem(ctx, "Bad target in r300NewProgram"); } @@ -42,15 +58,20 @@ static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) static void r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) { + r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program_cont *vp = (void *)prog; - struct r300_fragment_program *fp = (struct r300_fragment_program *)prog; + struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)prog; + struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)prog; switch (target) { case GL_VERTEX_PROGRAM_ARB: vp->progs = NULL; break; case GL_FRAGMENT_PROGRAM_ARB: - fp->translated = GL_FALSE; + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + r500_fp->translated = GL_FALSE; + else + r300_fp->translated = GL_FALSE; break; } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index e11b5afc30c..550f7108542 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -60,7 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_state.h" #include "r300_reg.h" #include "r300_emit.h" -#include "r300_fragprog.h" #include "r300_tex.h" #include "drirenderbuffer.h" @@ -189,7 +188,7 @@ static void r300SetBlendCntl(r300ContextPtr r300, int func, int eqn, */ #if 0 if (new_ablend == new_cblend) { - new_cblend |= R300_BLEND_NO_SEPARATE; + new_cblend |= R300_DISCARD_SRC_PIXELS_SRC_ALPHA_0; } #endif new_cblend |= cbits; @@ -295,7 +294,9 @@ static void r300SetBlendState(GLcontext * ctx) r300SetBlendCntl(r300, func, eqn, - R300_BLEND_UNKNOWN | R300_BLEND_ENABLE, funcA, eqnA); + (R300_SEPARATE_ALPHA_ENABLE | + R300_READ_ENABLE | + R300_ALPHA_BLEND_ENABLE), funcA, eqnA); } static void r300BlendEquationSeparate(GLcontext * ctx, @@ -401,42 +402,40 @@ static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state) } } -static void r300SetEarlyZState(GLcontext * ctx) +static GLboolean current_fragment_program_writes_depth(GLcontext* ctx) { - /* updates register R300_RB3D_EARLY_Z (0x4F14) - if depth test is not enabled it should be R300_EARLY_Z_DISABLE - if depth is enabled and alpha not it should be R300_EARLY_Z_ENABLE - if depth and alpha is enabled it should be R300_EARLY_Z_DISABLE - */ r300ContextPtr r300 = R300_CONTEXT(ctx); - R300_STATECHANGE(r300, zstencil_format); - switch (ctx->Visual.depthBits) { - case 16: - r300->hw.zstencil_format.cmd[1] = ZB_FORMAR_DEPTHFORMAT_16BIT_INT_Z; - break; - case 24: - r300->hw.zstencil_format.cmd[1] = ZB_FORMAR_DEPTHFORMAT_24BIT_INT_Z; - break; - default: - fprintf(stderr, "Error: Unsupported depth %d... exiting\n", ctx->Visual.depthBits); - _mesa_exit(-1); + if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { + struct r300_fragment_program *fp = (struct r300_fragment_program *) + (char *)ctx->FragmentProgram._Current; + return (fp && fp->WritesDepth); + } else { + struct r500_fragment_program* fp = + (struct r500_fragment_program*)(char*) + ctx->FragmentProgram._Current; + return (fp && fp->writes_depth); } +} + +static void r300SetEarlyZState(GLcontext * ctx) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + GLuint topZ = R300_ZTOP_ENABLE; if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS) - /* disable early Z */ - r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_DISABLE; - else { - if (ctx->Depth.Test && ctx->Depth.Func != GL_NEVER) - /* enable early Z */ - r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_ENABLE; - else - /* disable early Z */ - r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_DISABLE; + topZ = R300_ZTOP_DISABLE; + if (current_fragment_program_writes_depth(ctx)) + topZ = R300_ZTOP_DISABLE; + + if (topZ != r300->hw.zstencil_format.cmd[2]) { + /* Note: This completely reemits the stencil format. + * I have not tested whether this is strictly necessary, + * or if emitting a write to ZB_ZTOP is enough. + */ + R300_STATECHANGE(r300, zstencil_format); + r300->hw.zstencil_format.cmd[2] = topZ; } - - r300->hw.zstencil_format.cmd[3] = 0x00000003; - r300->hw.zstencil_format.cmd[4] = 0x00000000; } static void r300SetAlphaState(GLcontext * ctx) @@ -450,25 +449,25 @@ static void r300SetAlphaState(GLcontext * ctx) switch (ctx->Color.AlphaFunc) { case GL_NEVER: - pp_misc |= FG_ALPHA_FUNC_NEVER; + pp_misc |= R300_FG_ALPHA_FUNC_NEVER; break; case GL_LESS: - pp_misc |= FG_ALPHA_FUNC_LESS; + pp_misc |= R300_FG_ALPHA_FUNC_LESS; break; case GL_EQUAL: - pp_misc |= FG_ALPHA_FUNC_EQUAL; + pp_misc |= R300_FG_ALPHA_FUNC_EQUAL; break; case GL_LEQUAL: - pp_misc |= FG_ALPHA_FUNC_LE; + pp_misc |= R300_FG_ALPHA_FUNC_LE; break; case GL_GREATER: - pp_misc |= FG_ALPHA_FUNC_GREATER; + pp_misc |= R300_FG_ALPHA_FUNC_GREATER; break; case GL_NOTEQUAL: - pp_misc |= FG_ALPHA_FUNC_NOTEQUAL; + pp_misc |= R300_FG_ALPHA_FUNC_NOTEQUAL; break; case GL_GEQUAL: - pp_misc |= FG_ALPHA_FUNC_GE; + pp_misc |= R300_FG_ALPHA_FUNC_GE; break; case GL_ALWAYS: /*pp_misc |= FG_ALPHA_FUNC_ALWAYS; */ @@ -477,8 +476,9 @@ static void r300SetAlphaState(GLcontext * ctx) } if (really_enabled) { - pp_misc |= FG_ALPHA_FUNC_ENABLE; - pp_misc |= (refByte & R300_REF_ALPHA_MASK); + pp_misc |= R300_FG_ALPHA_FUNC_ENABLE; + pp_misc |= R500_FG_ALPHA_FUNC_8BIT; + pp_misc |= (refByte & R300_FG_ALPHA_FUNC_VAL_MASK); } else { pp_misc = 0x0; } @@ -525,24 +525,24 @@ static void r300SetDepthState(GLcontext * ctx) r300ContextPtr r300 = R300_CONTEXT(ctx); R300_STATECHANGE(r300, zs); - r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE; + r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_STENCIL_ENABLE; // XXX r300->hw.zs.cmd[R300_ZS_CNTL_1] &= - ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); + ~(R300_ZS_MASK << R300_Z_FUNC_SHIFT); if (ctx->Depth.Test && ctx->Depth.Func != GL_NEVER) { if (ctx->Depth.Mask) r300->hw.zs.cmd[R300_ZS_CNTL_0] |= - R300_RB3D_Z_TEST_AND_WRITE; + R300_Z_ENABLE | R300_Z_WRITE_ENABLE | R300_STENCIL_FRONT_BACK; // XXX else - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_TEST; + r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_Z_ENABLE | R300_STENCIL_FRONT_BACK; // XXX r300->hw.zs.cmd[R300_ZS_CNTL_1] |= translate_func(ctx->Depth. - Func) << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT; + Func) << R300_Z_FUNC_SHIFT; } else { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_DISABLED_1; + r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_STENCIL_FRONT_BACK; // XXX r300->hw.zs.cmd[R300_ZS_CNTL_1] |= - translate_func(GL_NEVER) << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT; + translate_func(GL_NEVER) << R300_Z_FUNC_SHIFT; } r300SetEarlyZState(ctx); @@ -556,10 +556,10 @@ static void r300SetStencilState(GLcontext * ctx, GLboolean state) R300_STATECHANGE(r300, zs); if (state) { r300->hw.zs.cmd[R300_ZS_CNTL_0] |= - R300_RB3D_STENCIL_ENABLE; + R300_STENCIL_ENABLE; } else { r300->hw.zs.cmd[R300_ZS_CNTL_0] &= - ~R300_RB3D_STENCIL_ENABLE; + ~R300_STENCIL_ENABLE; } } else { #if R200_MERGED @@ -571,7 +571,7 @@ static void r300SetStencilState(GLcontext * ctx, GLboolean state) static void r300UpdatePolygonMode(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); - uint32_t hw_mode = GA_POLY_MODE_DISABLE; + uint32_t hw_mode = R300_GA_POLY_MODE_DISABLE; /* Only do something if a polygon mode is wanted, default is GL_FILL */ if (ctx->Polygon.FrontMode != GL_FILL || @@ -590,29 +590,29 @@ static void r300UpdatePolygonMode(GLcontext * ctx) } /* Enable polygon mode */ - hw_mode |= GA_POLY_MODE_DUAL; + hw_mode |= R300_GA_POLY_MODE_DUAL; switch (f) { case GL_LINE: - hw_mode |= GA_POLY_MODE_FRONT_PTYPE_LINE; + hw_mode |= R300_GA_POLY_MODE_FRONT_PTYPE_LINE; break; case GL_POINT: - hw_mode |= GA_POLY_MODE_FRONT_PTYPE_POINT; + hw_mode |= R300_GA_POLY_MODE_FRONT_PTYPE_POINT; break; case GL_FILL: - hw_mode |= GA_POLY_MODE_FRONT_PTYPE_TRI; + hw_mode |= R300_GA_POLY_MODE_FRONT_PTYPE_TRI; break; } switch (b) { case GL_LINE: - hw_mode |= GA_POLY_MODE_BACK_PTYPE_LINE; + hw_mode |= R300_GA_POLY_MODE_BACK_PTYPE_LINE; break; case GL_POINT: - hw_mode |= GA_POLY_MODE_BACK_PTYPE_POINT; + hw_mode |= R300_GA_POLY_MODE_BACK_PTYPE_POINT; break; case GL_FILL: - hw_mode |= GA_POLY_MODE_BACK_PTYPE_TRI; + hw_mode |= R300_GA_POLY_MODE_BACK_PTYPE_TRI; break; } } @@ -716,8 +716,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) R300_STATECHANGE(r300, fogs); r300->hw.fogs.cmd[R300_FOGS_STATE] = (r300->hw.fogs. - cmd[R300_FOGS_STATE] & ~FG_FOG_BLEND_FN_MASK) | - FG_FOG_BLEND_FN_LINEAR; + cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) | + R300_FG_FOG_BLEND_FN_LINEAR; if (ctx->Fog.Start == ctx->Fog.End) { fogScale.f = -1.0; @@ -734,8 +734,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) R300_STATECHANGE(r300, fogs); r300->hw.fogs.cmd[R300_FOGS_STATE] = (r300->hw.fogs. - cmd[R300_FOGS_STATE] & ~FG_FOG_BLEND_FN_MASK) | - FG_FOG_BLEND_FN_EXP; + cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) | + R300_FG_FOG_BLEND_FN_EXP; fogScale.f = 0.0933 * ctx->Fog.Density; fogStart.f = 0.0; break; @@ -743,8 +743,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) R300_STATECHANGE(r300, fogs); r300->hw.fogs.cmd[R300_FOGS_STATE] = (r300->hw.fogs. - cmd[R300_FOGS_STATE] & ~FG_FOG_BLEND_FN_MASK) | - FG_FOG_BLEND_FN_EXP2; + cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) | + R300_FG_FOG_BLEND_FN_EXP2; fogScale.f = 0.3 * ctx->Fog.Density; fogStart.f = 0.0; default: @@ -808,7 +808,7 @@ static void r300SetFogState(GLcontext * ctx, GLboolean state) R300_STATECHANGE(r300, fogs); if (state) { - r300->hw.fogs.cmd[R300_FOGS_STATE] |= FG_FOG_BLEND_ENABLE; + r300->hw.fogs.cmd[R300_FOGS_STATE] |= R300_FG_FOG_BLEND_ENABLE; r300Fogfv(ctx, GL_FOG_MODE, NULL); r300Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density); @@ -816,7 +816,7 @@ static void r300SetFogState(GLcontext * ctx, GLboolean state) r300Fogfv(ctx, GL_FOG_END, &ctx->Fog.End); r300Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color); } else { - r300->hw.fogs.cmd[R300_FOGS_STATE] &= ~FG_FOG_BLEND_ENABLE; + r300->hw.fogs.cmd[R300_FOGS_STATE] &= ~R300_FG_FOG_BLEND_ENABLE; } } @@ -914,36 +914,36 @@ static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint refmask = (((ctx->Stencil. - Ref[0] & 0xff) << ZB_STENCILREFMASK_STENCILREF_SHIFT) | ((ctx-> - Stencil. - ValueMask - [0] & - 0xff) - << - ZB_STENCILREFMASK_STENCILMASK_SHIFT)); + Ref[0] & 0xff) << R300_STENCILREF_SHIFT) | ((ctx-> + Stencil. + ValueMask + [0] & + 0xff) + << + R300_STENCILMASK_SHIFT)); GLuint flag; R300_STATECHANGE(rmesa, zs); rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= ~((R300_ZS_MASK << - R300_RB3D_ZS1_FRONT_FUNC_SHIFT) + R300_S_FRONT_FUNC_SHIFT) | (R300_ZS_MASK << - R300_RB3D_ZS1_BACK_FUNC_SHIFT)); + R300_S_BACK_FUNC_SHIFT)); rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= - ~((ZB_STENCILREFMASK_STENCIL_MASK << ZB_STENCILREFMASK_STENCILREF_SHIFT) | - (ZB_STENCILREFMASK_STENCIL_MASK << ZB_STENCILREFMASK_STENCILMASK_SHIFT)); + ~((R300_STENCILREF_MASK << R300_STENCILREF_SHIFT) | + (R300_STENCILREF_MASK << R300_STENCILMASK_SHIFT)); flag = translate_func(ctx->Stencil.Function[0]); rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= - (flag << R300_RB3D_ZS1_FRONT_FUNC_SHIFT); + (flag << R300_S_FRONT_FUNC_SHIFT); if (ctx->Stencil._TestTwoSide) flag = translate_func(ctx->Stencil.Function[1]); rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= - (flag << R300_RB3D_ZS1_BACK_FUNC_SHIFT); + (flag << R300_S_BACK_FUNC_SHIFT); rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= refmask; } @@ -953,12 +953,12 @@ static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) R300_STATECHANGE(rmesa, zs); rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= - ~(ZB_STENCILREFMASK_STENCIL_MASK << - ZB_STENCILREFMASK_STENCILWRITEMASK_SHIFT); + ~(R300_STENCILREF_MASK << + R300_STENCILWRITEMASK_SHIFT); rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= (ctx->Stencil. - WriteMask[0] & ZB_STENCILREFMASK_STENCIL_MASK) << - ZB_STENCILREFMASK_STENCILWRITEMASK_SHIFT; + WriteMask[0] & R300_STENCILREF_MASK) << + R300_STENCILWRITEMASK_SHIFT; } static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, @@ -969,34 +969,34 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, R300_STATECHANGE(rmesa, zs); /* It is easier to mask what's left.. */ rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= - (R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT) | - (R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | - (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT); + (R300_ZS_MASK << R300_Z_FUNC_SHIFT) | + (R300_ZS_MASK << R300_S_FRONT_FUNC_SHIFT) | + (R300_ZS_MASK << R300_S_BACK_FUNC_SHIFT); rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= (translate_stencil_op(ctx->Stencil.FailFunc[0]) << - R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) + R300_S_FRONT_SFAIL_OP_SHIFT) | (translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << - R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) + R300_S_FRONT_ZFAIL_OP_SHIFT) | (translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << - R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT); + R300_S_FRONT_ZPASS_OP_SHIFT); if (ctx->Stencil._TestTwoSide) { rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= (translate_stencil_op(ctx->Stencil.FailFunc[1]) << - R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) + R300_S_BACK_SFAIL_OP_SHIFT) | (translate_stencil_op(ctx->Stencil.ZFailFunc[1]) << - R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) + R300_S_BACK_ZFAIL_OP_SHIFT) | (translate_stencil_op(ctx->Stencil.ZPassFunc[1]) << - R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT); + R300_S_BACK_ZPASS_OP_SHIFT); } else { rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= (translate_stencil_op(ctx->Stencil.FailFunc[0]) << - R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) + R300_S_BACK_SFAIL_OP_SHIFT) | (translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << - R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) + R300_S_BACK_ZFAIL_OP_SHIFT) | (translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << - R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT); + R300_S_BACK_ZPASS_OP_SHIFT); } } @@ -1005,10 +1005,10 @@ static void r300ClearStencil(GLcontext * ctx, GLint s) r300ContextPtr rmesa = R300_CONTEXT(ctx); rmesa->state.stencil.clear = - ((GLuint) (ctx->Stencil.Clear & ZB_STENCILREFMASK_STENCIL_MASK) | - (ZB_STENCILREFMASK_STENCIL_MASK << ZB_STENCILREFMASK_STENCILMASK_SHIFT) | - ((ctx->Stencil.WriteMask[0] & ZB_STENCILREFMASK_STENCIL_MASK) << - ZB_STENCILREFMASK_STENCILMASK_SHIFT)); + ((GLuint) (ctx->Stencil.Clear & R300_STENCILREF_MASK) | + (R300_STENCILREF_MASK << R300_STENCILMASK_SHIFT) | + ((ctx->Stencil.WriteMask[0] & R300_STENCILREF_MASK) << + R300_STENCILMASK_SHIFT)); } /* ============================================================= @@ -1322,6 +1322,82 @@ static unsigned long gen_fixed_filter(unsigned long f) return f; } +static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + int i; + struct r300_fragment_program *fp = (struct r300_fragment_program *) + (char *)ctx->FragmentProgram._Current; + + R300_STATECHANGE(r300, fpt); + + for (i = 0; i < fp->tex.length; i++) { + int unit; + int opcode; + unsigned long val; + + unit = fp->tex.inst[i] >> R300_TEX_ID_SHIFT; + unit &= 15; + + val = fp->tex.inst[i]; + val &= ~R300_TEX_ID_MASK; + + opcode = + (val & R300_TEX_INST_MASK) >> R300_TEX_INST_SHIFT; + if (opcode == R300_TEX_OP_KIL) { + r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; + } else { + if (tmu_mappings[unit] >= 0) { + val |= + tmu_mappings[unit] << + R300_TEX_ID_SHIFT; + r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; + } else { + // We get here when the corresponding texture image is incomplete + // (e.g. incomplete mipmaps etc.) + r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; + } + } + } + + r300->hw.fpt.cmd[R300_FPT_CMD_0] = + cmdpacket0(R300_US_TEX_INST_0, fp->tex.length); +} + +static void r500SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) +{ + int i; + struct r500_fragment_program *fp = (struct r500_fragment_program *) + (char *)ctx->FragmentProgram._Current; + + /* find all the texture instructions and relocate the texture units */ + for (i = 0; i < fp->inst_end + 1; i++) { + if ((fp->inst[i].inst0 & 0x3) == R500_INST_TYPE_TEX) { + uint32_t val; + int unit, opcode, new_unit; + + val = fp->inst[i].inst1; + + unit = (val >> 16) & 0xf; + + val &= ~(0xf << 16); + + opcode = val & (0x7 << 22); + if (opcode == R500_TEX_INST_TEXKILL) { + new_unit = 0; + } else { + if (tmu_mappings[unit] >= 0) { + new_unit = tmu_mappings[unit]; + } else { + new_unit = 0; + } + } + val |= R500_TEX_ID(new_unit); + fp->inst[i].inst1 = val; + } + } +} + static void r300SetupTextures(GLcontext * ctx) { int i, mtu; @@ -1436,39 +1512,18 @@ static void r300SetupTextures(GLcontext * ctx) if (!fp) /* should only happenen once, just after context is created */ return; - R300_STATECHANGE(r300, fpt); - - for (i = 0; i < fp->tex.length; i++) { - int unit; - int opcode; - unsigned long val; - - unit = fp->tex.inst[i] >> R300_FPITX_IMAGE_SHIFT; - unit &= 15; - - val = fp->tex.inst[i]; - val &= ~R300_FPITX_IMAGE_MASK; - - opcode = - (val & R300_FPITX_OPCODE_MASK) >> R300_FPITX_OPCODE_SHIFT; - if (opcode == R300_FPITX_OP_KIL) { - r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; - } else { - if (tmu_mappings[unit] >= 0) { - val |= - tmu_mappings[unit] << - R300_FPITX_IMAGE_SHIFT; - r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; - } else { - // We get here when the corresponding texture image is incomplete - // (e.g. incomplete mipmaps etc.) - r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; - } + if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { + if (fp->mesa_program.UsesKill && last_hw_tmu < 0) { + // The KILL operation requires the first texture unit + // to be enabled. + r300->hw.txe.cmd[R300_TXE_ENABLE] |= 1; + r300->hw.tex.filter.cmd[R300_TEX_VALUE_0] = 0; + r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_FILTER0_0, 1); } - } - - r300->hw.fpt.cmd[R300_FPT_CMD_0] = - cmdpacket0(R300_PFS_TEXI_0, fp->tex.length); + r300SetupFragmentShaderTextures(ctx, tmu_mappings); + } else + r500SetupFragmentShaderTextures(ctx, tmu_mappings); if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "TX_ENABLE: %08x last_hw_tmu=%d\n", @@ -1488,21 +1543,17 @@ static void r300SetupRSUnit(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); /* I'm still unsure if these are needed */ - GLuint interp_magic[8] = { - 0x00, - R300_RS_COL_PTR(1), - R300_RS_COL_PTR(2), - R300_RS_COL_PTR(3), - 0x00, - 0x00, - 0x00, - 0x00 - }; + GLuint interp_col[8]; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; union r300_outputs_written OutputsWritten; GLuint InputsRead; int fp_reg, high_rr; - int in_texcoords, col_interp_nr; - int i; + int col_interp_nr; + int rs_tex_count = 0, rs_col_count = 0; + int i, count; + + memset(interp_col, 0, sizeof(interp_col)); if (hw_tcl_on) OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; @@ -1520,7 +1571,7 @@ static void r300SetupRSUnit(GLcontext * ctx) R300_STATECHANGE(r300, rc); R300_STATECHANGE(r300, rr); - fp_reg = in_texcoords = col_interp_nr = high_rr = 0; + fp_reg = col_interp_nr = high_rr = 0; r300->hw.rr.cmd[R300_RR_INST_1] = 0; @@ -1538,12 +1589,50 @@ static void r300SetupRSUnit(GLcontext * ctx) InputsRead &= ~FRAG_BIT_WPOS; } + if (InputsRead & FRAG_BIT_COL0) { + count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; + interp_col[0] |= R300_RS_COL_PTR(rs_col_count); + if (count == 3) + interp_col[0] |= R300_RS_COL_FMT(R300_RS_COL_FMT_RGB1); + rs_col_count += count; + } + else + interp_col[0] = R300_RS_COL_FMT(R300_RS_COL_FMT_0001); + + if (InputsRead & FRAG_BIT_COL1) { + count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size; + if (count == 3) + interp_col[1] |= R300_RS_COL_FMT(R300_RS_COL_FMT_RGB0); + interp_col[1] |= R300_RS_COL_PTR(1); + rs_col_count += count; + } + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = 0 | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) | (in_texcoords << R300_RS_INTERP_SRC_SHIFT) - | interp_magic[i]; + int swiz; + + /* with TCL we always seem to route 4 components */ + if (hw_tcl_on) + count = 4; + else + count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size; + + r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = interp_col[i] | rs_tex_count; + switch(count) { + case 4: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3); break; + case 3: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(R300_RS_SEL_K1); break; + default: + case 1: + case 2: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(R300_RS_SEL_K0) | R300_RS_SEL_Q(R300_RS_SEL_K1); break; + }; + + r300->hw.ri.cmd[R300_RI_INTERP_0 + i] |= swiz; r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] = 0; if (InputsRead & (FRAG_BIT_TEX0 << i)) { + + rs_tex_count += count; + //assert(r300->state.texture.tc_count != 0); r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] |= R300_RS_INST_TEX_CN_WRITE | i /* source INTERP */ | (fp_reg << R300_RS_INST_TEX_ADDR_SHIFT); @@ -1557,10 +1646,6 @@ static void r300SetupRSUnit(GLcontext * ctx) WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i); } } - /* Need to count all coords enabled at vof */ - if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) { - in_texcoords++; - } } if (InputsRead & FRAG_BIT_COL0) { @@ -1586,23 +1671,186 @@ static void r300SetupRSUnit(GLcontext * ctx) } /* Need at least one. This might still lock as the values are undefined... */ - if (in_texcoords == 0 && col_interp_nr == 0) { + if (rs_tex_count == 0 && col_interp_nr == 0) { r300->hw.rr.cmd[R300_RR_INST_0] |= R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | (fp_reg++ << R300_RS_INST_COL_ADDR_SHIFT); col_interp_nr++; } - r300->hw.rc.cmd[1] = 0 | ((in_texcoords << 2) << R300_IT_COUNT_SHIFT) + r300->hw.rc.cmd[1] = 0 | (rs_tex_count << R300_IT_COUNT_SHIFT) | (col_interp_nr << R300_IC_COUNT_SHIFT) | R300_HIRES_EN; assert(high_rr >= 0); r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_INST_0, high_rr + 1); + r300->hw.rc.cmd[2] = high_rr; + + if (InputsRead) + WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); +} + +static void r500SetupRSUnit(GLcontext * ctx) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + /* I'm still unsure if these are needed */ + GLuint interp_col[8]; + union r300_outputs_written OutputsWritten; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint InputsRead; + int fp_reg, high_rr; + int rs_col_count = 0; + int in_texcoords, col_interp_nr; + int i, count; + + memset(interp_col, 0, sizeof(interp_col)); + if (hw_tcl_on) + OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; + else + RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->state.render_inputs_bitset); + + if (ctx->FragmentProgram._Current) + InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; + else { + fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); + return; /* This should only ever happen once.. */ + } + + R300_STATECHANGE(r300, ri); + R300_STATECHANGE(r300, rc); + R300_STATECHANGE(r300, rr); + + fp_reg = col_interp_nr = high_rr = in_texcoords = 0; + + r300->hw.rr.cmd[R300_RR_INST_1] = 0; + + if (InputsRead & FRAG_BIT_WPOS) { + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + if (!(InputsRead & (FRAG_BIT_TEX0 << i))) + break; + + if (i == ctx->Const.MaxTextureUnits) { + fprintf(stderr, "\tno free texcoord found...\n"); + _mesa_exit(-1); + } + + InputsRead |= (FRAG_BIT_TEX0 << i); + InputsRead &= ~FRAG_BIT_WPOS; + } + + if (InputsRead & FRAG_BIT_COL0) { + count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; + interp_col[0] |= R500_RS_COL_PTR(rs_col_count); + if (count == 3) + interp_col[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_RGB1); + rs_col_count += count; + } + else + interp_col[0] = R500_RS_COL_FMT(R300_RS_COL_FMT_0001); + + if (InputsRead & FRAG_BIT_COL1) { + count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size; + interp_col[1] |= R500_RS_COL_PTR(1); + if (count == 3) + interp_col[1] |= R500_RS_COL_FMT(R300_RS_COL_FMT_RGB0); + rs_col_count += count; + } + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + GLuint swiz = 0; + + /* with TCL we always seem to route 4 components */ + if (InputsRead & (FRAG_BIT_TEX0 << i)) { + + if (hw_tcl_on) + count = 4; + else + count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size; + + /* always have on texcoord */ + swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_S_SHIFT; + if (count >= 2) + swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_T_SHIFT; + else + swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT; + + if (count >= 3) + swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_R_SHIFT; + else + swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT; + + if (count == 4) + swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_Q_SHIFT; + else + swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT; + + } else + swiz = (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) | + (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT); + + r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = interp_col[i] | swiz; + + r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] = 0; + if (InputsRead & (FRAG_BIT_TEX0 << i)) { + //assert(r300->state.texture.tc_count != 0); + r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] |= R500_RS_INST_TEX_CN_WRITE | i /* source INTERP */ + | (fp_reg << R500_RS_INST_TEX_ADDR_SHIFT); + high_rr = fp_reg; + + /* Passing invalid data here can lock the GPU. */ + if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) { + InputsRead &= ~(FRAG_BIT_TEX0 << i); + fp_reg++; + } else { + WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i); + } + } + } + + if (InputsRead & FRAG_BIT_COL0) { + if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) { + r300->hw.rr.cmd[R300_RR_INST_0] |= R500_RS_INST_COL_CN_WRITE | (fp_reg++ << R500_RS_INST_COL_ADDR_SHIFT); + InputsRead &= ~FRAG_BIT_COL0; + col_interp_nr++; + } else { + WARN_ONCE("fragprog wants col0, vp doesn't provide it\n"); + } + } + + if (InputsRead & FRAG_BIT_COL1) { + if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) { + r300->hw.rr.cmd[R300_RR_INST_1] |= (1 << 12) | R500_RS_INST_COL_CN_WRITE | (fp_reg++ << R500_RS_INST_COL_ADDR_SHIFT); + InputsRead &= ~FRAG_BIT_COL1; + if (high_rr < 1) + high_rr = 1; + col_interp_nr++; + } else { + WARN_ONCE("fragprog wants col1, vp doesn't provide it\n"); + } + } + + /* Need at least one. This might still lock as the values are undefined... */ + if (in_texcoords == 0 && col_interp_nr == 0) { + r300->hw.rr.cmd[R300_RR_INST_0] |= 0 | R500_RS_INST_COL_CN_WRITE | (fp_reg++ << R500_RS_INST_COL_ADDR_SHIFT); + col_interp_nr++; + } + + r300->hw.rc.cmd[1] = 0 | (in_texcoords << R300_IT_COUNT_SHIFT) + | (col_interp_nr << R300_IC_COUNT_SHIFT) + | R300_HIRES_EN; + + assert(high_rr >= 0); + r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R500_RS_INST_0, high_rr + 1); r300->hw.rc.cmd[2] = 0xC0 | high_rr; if (InputsRead) WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); } + + + #define bump_vpu_count(ptr, new_count) do{\ drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr));\ int _nc=(new_count)/4; \ @@ -1648,10 +1896,67 @@ static inline void r300SetupVertexProgramFragment(r300ContextPtr r300, int dest, } } +#define MIN3(a, b, c) ((a) < (b) ? MIN2(a, c) : MIN2(b, c)) + + +static void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, + GLuint output_count, GLuint temp_count) +{ + int vtx_mem_size; + int pvs_num_slots; + int pvs_num_cntrls; + + /* Flush PVS engine before changing PVS_NUM_SLOTS, PVS_NUM_CNTRLS. + * See r500 docs 6.5.2 - done in emit */ + + /* avoid division by zero */ + if (input_count == 0) input_count = 1; + if (output_count == 0) output_count = 1; + if (temp_count == 0) temp_count = 1; + + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + vtx_mem_size = 128; + else + vtx_mem_size = 72; + + pvs_num_slots = MIN3(10, vtx_mem_size/input_count, vtx_mem_size/output_count); + pvs_num_cntrls = MIN2(6, vtx_mem_size/temp_count); + + R300_STATECHANGE(rmesa, vap_cntl); + if (rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL) { + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] = + (pvs_num_slots << R300_PVS_NUM_SLOTS_SHIFT) | + (pvs_num_cntrls << R300_PVS_NUM_CNTLRS_SHIFT) | + (12 << R300_VF_MAX_VTX_NUM_SHIFT); + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] |= R500_TCL_STATE_OPTIMIZATION; + } else + /* not sure about non-tcl */ + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] = ((10 << R300_PVS_NUM_SLOTS_SHIFT) | + (5 << R300_PVS_NUM_CNTLRS_SHIFT) | + (5 << R300_VF_MAX_VTX_NUM_SHIFT)); + + if (rmesa->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV515) + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] |= (2 << R300_PVS_NUM_FPUS_SHIFT); + else if ((rmesa->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530) || + (rmesa->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV560)) + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] |= (5 << R300_PVS_NUM_FPUS_SHIFT); + else if (rmesa->radeon.radeonScreen->chip_family == CHIP_FAMILY_R420) + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] |= (6 << R300_PVS_NUM_FPUS_SHIFT); + else if ((rmesa->radeon.radeonScreen->chip_family == CHIP_FAMILY_R520) || + (rmesa->radeon.radeonScreen->chip_family == CHIP_FAMILY_R580) || + (rmesa->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV570)) + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] |= (8 << R300_PVS_NUM_FPUS_SHIFT); + else + rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] |= (4 << R300_PVS_NUM_FPUS_SHIFT); + +} + static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) { struct r300_vertex_shader_state *prog = &(rmesa->state.vertex_shader); GLuint o_reg = 0; + GLuint i_reg = 0; int i; int inst_count = 0; int param_count = 0; @@ -1664,26 +1969,37 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) prog->program.body.i[program_end + 2] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); prog->program.body.i[program_end + 3] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); program_end += 4; + i_reg++; } } prog->program.length = program_end; - r300SetupVertexProgramFragment(rmesa, R300_PVS_UPLOAD_PROGRAM, + r300SetupVertexProgramFragment(rmesa, R300_PVS_CODE_START, &(prog->program)); inst_count = (prog->program.length / 4) - 1; + r300VapCntl(rmesa, i_reg, o_reg, 0); + R300_STATECHANGE(rmesa, pvs); rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = - (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | - (inst_count << R300_PVS_CNTL_1_POS_END_SHIFT) | - (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); + (0 << R300_PVS_FIRST_INST_SHIFT) | + (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | + (inst_count << R300_PVS_LAST_INST_SHIFT); rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = - (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) | - (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT); + (0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | + (param_count << R300_PVS_MAX_CONST_ADDR_SHIFT); rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = - (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) | - (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT); + (inst_count << R300_PVS_LAST_VTX_SRC_INST_SHIFT); +} + +static int bit_count (int x) +{ + x = ((x & 0xaaaaaaaaU) >> 1) + (x & 0x55555555U); + x = ((x & 0xccccccccU) >> 2) + (x & 0x33333333U); + x = (x >> 16) + (x & 0xffff); + x = ((x & 0xf0f0) >> 4) + (x & 0x0f0f); + return (x >> 8) + (x & 0x00ff); } static void r300SetupRealVertexProgram(r300ContextPtr rmesa) @@ -1704,20 +2020,22 @@ static void r300SetupRealVertexProgram(r300ContextPtr rmesa) bump_vpu_count(rmesa->hw.vpp.cmd, param_count); param_count /= 4; - r300SetupVertexProgramFragment(rmesa, R300_PVS_UPLOAD_PROGRAM, &(prog->program)); + r300SetupVertexProgramFragment(rmesa, R300_PVS_CODE_START, &(prog->program)); inst_count = (prog->program.length / 4) - 1; + r300VapCntl(rmesa, bit_count(prog->key.InputsRead), + bit_count(prog->key.OutputsWritten), prog->num_temporaries); + R300_STATECHANGE(rmesa, pvs); rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = - (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | - (inst_count << R300_PVS_CNTL_1_POS_END_SHIFT) | - (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); + (0 << R300_PVS_FIRST_INST_SHIFT) | + (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | + (inst_count << R300_PVS_LAST_INST_SHIFT); rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = - (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) | - (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT); + (0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | + (param_count << R300_PVS_MAX_CONST_ADDR_SHIFT); rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = - (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) | - (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT); + (inst_count << R300_PVS_LAST_VTX_SRC_INST_SHIFT); } static void r300SetupVertexProgram(r300ContextPtr rmesa) @@ -1740,13 +2058,6 @@ static void r300SetupVertexProgram(r300ContextPtr rmesa) r300SetupDefaultVertexProgram(rmesa); } - - /* FIXME: This is done for vertex shader fragments, but also needs to be - * done for vap_pvs, so I leave it as a reminder. */ -#if 0 - reg_start(R300_VAP_PVS_WAITIDLE, 0); - e32(0x00000000); -#endif } /** @@ -1848,11 +2159,6 @@ static void r300ResetHwState(r300ContextPtr r300) r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); r300Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled); - if (!has_tcl) - r300->hw.vap_cntl.cmd[1] = 0x0014045a; - else - r300->hw.vap_cntl.cmd[1] = 0x0030045A; //0x0030065a /* Dangerous */ - r300->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA | R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA @@ -1878,7 +2184,7 @@ static void r300ResetHwState(r300ContextPtr r300) /* XXX: Other families? */ if (has_tcl) { - r300->hw.vap_clip_cntl.cmd[1] = R300_221C_NORMAL; + r300->hw.vap_clip_cntl.cmd[1] = R300_PS_UCP_MODE_DIST_COP; r300->hw.vap_clip.cmd[1] = r300PackFloat32(1.0); /* X */ r300->hw.vap_clip.cmd[2] = r300PackFloat32(1.0); /* X */ @@ -1902,23 +2208,25 @@ static void r300ResetHwState(r300ContextPtr r300) r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_0] = 0x66666666; r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_1] = 0x06666666; - /* XXX: Other families? */ r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = - R300_GB_TILE_ENABLE | R300_GB_TILE_SIZE_16; - switch (r300->radeon.radeonScreen->chip_family) { - case CHIP_FAMILY_R300: - case CHIP_FAMILY_R350: - case CHIP_FAMILY_RV410: + R300_GB_TILE_ENABLE | R300_GB_TILE_SIZE_16 /*| R300_GB_SUBPIXEL_1_16*/; + switch (r300->radeon.radeonScreen->num_gb_pipes) { + case 1: + default: + r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] |= + R300_GB_TILE_PIPE_COUNT_RV300; + break; + case 2: r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] |= R300_GB_TILE_PIPE_COUNT_R300; break; - case CHIP_FAMILY_R420: + case 3: r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] |= - R300_GB_TILE_PIPE_COUNT_R420; + R300_GB_TILE_PIPE_COUNT_R420_3P; break; - default: + case 4: r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] |= - R300_GB_TILE_DISABLE; /* TODO: This disables tiling totally. I guess it happened accidentially. */ + R300_GB_TILE_PIPE_COUNT_R420; break; } @@ -1967,11 +2275,15 @@ static void r300ResetHwState(r300ContextPtr r300) r300->hw.sc_screendoor.cmd[1] = 0x00FFFFFF; - r300->hw.us_out_fmt.cmd[1] = 0x00001B01; - r300->hw.us_out_fmt.cmd[2] = 0x00001B0F; - r300->hw.us_out_fmt.cmd[3] = 0x00001B0F; - r300->hw.us_out_fmt.cmd[4] = 0x00001B0F; - r300->hw.us_out_fmt.cmd[5] = 0x00000001; + r300->hw.us_out_fmt.cmd[1] = R500_OUT_FMT_C4_8 | + R500_C0_SEL_B | R500_C1_SEL_G | R500_C2_SEL_R | R500_C3_SEL_A; + r300->hw.us_out_fmt.cmd[2] = R500_OUT_FMT_UNUSED | + R500_C0_SEL_B | R500_C1_SEL_G | R500_C2_SEL_R | R500_C3_SEL_A; + r300->hw.us_out_fmt.cmd[3] = R500_OUT_FMT_UNUSED | + R500_C0_SEL_B | R500_C1_SEL_G | R500_C2_SEL_R | R500_C3_SEL_A; + r300->hw.us_out_fmt.cmd[4] = R500_OUT_FMT_UNUSED | + R500_C0_SEL_B | R500_C1_SEL_G | R500_C2_SEL_R | R500_C3_SEL_A; + r300->hw.us_out_fmt.cmd[5] = R300_W_FMT_W24; r300Enable(ctx, GL_FOG, ctx->Fog.Enabled); r300Fogfv(ctx, GL_FOG_MODE, NULL); @@ -2023,15 +2335,32 @@ static void r300ResetHwState(r300ContextPtr r300) if (r300->radeon.sarea->tiling_enabled) { /* XXX: Turn off when clearing buffers ? */ - r300->hw.zb.cmd[R300_ZB_PITCH] |= ZB_DEPTHPITCH_DEPTHMACROTILE_ENABLE; + r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTHMACROTILE_ENABLE; if (ctx->Visual.depthBits == 24) r300->hw.zb.cmd[R300_ZB_PITCH] |= - ZB_DEPTHPITCH_DEPTHMICROTILE_TILED; + R300_DEPTHMICROTILE_TILED; } r300->hw.zb_depthclearvalue.cmd[1] = 0; + switch (ctx->Visual.depthBits) { + case 16: + r300->hw.zstencil_format.cmd[1] = R300_DEPTHFORMAT_16BIT_INT_Z; + break; + case 24: + r300->hw.zstencil_format.cmd[1] = R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL; + break; + default: + fprintf(stderr, "Error: Unsupported depth %d... exiting\n", ctx->Visual.depthBits); + _mesa_exit(-1); + } + + r300->hw.zstencil_format.cmd[2] = R300_ZTOP_DISABLE; + r300->hw.zstencil_format.cmd[3] = 0x00000003; + r300->hw.zstencil_format.cmd[4] = 0x00000000; + r300SetEarlyZState(ctx); + r300->hw.unk4F30.cmd[1] = 0; r300->hw.unk4F30.cmd[2] = 0; @@ -2039,6 +2368,7 @@ static void r300ResetHwState(r300ContextPtr r300) r300->hw.zb_hiz_pitch.cmd[1] = 0; + r300VapCntl(r300, 0, 0, 0); if (has_tcl) { r300->hw.vps.cmd[R300_VPS_ZERO_0] = 0; r300->hw.vps.cmd[R300_VPS_ZERO_1] = 0; @@ -2084,10 +2414,11 @@ void r300UpdateShaders(r300ContextPtr rmesa) hw_tcl_on = future_hw_tcl_on = 0; r300ResetHwState(rmesa); + r300UpdateStateParameters(ctx, _NEW_PROGRAM); return; } - r300UpdateStateParameters(ctx, _NEW_PROGRAM); } + r300UpdateStateParameters(ctx, _NEW_PROGRAM); } static void r300SetupPixelShader(r300ContextPtr rmesa) @@ -2107,26 +2438,28 @@ static void r300SetupPixelShader(r300ContextPtr rmesa) return; } + r300SetupTextures(ctx); + R300_STATECHANGE(rmesa, fpi[0]); - rmesa->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, fp->alu_end + 1); + rmesa->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_RGB_INST_0, fp->alu_end + 1); for (i = 0; i <= fp->alu_end; i++) { rmesa->hw.fpi[0].cmd[R300_FPI_INSTR_0 + i] = fp->alu.inst[i].inst0; } R300_STATECHANGE(rmesa, fpi[1]); - rmesa->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, fp->alu_end + 1); + rmesa->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_RGB_ADDR_0, fp->alu_end + 1); for (i = 0; i <= fp->alu_end; i++) { rmesa->hw.fpi[1].cmd[R300_FPI_INSTR_0 + i] = fp->alu.inst[i].inst1; } R300_STATECHANGE(rmesa, fpi[2]); - rmesa->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, fp->alu_end + 1); + rmesa->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_ALPHA_INST_0, fp->alu_end + 1); for (i = 0; i <= fp->alu_end; i++) { rmesa->hw.fpi[2].cmd[R300_FPI_INSTR_0 + i] = fp->alu.inst[i].inst2; } R300_STATECHANGE(rmesa, fpi[3]); - rmesa->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, fp->alu_end + 1); + rmesa->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_US_ALU_ALPHA_ADDR_0, fp->alu_end + 1); for (i = 0; i <= fp->alu_end; i++) { rmesa->hw.fpi[3].cmd[R300_FPI_INSTR_0 + i] = fp->alu.inst[i].inst3; } @@ -2143,10 +2476,10 @@ static void r300SetupPixelShader(r300ContextPtr rmesa) for (i = 0, k = (4 - (fp->cur_node + 1)); i < 4; i++, k++) { if (i < (fp->cur_node + 1)) { rmesa->hw.fp.cmd[R300_FP_NODE0 + k] = - (fp->node[i].alu_offset << R300_PFS_NODE_ALU_OFFSET_SHIFT) | - (fp->node[i].alu_end << R300_PFS_NODE_ALU_END_SHIFT) | - (fp->node[i].tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT) | - (fp->node[i].tex_end << R300_PFS_NODE_TEX_END_SHIFT) | + (fp->node[i].alu_offset << R300_ALU_START_SHIFT) | + (fp->node[i].alu_end << R300_ALU_SIZE_SHIFT) | + (fp->node[i].tex_offset << R300_TEX_START_SHIFT) | + (fp->node[i].tex_end << R300_TEX_SIZE_SHIFT) | fp->node[i].flags; } else { rmesa->hw.fp.cmd[R300_FP_NODE0 + (3 - i)] = 0; @@ -2163,19 +2496,107 @@ static void r300SetupPixelShader(r300ContextPtr rmesa) } } +#define bump_r500fp_count(ptr, new_count) do{\ + drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr));\ + int _nc=(new_count)/6; \ + assert(_nc < 256); \ + if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\ +} while(0) + +#define bump_r500fp_const_count(ptr, new_count) do{\ + drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr));\ + int _nc=(new_count)/4; \ + assert(_nc < 256); \ + if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\ +} while(0) + +static void r500SetupPixelShader(r300ContextPtr rmesa) +{ + GLcontext *ctx = rmesa->radeon.glCtx; + struct r500_fragment_program *fp = (struct r500_fragment_program *) + (char *)ctx->FragmentProgram._Current; + int i; + + if (!fp) /* should only happenen once, just after context is created */ + return; + + ((drm_r300_cmd_header_t *) rmesa->hw.r500fp.cmd)->r500fp.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.r500fp_const.cmd)->r500fp.count = 0; + + r500TranslateFragmentShader(rmesa, fp); + if (!fp->translated) { + fprintf(stderr, "%s: No valid fragment shader, exiting\n", + __FUNCTION__); + return; + } + + r300SetupTextures(ctx); + + R300_STATECHANGE(rmesa, fp); + rmesa->hw.fp.cmd[R500_FP_PIXSIZE] = fp->max_temp_idx; + + rmesa->hw.fp.cmd[R500_FP_CODE_ADDR] = + R500_US_CODE_START_ADDR(fp->inst_offset) | + R500_US_CODE_END_ADDR(fp->inst_end); + rmesa->hw.fp.cmd[R500_FP_CODE_RANGE] = + R500_US_CODE_RANGE_ADDR(fp->inst_offset) | + R500_US_CODE_RANGE_SIZE(fp->inst_end); + rmesa->hw.fp.cmd[R500_FP_CODE_OFFSET] = + R500_US_CODE_OFFSET_ADDR(0); /* FIXME when we add flow control */ + + R300_STATECHANGE(rmesa, r500fp); + /* Emit our shader... */ + for (i = 0; i < fp->inst_end+1; i++) { + rmesa->hw.r500fp.cmd[i*6+1] = fp->inst[i].inst0; + rmesa->hw.r500fp.cmd[i*6+2] = fp->inst[i].inst1; + rmesa->hw.r500fp.cmd[i*6+3] = fp->inst[i].inst2; + rmesa->hw.r500fp.cmd[i*6+4] = fp->inst[i].inst3; + rmesa->hw.r500fp.cmd[i*6+5] = fp->inst[i].inst4; + rmesa->hw.r500fp.cmd[i*6+6] = fp->inst[i].inst5; + } + + bump_r500fp_count(rmesa->hw.r500fp.cmd, (fp->inst_end + 1) * 6); + + R300_STATECHANGE(rmesa, r500fp_const); + for (i = 0; i < fp->const_nr; i++) { + rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 0] = r300PackFloat32(fp->constant[i][0]); + rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 1] = r300PackFloat32(fp->constant[i][1]); + rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = r300PackFloat32(fp->constant[i][2]); + rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 3] = r300PackFloat32(fp->constant[i][3]); + } + bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, fp->const_nr * 4); + +} + void r300UpdateShaderStates(r300ContextPtr rmesa) { GLcontext *ctx; ctx = rmesa->radeon.glCtx; r300UpdateTextureState(ctx); + r300SetEarlyZState(ctx); - r300SetupPixelShader(rmesa); - r300SetupTextures(ctx); + GLuint fgdepthsrc = R300_FG_DEPTH_SRC_SCAN; + if (current_fragment_program_writes_depth(ctx)) + fgdepthsrc = R300_FG_DEPTH_SRC_SHADER; + if (fgdepthsrc != rmesa->hw.fg_depth_src.cmd[1]) { + R300_STATECHANGE(rmesa, fg_depth_src); + rmesa->hw.fg_depth_src.cmd[1] = fgdepthsrc; + } + + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + r500SetupPixelShader(rmesa); + else + r300SetupPixelShader(rmesa); + + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + r500SetupRSUnit(ctx); + else + r300SetupRSUnit(ctx); if ((rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) r300SetupVertexProgram(rmesa); - r300SetupRSUnit(ctx); + } /** @@ -2215,12 +2636,12 @@ void r300InitState(r300ContextPtr r300) switch (ctx->Visual.depthBits) { case 16: r300->state.depth.scale = 1.0 / (GLfloat) 0xffff; - depth_fmt = ZB_FORMAR_DEPTHFORMAT_16BIT_INT_Z; + depth_fmt = R300_DEPTHFORMAT_16BIT_INT_Z; r300->state.stencil.clear = 0x00000000; break; case 24: r300->state.depth.scale = 1.0 / (GLfloat) 0xffffff; - depth_fmt = ZB_FORMAR_DEPTHFORMAT_24BIT_INT_Z; + depth_fmt = R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL; r300->state.stencil.clear = 0x00ff0000; break; default: @@ -2249,11 +2670,11 @@ void r300UpdateClipPlanes( GLcontext *ctx ) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint p; - + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p]; - + R300_STATECHANGE( rmesa, vpucp[p] ); rmesa->hw.vpucp[p].cmd[R300_VPUCP_X] = ip[0]; rmesa->hw.vpucp[p].cmd[R300_VPUCP_Y] = ip[1]; diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index a732bdb5598..8aebd9be3ea 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -78,31 +78,6 @@ do { \ rmesa->swtcl.vertex_attr_count++; \ } while (0) -/* this differs from the VIR0 in emit.c - TODO merge them using another option */ -static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, - int *inputs, GLint * tab, GLuint nr) -{ - GLuint i, dw; - - /* type, inputs, stop bit, size */ - for (i = 0; i + 1 < nr; i += 2) { - dw = (inputs[tab[i]] << 8) | 0x3; - dw |= ((inputs[tab[i + 1]] << 8) | 0x3) << 16; - if (i + 2 == nr) { - dw |= (R300_VAP_INPUT_ROUTE_END << 16); - } - dst[i >> 1] = dw; - } - - if (nr & 1) { - dw = (inputs[tab[nr - 1]] << 8) | 0x3; - dw |= R300_VAP_INPUT_ROUTE_END; - dst[nr >> 1] = dw; - } - - return (nr + 1) >> 1; -} - static void r300SetVertexFormat( GLcontext *ctx ) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); @@ -118,19 +93,24 @@ static void r300SetVertexFormat( GLcontext *ctx ) GLint tab[VERT_ATTRIB_MAX]; int swizzle[VERT_ATTRIB_MAX][4]; GLuint i, nr; + GLuint sz, vap_fmt_1 = 0; DECLARE_RENDERINPUTS(render_inputs_bitset); RENDERINPUTS_COPY(render_inputs_bitset, tnl->render_inputs_bitset); RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset ); RENDERINPUTS_COPY(rmesa->state.render_inputs_bitset, render_inputs_bitset); + vte = rmesa->hw.vte.cmd[1]; + vte &= ~(R300_VTX_XY_FMT | R300_VTX_Z_FMT | R300_VTX_W0_FMT); /* Important: */ if ( VB->NdcPtr != NULL ) { VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; + vte |= R300_VTX_XY_FMT | R300_VTX_Z_FMT; } else { VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr; + vte |= R300_VTX_W0_FMT; } assert( VB->AttribPtr[VERT_ATTRIB_POS] != NULL ); @@ -140,14 +120,15 @@ static void r300SetVertexFormat( GLcontext *ctx ) * build up a hardware vertex. */ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POS)) { - vap_vte_cntl |= R300_VTX_W0_FMT; + sz = VB->AttribPtr[VERT_ATTRIB_POS]->size; InputsRead |= 1 << VERT_ATTRIB_POS; OutputsWritten |= 1 << VERT_RESULT_HPOS; - EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F ); - } else + EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_1F + sz - 1 ); + offset = sz; + } else { + offset = 4; EMIT_PAD(4 * sizeof(float)); - - offset = 4; + } if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) { EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F ); @@ -156,18 +137,19 @@ static void r300SetVertexFormat( GLcontext *ctx ) } if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_COLOR0)) { + sz = VB->AttribPtr[VERT_ATTRIB_COLOR0]->size; rmesa->swtcl.coloroffset = offset; InputsRead |= 1 << VERT_ATTRIB_COLOR0; OutputsWritten |= 1 << VERT_RESULT_COL0; - EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F ); + EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_1F + sz - 1 ); + offset += sz; } - offset += 4; - rmesa->swtcl.specoffset = 0; if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) { + sz = VB->AttribPtr[VERT_ATTRIB_COLOR1]->size; rmesa->swtcl.specoffset = offset; - EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F ); + EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_1F + sz - 1 ); InputsRead |= 1 << VERT_ATTRIB_COLOR1; OutputsWritten |= 1 << VERT_RESULT_COL1; } @@ -177,9 +159,11 @@ static void r300SetVertexFormat( GLcontext *ctx ) for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) { + sz = VB->TexCoordPtr[i]->size; InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i); OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i); - EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_4F ); + EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_1F + sz - 1 ); + vap_fmt_1 |= sz << (3 * i); } } } @@ -238,7 +222,7 @@ static void r300SetVertexFormat( GLcontext *ctx ) R300_STATECHANGE(rmesa, vof); rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten); - rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten); + rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = vap_fmt_1; rmesa->swtcl.vertex_size = _tnl_install_attrs( ctx, @@ -250,7 +234,7 @@ static void r300SetVertexFormat( GLcontext *ctx ) RENDERINPUTS_COPY( rmesa->tnl_index_bitset, index_bitset ); - vte = rmesa->hw.vte.cmd[1]; + R300_STATECHANGE(rmesa, vte); rmesa->hw.vte.cmd[1] = vte; rmesa->hw.vte.cmd[2] = rmesa->swtcl.vertex_size; @@ -591,6 +575,7 @@ static void r300RenderStart(GLcontext *ctx) r300ChooseRenderState(ctx); r300SetVertexFormat(ctx); + r300UpdateShaders(rmesa); r300UpdateShaderStates(rmesa); r300EmitCacheFlush(rmesa); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 43d1406da34..78fa75228e7 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -398,16 +398,18 @@ static void r300SetTexImages(r300ContextPtr rmesa, R300_TX_HEIGHTMASK_SHIFT)) | ((numLevels - 1) << R300_TX_MAX_MIP_LEVEL_SHIFT); + t->pitch = 0; + /* Only need to round to nearest 32 for textures, but the blitter * requires 64-byte aligned pitches, and we may/may not need the * blitter. NPOT only! */ if (baseImage->IsCompressed) { - t->pitch = + t->pitch |= (tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63); } else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) { unsigned int align = blitWidth - 1; - t->pitch = ((tObj->Image[0][t->base.firstLevel]->Width * + t->pitch |= ((tObj->Image[0][t->base.firstLevel]->Width * texelBytes) + 63) & ~(63); t->size |= R300_TX_SIZE_TXPITCH_EN; if (!t->image_override) @@ -415,11 +417,18 @@ static void r300SetTexImages(r300ContextPtr rmesa, (((tObj->Image[0][t->base.firstLevel]->Width) + align) & ~align) - 1; } else { - t->pitch = + t->pitch |= ((tObj->Image[0][t->base.firstLevel]->Width * texelBytes) + 63) & ~(63); } + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + if (tObj->Image[0][t->base.firstLevel]->Width > 2048) + t->pitch_reg |= R500_TXWIDTH_BIT11; + if (tObj->Image[0][t->base.firstLevel]->Height > 2048) + t->pitch_reg |= R500_TXHEIGHT_BIT11; + } + t->dirty_state = TEX_ALL; /* FYI: r300UploadTexImages( rmesa, t ) used to be called here */ @@ -573,6 +582,7 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname, struct gl_texture_object *tObj = _mesa_lookup_texture(rmesa->radeon.glCtx, texname); r300TexObjPtr t; + uint32_t pitch_val; if (!tObj) return; @@ -585,28 +595,30 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname, return; t->offset = offset; - t->pitch_reg = pitch; + t->pitch_reg &= (1 << 13) -1; + pitch_val = pitch; switch (depth) { case 32: t->format = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); t->filter |= tx_table[2].filter; - t->pitch_reg /= 4; + pitch_val /= 4; break; case 24: default: t->format = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); t->filter |= tx_table[4].filter; - t->pitch_reg /= 4; + pitch_val /= 4; break; case 16: t->format = R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5); t->filter |= tx_table[5].filter; - t->pitch_reg /= 2; + pitch_val /= 2; break; } + pitch_val--; - t->pitch_reg--; + t->pitch_reg |= pitch_val; } static GLboolean r300UpdateTextureUnit(GLcontext * ctx, int unit) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index e91d96852db..861f0427cf5 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -1426,6 +1426,8 @@ void r300SelectVertexShader(r300ContextPtr r300) GLint wpos_idx; vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; + wanted_key.InputsRead = vpc->mesa_program.Base.InputsRead; + wanted_key.OutputsWritten = vpc->mesa_program.Base.OutputsWritten; InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; wpos_idx = -1; @@ -1439,11 +1441,9 @@ void r300SelectVertexShader(r300ContextPtr r300) _mesa_exit(-1); } - InputsRead |= (FRAG_BIT_TEX0 << i); + wanted_key.OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i); wpos_idx = i; } - wanted_key.InputsRead = vpc->mesa_program.Base.InputsRead; - wanted_key.OutputsWritten = vpc->mesa_program.Base.OutputsWritten; add_outputs(&wanted_key, VERT_RESULT_HPOS); diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c new file mode 100644 index 00000000000..b967aa2d737 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -0,0 +1,1667 @@ +/* + * Copyright (C) 2005 Ben Skeggs. + * + * Copyright 2008 Corbin Simpson <[email protected]> + * Adaptation and modification for ATI/AMD Radeon R500 GPU chipsets. + * + * 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 (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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** + * \file + * + * \author Ben Skeggs <[email protected]> + * + * \author Jerome Glisse <[email protected]> + * + * \author Corbin Simpson <[email protected]> + * + * \todo Depth write, WPOS/FOGC inputs + * + * \todo FogOption + * + * \todo Verify results of opcodes for accuracy, I've only checked them in + * specific cases. + */ + +#include "glheader.h" +#include "macros.h" +#include "enums.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" + +#include "r300_context.h" +#include "r500_fragprog.h" +#include "r300_reg.h" +#include "r300_state.h" + +/* + * Useful macros and values + */ +#define ERROR(fmt, args...) do { \ + fprintf(stderr, "%s::%s(): " fmt "\n", \ + __FILE__, __FUNCTION__, ##args); \ + fp->error = GL_TRUE; \ + } while(0) + +#define COMPILE_STATE struct r300_pfs_compile_state *cs = fp->cs + +#define R500_US_NUM_TEMP_REGS 128 +#define R500_US_NUM_CONST_REGS 256 + +/* "Register" flags */ +#define REG_CONSTANT (1 << 8) +#define REG_SRC_REL (1 << 9) +#define REG_DEST_REL (1 << 7) + +/* Swizzle tools */ +#define R500_SWIZZLE_ZERO 4 +#define R500_SWIZZLE_HALF 5 +#define R500_SWIZZLE_ONE 6 +#define R500_SWIZ_RGB_ZERO ((4 << 0) | (4 << 3) | (4 << 6)) +#define R500_SWIZ_RGB_ONE ((6 << 0) | (6 << 3) | (6 << 6)) +#define R500_SWIZ_RGB_RGB ((0 << 0) | (1 << 3) | (2 << 6)) +#define R500_SWIZ_MOD_NEG 1 +#define R500_SWIZ_MOD_ABS 2 +#define R500_SWIZ_MOD_NEG_ABS 3 +/* Swizzles for inst2 */ +#define MAKE_SWIZ_TEX_STRQ(x) (x << 8) +#define MAKE_SWIZ_TEX_RGBA(x) (x << 24) +/* Swizzles for inst3 */ +#define MAKE_SWIZ_RGB_A(x) (x << 2) +#define MAKE_SWIZ_RGB_B(x) (x << 15) +/* Swizzles for inst4 */ +#define MAKE_SWIZ_ALPHA_A(x) (x << 14) +#define MAKE_SWIZ_ALPHA_B(x) (x << 21) +/* Swizzle for inst5 */ +#define MAKE_SWIZ_RGBA_C(x) (x << 14) +#define MAKE_SWIZ_ALPHA_C(x) (x << 27) + +/* Writemasks */ +#define R500_WRITEMASK_G 0x2 +#define R500_WRITEMASK_B 0x4 +#define R500_WRITEMASK_RGB 0x7 +#define R500_WRITEMASK_A 0x8 +#define R500_WRITEMASK_AR 0x9 +#define R500_WRITEMASK_AG 0xA +#define R500_WRITEMASK_ARG 0xB +#define R500_WRITEMASK_AB 0xC +#define R500_WRITEMASK_ARGB 0xF + +/* 1/(2pi), needed for quick modulus in trig insts + * Thanks to glisse for pointing out how to do it! */ +static const GLfloat RCP_2PI[] = {0.15915494309189535, + 0.15915494309189535, + 0.15915494309189535, + 0.15915494309189535}; + +static const GLfloat LIT[] = {127.999999, + 127.999999, + 127.999999, + -127.999999}; + +static void dump_program(struct r500_fragment_program *fp); + +static inline GLuint make_rgb_swizzle(struct prog_src_register src) { + GLuint swiz = 0x0; + GLuint temp; + /* This could be optimized, but it should be plenty fast already. */ + int i; + for (i = 0; i < 3; i++) { + temp = GET_SWZ(src.Swizzle, i); + /* Fix SWIZZLE_ONE */ + if (temp == 5) temp++; + swiz |= temp << i*3; + } + if (src.NegateBase) + swiz |= (R500_SWIZ_MOD_NEG << 9); + return swiz; +} + +static inline GLuint make_rgba_swizzle(GLuint src) { + GLuint swiz = 0x0; + GLuint temp; + int i; + for (i = 0; i < 4; i++) { + temp = GET_SWZ(src, i); + /* Fix SWIZZLE_ONE */ + if (temp == 5) temp++; + swiz |= temp << i*3; + } + return swiz; +} + +static inline GLuint make_alpha_swizzle(struct prog_src_register src) { + GLuint swiz = GET_SWZ(src.Swizzle, 3); + + if (swiz == 5) swiz++; + + if (src.NegateBase) + swiz |= (R500_SWIZ_MOD_NEG << 3); + + return swiz; +} + +static inline GLuint make_sop_swizzle(struct prog_src_register src) { + GLuint swiz = GET_SWZ(src.Swizzle, 0); + + if (swiz == 5) swiz++; + return swiz; +} + +static inline GLuint make_strq_swizzle(struct prog_src_register src) { + GLuint swiz = 0x0, temp = 0x0; + int i; + for (i = 0; i < 4; i++) { + temp = GET_SWZ(src.Swizzle, i) & 0x3; + swiz |= temp << i*2; + } + return swiz; +} + +static int get_temp(struct r500_fragment_program *fp, int slot) { + + COMPILE_STATE; + + int r = fp->temp_reg_offset + cs->temp_in_use + slot; + + if (r > R500_US_NUM_TEMP_REGS) { + ERROR("Too many temporary registers requested, can't compile!\n"); + } + + return r; +} + +/* Borrowed verbatim from r300_fragprog since it hasn't changed. */ +static GLuint emit_const4fv(struct r500_fragment_program *fp, + const GLfloat * cp) +{ + GLuint reg = 0x0; + int index; + + for (index = 0; index < fp->const_nr; ++index) { + if (fp->constant[index] == cp) + break; + } + + if (index >= fp->const_nr) { + if (index >= R500_US_NUM_CONST_REGS) { + ERROR("Out of hw constants!\n"); + return reg; + } + + fp->const_nr++; + fp->constant[index] = cp; + } + + reg = index | REG_CONSTANT; + return reg; +} + +static GLuint make_src(struct r500_fragment_program *fp, struct prog_src_register src) { + COMPILE_STATE; + GLuint reg; + switch (src.File) { + case PROGRAM_TEMPORARY: + reg = src.Index + fp->temp_reg_offset; + break; + case PROGRAM_INPUT: + reg = cs->inputs[src.Index].reg; + break; + case PROGRAM_LOCAL_PARAM: + reg = emit_const4fv(fp, + fp->mesa_program.Base.LocalParams[src. + Index]); + break; + case PROGRAM_ENV_PARAM: + reg = emit_const4fv(fp, + fp->ctx->FragmentProgram.Parameters[src. + Index]); + break; + case PROGRAM_STATE_VAR: + case PROGRAM_NAMED_PARAM: + case PROGRAM_CONSTANT: + reg = emit_const4fv(fp, fp->mesa_program.Base.Parameters-> + ParameterValues[src.Index]); + break; + default: + ERROR("Can't handle src.File %x\n", src.File); + reg = 0x0; + break; + } + return reg; +} + +static GLuint make_dest(struct r500_fragment_program *fp, struct prog_dst_register dest) { + GLuint reg; + switch (dest.File) { + case PROGRAM_TEMPORARY: + reg = dest.Index + fp->temp_reg_offset; + break; + case PROGRAM_OUTPUT: + /* Eventually we may need to handle multiple + * rendering targets... */ + reg = dest.Index; + break; + default: + ERROR("Can't handle dest.File %x\n", dest.File); + reg = 0x0; + break; + } + return reg; +} + +static void emit_tex(struct r500_fragment_program *fp, + struct prog_instruction *fpi, int dest, int counter) +{ + int hwsrc, hwdest; + GLuint mask; + + mask = fpi->DstReg.WriteMask << 11; + hwsrc = make_src(fp, fpi->SrcReg[0]); + + if (fpi->DstReg.File == PROGRAM_OUTPUT) { + hwdest = get_temp(fp, 0); + } else { + hwdest = dest; + } + + fp->inst[counter].inst0 = R500_INST_TYPE_TEX | mask + | R500_INST_TEX_SEM_WAIT; + + fp->inst[counter].inst1 = R500_TEX_ID(fpi->TexSrcUnit) + | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED; + + if (fpi->TexSrcTarget == TEXTURE_RECT_INDEX) + fp->inst[counter].inst1 |= R500_TEX_UNSCALED; + + switch (fpi->Opcode) { + case OPCODE_KIL: + fp->inst[counter].inst1 |= R500_TEX_INST_TEXKILL; + break; + case OPCODE_TEX: + fp->inst[counter].inst1 |= R500_TEX_INST_LD; + break; + case OPCODE_TXB: + fp->inst[counter].inst1 |= R500_TEX_INST_LODBIAS; + break; + case OPCODE_TXP: + fp->inst[counter].inst1 |= R500_TEX_INST_PROJ; + break; + default: + ERROR("emit_tex can't handle opcode %x\n", fpi->Opcode); + } + + fp->inst[counter].inst2 = R500_TEX_SRC_ADDR(hwsrc) + | MAKE_SWIZ_TEX_STRQ(make_strq_swizzle(fpi->SrcReg[0])) + /* | R500_TEX_SRC_S_SWIZ_R | R500_TEX_SRC_T_SWIZ_G + | R500_TEX_SRC_R_SWIZ_B | R500_TEX_SRC_Q_SWIZ_A */ + | R500_TEX_DST_ADDR(hwdest) + | R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G + | R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A; + + fp->inst[counter].inst3 = 0x0; + fp->inst[counter].inst4 = 0x0; + fp->inst[counter].inst5 = 0x0; + + if (fpi->DstReg.File == PROGRAM_OUTPUT) { + counter++; + fp->inst[counter].inst0 = R500_INST_TYPE_OUT + | R500_INST_TEX_SEM_WAIT | (mask << 4); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_RGB) + | R500_ALU_RGB_SEL_B_SRC0 + | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_RGB) + | R500_ALU_RGB_OMOD_DISABLE; + fp->inst[counter].inst4 = R500_ALPHA_OP_CMP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_ALPHA_SWIZ_A_A) + | R500_ALPHA_SEL_B_SRC0 | MAKE_SWIZ_ALPHA_B(R500_ALPHA_SWIZ_A_A) + | R500_ALPHA_OMOD_DISABLE; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_CMP + | R500_ALU_RGBA_ADDRD(dest) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + } +} + +static void emit_alu(struct r500_fragment_program *fp, int counter, struct prog_instruction *fpi) { + /* Ideally, we shouldn't have to explicitly clear memory here! */ + fp->inst[counter].inst0 = 0x0; + fp->inst[counter].inst1 = 0x0; + fp->inst[counter].inst2 = 0x0; + fp->inst[counter].inst3 = 0x0; + fp->inst[counter].inst4 = 0x0; + fp->inst[counter].inst5 = 0x0; + + if (fpi->DstReg.File == PROGRAM_OUTPUT) { + fp->inst[counter].inst0 = R500_INST_TYPE_OUT; + + if (fpi->DstReg.Index == FRAG_RESULT_COLR) + fp->inst[counter].inst0 |= (fpi->DstReg.WriteMask << 15); + + if (fpi->DstReg.Index == FRAG_RESULT_DEPR) { + fp->inst[counter].inst4 |= R500_ALPHA_W_OMASK; + /* Notify the state emission! */ + fp->writes_depth = GL_TRUE; + } + } else { + fp->inst[counter].inst0 = R500_INST_TYPE_ALU + /* pixel_mask */ + | (fpi->DstReg.WriteMask << 11); + } + + fp->inst[counter].inst0 |= R500_INST_TEX_SEM_WAIT; +} + +static void emit_mov(struct r500_fragment_program *fp, int counter, struct prog_instruction *fpi, GLuint src_reg, GLuint swizzle, GLuint dest) { + /* The r3xx shader uses MAD to implement MOV. We are using CMP, since + * it is technically more accurate and recommended by ATI/AMD. */ + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src_reg); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src_reg); + /* (De)mangle the swizzle from Mesa to R500. */ + swizzle = make_rgba_swizzle(swizzle); + /* 0x1FF is 9 bits, size of an RGB swizzle. */ + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A((swizzle & 0x1ff)) + | R500_ALU_RGB_SEL_B_SRC0 + | MAKE_SWIZ_RGB_B((swizzle & 0x1ff)) + | R500_ALU_RGB_OMOD_DISABLE; + fp->inst[counter].inst4 |= R500_ALPHA_OP_CMP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(GET_SWZ(swizzle, 3)) + | R500_ALPHA_SEL_B_SRC0 | MAKE_SWIZ_ALPHA_B(GET_SWZ(swizzle, 3)) + | R500_ALPHA_OMOD_DISABLE; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_CMP + | R500_ALU_RGBA_ADDRD(dest) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); +} + +static void emit_mad(struct r500_fragment_program *fp, int counter, struct prog_instruction *fpi, int one, int two, int three) { + /* Note: This code was all Corbin's. Corbin is a rather hackish coder. + * If you can make it pretty or fast, please do so! */ + emit_alu(fp, counter, fpi); + /* Common MAD stuff */ + fp->inst[counter].inst4 |= R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(make_dest(fp, fpi->DstReg)); + fp->inst[counter].inst5 |= R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(make_dest(fp, fpi->DstReg)); + switch (one) { + case 0: + case 1: + case 2: + fp->inst[counter].inst1 |= R500_RGB_ADDR0(make_src(fp, fpi->SrcReg[one])); + fp->inst[counter].inst2 |= R500_ALPHA_ADDR0(make_src(fp, fpi->SrcReg[one])); + fp->inst[counter].inst3 |= R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[one])); + fp->inst[counter].inst4 |= R500_ALPHA_SEL_A_SRC0 + | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[one])); + break; + case R500_SWIZZLE_ZERO: + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ZERO); + fp->inst[counter].inst4 |= MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ZERO); + break; + case R500_SWIZZLE_ONE: + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ONE); + fp->inst[counter].inst4 |= MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ONE); + break; + default: + ERROR("Bad src index in emit_mad: %d\n", one); + break; + } + switch (two) { + case 0: + case 1: + case 2: + fp->inst[counter].inst1 |= R500_RGB_ADDR1(make_src(fp, fpi->SrcReg[two])); + fp->inst[counter].inst2 |= R500_ALPHA_ADDR1(make_src(fp, fpi->SrcReg[two])); + fp->inst[counter].inst3 |= R500_ALU_RGB_SEL_B_SRC1 + | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[two])); + fp->inst[counter].inst4 |= R500_ALPHA_SEL_B_SRC1 + | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[two])); + break; + case R500_SWIZZLE_ZERO: + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_ZERO); + fp->inst[counter].inst4 |= MAKE_SWIZ_ALPHA_B(R500_SWIZZLE_ZERO); + break; + case R500_SWIZZLE_ONE: + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_ONE); + fp->inst[counter].inst4 |= MAKE_SWIZ_ALPHA_B(R500_SWIZZLE_ONE); + break; + default: + ERROR("Bad src index in emit_mad: %d\n", two); + break; + } + switch (three) { + case 0: + case 1: + case 2: + fp->inst[counter].inst1 |= R500_RGB_ADDR2(make_src(fp, fpi->SrcReg[three])); + fp->inst[counter].inst2 |= R500_ALPHA_ADDR2(make_src(fp, fpi->SrcReg[three])); + fp->inst[counter].inst5 |= R500_ALU_RGBA_SEL_C_SRC2 + | MAKE_SWIZ_RGBA_C(make_rgb_swizzle(fpi->SrcReg[three])) + | R500_ALU_RGBA_ALPHA_SEL_C_SRC2 + | MAKE_SWIZ_ALPHA_C(make_alpha_swizzle(fpi->SrcReg[three])); + break; + case R500_SWIZZLE_ZERO: + fp->inst[counter].inst5 |= MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + break; + case R500_SWIZZLE_ONE: + fp->inst[counter].inst5 |= MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ONE) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ONE); + break; + default: + ERROR("Bad src index in emit_mad: %d\n", three); + break; + } +} + +static void emit_sop(struct r500_fragment_program *fp, int counter, struct prog_instruction *fpi, int opcode, GLuint src, GLuint swiz, GLuint dest) { + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src); + fp->inst[counter].inst4 |= R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(swiz); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_SOP + | R500_ALU_RGBA_ADDRD(dest); + switch (opcode) { + case OPCODE_COS: + fp->inst[counter].inst4 |= R500_ALPHA_OP_COS; + break; + case OPCODE_EX2: + fp->inst[counter].inst4 |= R500_ALPHA_OP_EX2; + break; + case OPCODE_LG2: + fp->inst[counter].inst4 |= R500_ALPHA_OP_LN2; + break; + case OPCODE_RCP: + fp->inst[counter].inst4 |= R500_ALPHA_OP_RCP; + break; + case OPCODE_RSQ: + fp->inst[counter].inst4 |= R500_ALPHA_OP_RSQ; + break; + case OPCODE_SIN: + fp->inst[counter].inst4 |= R500_ALPHA_OP_SIN; + break; + default: + ERROR("Bad opcode in emit_sop: %d\n", opcode); + break; + } +} + +static GLboolean parse_program(struct r500_fragment_program *fp) +{ + struct gl_fragment_program *mp = &fp->mesa_program; + const struct prog_instruction *inst = mp->Base.Instructions; + struct prog_instruction *fpi; + GLuint src[3], dest = 0; + int temp_swiz, counter = 0; + + if (!inst || inst[0].Opcode == OPCODE_END) { + ERROR("The program is empty!\n"); + return GL_FALSE; + } + + for (fpi = mp->Base.Instructions; fpi->Opcode != OPCODE_END; fpi++) { + + if (fpi->Opcode != OPCODE_KIL) { + dest = make_dest(fp, fpi->DstReg); + } + + switch (fpi->Opcode) { + case OPCODE_ABS: + emit_mov(fp, counter, fpi, make_src(fp, fpi->SrcReg[0]), fpi->SrcReg[0].Swizzle, dest); + fp->inst[counter].inst3 |= R500_ALU_RGB_MOD_A_ABS + | R500_ALU_RGB_MOD_B_ABS; + fp->inst[counter].inst4 |= R500_ALPHA_MOD_A_ABS + | R500_ALPHA_MOD_B_ABS; + break; + case OPCODE_ADD: + /* Variation on MAD: 1*src0+src1 */ + emit_mad(fp, counter, fpi, R500_SWIZZLE_ONE, 0, 1); + break; + case OPCODE_CMP: + /* This inst's selects need to be swapped as follows: + * 0 -> C ; 1 -> B ; 2 -> A */ + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + src[2] = make_src(fp, fpi->SrcReg[2]); + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[2]) + | R500_RGB_ADDR1(src[1]) | R500_RGB_ADDR2(src[0]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[2]) + | R500_ALPHA_ADDR1(src[1]) | R500_ALPHA_ADDR2(src[0]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[2])) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_CMP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[2])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_CMP + | R500_ALU_RGBA_ADDRD(dest) + | R500_ALU_RGBA_SEL_C_SRC2 + | MAKE_SWIZ_RGBA_C(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGBA_ALPHA_SEL_C_SRC2 + | MAKE_SWIZ_ALPHA_C(make_alpha_swizzle(fpi->SrcReg[0])); + break; + case OPCODE_COS: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = emit_const4fv(fp, RCP_2PI); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_RGB) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A + | R500_ALPHA_SEL_B_SRC1 | R500_ALPHA_SWIZ_B_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 = R500_ALPHA_OP_FRC + | R500_ALPHA_ADDRD(get_temp(fp, 1)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_FRC + | R500_ALU_RGBA_ADDRD(get_temp(fp, 1)); + counter++; + emit_sop(fp, counter, fpi, OPCODE_COS, get_temp(fp, 1), make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_DP3: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_DP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_DP3 + | R500_ALU_RGBA_ADDRD(dest); + break; + case OPCODE_DP4: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + /* Based on DP3 */ + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_DP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_DP4 + | R500_ALU_RGBA_ADDRD(dest); + break; + case OPCODE_DPH: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + /* Based on DP3 */ + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_DP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ONE) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_DP4 + | R500_ALU_RGBA_ADDRD(dest); + break; + case OPCODE_DST: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + /* [1, src0.y*src1.y, src0.z, src1.w] + * So basically MUL with lotsa swizzling. */ + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | R500_ALU_RGB_SEL_B_SRC1; + /* Select [1, y, z, 1] */ + temp_swiz = (make_rgb_swizzle(fpi->SrcReg[0]) & ~0x7) | R500_SWIZZLE_ONE; + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_A(temp_swiz); + /* Select [1, y, 1, w] */ + temp_swiz = (make_rgb_swizzle(fpi->SrcReg[0]) & ~0x1c7) | R500_SWIZZLE_ONE | (R500_SWIZZLE_ONE << 6); + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_B(temp_swiz); + fp->inst[counter].inst4 |= R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ONE) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(dest) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + break; + case OPCODE_EX2: + src[0] = make_src(fp, fpi->SrcReg[0]); + emit_sop(fp, counter, fpi, OPCODE_EX2, src[0], make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_FLR: + src[0] = make_src(fp, fpi->SrcReg[0]); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_FRC + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_FRC + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)); + counter++; + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(get_temp(fp, 0)); + fp->inst[counter].inst3 = MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ONE) + | R500_ALU_RGB_SEL_B_SRC0 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SWIZ_A_A + | R500_ALPHA_SEL_B_SRC0 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(dest) + | R500_ALU_RGBA_SEL_C_SRC1 + | MAKE_SWIZ_RGBA_C(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGBA_ALPHA_SEL_C_SRC1 + | MAKE_SWIZ_ALPHA_C(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGBA_MOD_C_NEG; + break; + case OPCODE_FRC: + src[0] = make_src(fp, fpi->SrcReg[0]); + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_FRC + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_FRC + | R500_ALU_RGBA_ADDRD(dest); + break; + case OPCODE_LG2: + src[0] = make_src(fp, fpi->SrcReg[0]); + emit_sop(fp, counter, fpi, OPCODE_LG2, src[0], make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_LIT: + /* To be honest, I have no idea how I came up with the following. + * All I know is that it's based on the r3xx stuff, and was + * concieved with the help of NyQuil. Mmm, MyQuil. */ + + /* First instruction */ + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = emit_const4fv(fp, LIT); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | (R500_WRITEMASK_ARG << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_ZERO); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAX + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | R500_ALPHA_SWIZ_B_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAX + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)); + counter++; + /* Second instruction */ + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_AB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)) | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + /* Select [w, w, w, y] */ + temp_swiz = 3 | (3 << 3) | (3 << 6); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(temp_swiz) + | R500_ALU_RGB_SEL_B_SRC1 + | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 = R500_ALPHA_OP_LN2 + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_G; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MIN + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)); + counter++; + /* Third instruction */ + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_AG << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + /* Select [x, x, x, z] */ + temp_swiz = 0; + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(temp_swiz) + | R500_ALU_RGB_SEL_B_SRC0 + | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_ONE); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 1)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A + | R500_ALPHA_SEL_B_SRC0 | R500_ALPHA_SWIZ_B_B; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 1)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | R500_ALU_RGBA_A_SWIZ_0; + counter++; + /* Fourth instruction */ + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_AR << 11); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst3 = MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ONE) + | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_ONE); + fp->inst[counter].inst4 = R500_ALPHA_OP_EX2 + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + /* Fifth instruction */ + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_AB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + /* Select [w, w, w] */ + temp_swiz = 3 | (3 << 3) | (3 << 6); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ZERO) + | R500_ALU_RGB_SEL_B_SRC0 + | MAKE_SWIZ_RGB_B(temp_swiz); + fp->inst[counter].inst4 |= R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SWIZ_A_1 + | R500_ALPHA_SWIZ_B_1; + /* Select [-y, -y, -y] */ + temp_swiz = 1 | (1 << 3) | (1 << 6); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_CMP + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | MAKE_SWIZ_RGBA_C(temp_swiz) + | R500_ALU_RGBA_MOD_C_NEG + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + /* Final instruction */ + emit_mov(fp, counter, fpi, get_temp(fp, 0), SWIZZLE_NOOP, dest); + break; + case OPCODE_LRP: + /* src0 * src1 + INV(src0) * src2 + * 1) MUL src0, src1, temp + * 2) PRE 1-src0; MAD srcp, src2, temp */ + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + src[2] = make_src(fp, fpi->SrcReg[2]); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | R500_INST_NOP | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[2]) + | R500_RGB_ADDR2(get_temp(fp, 0)) + | R500_RGB_SRCP_OP_1_MINUS_RGB0; + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[2]) + | R500_ALPHA_ADDR2(get_temp(fp, 0)) + | R500_ALPHA_SRCP_OP_1_MINUS_A0; + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRCP + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 |= R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRCP | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | R500_ALPHA_SWIZ_B_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(dest) + | R500_ALU_RGBA_SEL_C_SRC2 | MAKE_SWIZ_RGBA_C(make_rgb_swizzle(fpi->SrcReg[2])) + | R500_ALU_RGBA_ALPHA_SEL_C_SRC2 + | MAKE_SWIZ_ALPHA_C(make_alpha_swizzle(fpi->SrcReg[2])); + break; + case OPCODE_MAD: + emit_mad(fp, counter, fpi, 0, 1, 2); + break; + case OPCODE_MAX: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 + | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_MAX + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAX + | R500_ALU_RGBA_ADDRD(dest); + break; + case OPCODE_MIN: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 + | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 |= R500_ALPHA_OP_MIN + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MIN + | R500_ALU_RGBA_ADDRD(dest); + break; + case OPCODE_MOV: + emit_mov(fp, counter, fpi, make_src(fp, fpi->SrcReg[0]), fpi->SrcReg[0].Swizzle, dest); + break; + case OPCODE_MUL: + /* Variation on MAD: src0*src1+0 */ + emit_mad(fp, counter, fpi, 0, 1, R500_SWIZZLE_ZERO); + break; + case OPCODE_POW: + /* POW(a,b) = EX2(LN2(a)*b) */ + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + emit_sop(fp, counter, fpi, OPCODE_LG2, src[0], make_sop_swizzle(fpi->SrcReg[0]), get_temp(fp, 0)); + fp->inst[counter].inst0 |= (R500_WRITEMASK_ARGB << 11); + counter++; + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0])) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 1)) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 1)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + emit_sop(fp, counter, fpi, OPCODE_EX2, get_temp(fp, 1), make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_RCP: + src[0] = make_src(fp, fpi->SrcReg[0]); + emit_sop(fp, counter, fpi, OPCODE_RCP, src[0], make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_RSQ: + src[0] = make_src(fp, fpi->SrcReg[0]); + emit_sop(fp, counter, fpi, OPCODE_RSQ, src[0], make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_SCS: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = emit_const4fv(fp, RCP_2PI); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_RGB) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A + | R500_ALPHA_SEL_B_SRC1 | R500_ALPHA_SWIZ_B_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 = R500_ALPHA_OP_FRC + | R500_ALPHA_ADDRD(get_temp(fp, 1)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_FRC + | R500_ALU_RGBA_ADDRD(get_temp(fp, 1)); + counter++; + /* Do a cosine, then a sine, masking out the channels we want to protect. */ + /* Cosine only goes in R (x) channel. */ + fpi->DstReg.WriteMask = 0x1; + emit_sop(fp, counter, fpi, OPCODE_COS, get_temp(fp, 1), make_sop_swizzle(fpi->SrcReg[0]), dest); + counter++; + /* Sine only goes in G (y) channel. */ + fpi->DstReg.WriteMask = 0x2; + emit_sop(fp, counter, fpi, OPCODE_SIN, get_temp(fp, 1), make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_SGE: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR1(src[0]) + | R500_RGB_ADDR2(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR1(src[0]) + | R500_ALPHA_ADDR2(src[1]); + fp->inst[counter].inst3 = /* 1 */ + MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ONE) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ONE) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | R500_ALU_RGBA_SEL_C_SRC2 + | MAKE_SWIZ_RGBA_C(make_rgb_swizzle(fpi->SrcReg[1])) + | R500_ALU_RGBA_MOD_C_NEG + | R500_ALU_RGBA_ALPHA_SEL_C_SRC2 + | MAKE_SWIZ_ALPHA_C(make_alpha_swizzle(fpi->SrcReg[1])) + | R500_ALU_RGBA_ALPHA_MOD_C_NEG; + counter++; + /* This inst's selects need to be swapped as follows: + * 0 -> C ; 1 -> B ; 2 -> A */ + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ONE) + | R500_ALU_RGB_SEL_B_SRC0 + | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_ZERO); + fp->inst[counter].inst4 |= R500_ALPHA_OP_CMP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ONE) + | R500_ALPHA_SEL_B_SRC0 | MAKE_SWIZ_ALPHA_B(R500_SWIZZLE_ZERO); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_CMP + | R500_ALU_RGBA_ADDRD(dest) + | R500_ALU_RGBA_SEL_C_SRC0 + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_RGB) + | R500_ALU_RGBA_ALPHA_SEL_C_SRC0 + | R500_ALU_RGBA_A_SWIZ_A; + break; + case OPCODE_SIN: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = emit_const4fv(fp, RCP_2PI); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_RGB) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A + | R500_ALPHA_SEL_B_SRC1 | R500_ALPHA_SWIZ_B_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_RGB); + fp->inst[counter].inst4 = R500_ALPHA_OP_FRC + | R500_ALPHA_ADDRD(get_temp(fp, 1)) + | R500_ALPHA_SEL_A_SRC0 | R500_ALPHA_SWIZ_A_A; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_FRC + | R500_ALU_RGBA_ADDRD(get_temp(fp, 1)); + counter++; + emit_sop(fp, counter, fpi, OPCODE_SIN, get_temp(fp, 1), make_sop_swizzle(fpi->SrcReg[0]), dest); + break; + case OPCODE_SLT: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | (R500_WRITEMASK_ARGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR1(src[0]) + | R500_RGB_ADDR2(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR1(src[0]) + | R500_ALPHA_ADDR2(src[1]); + fp->inst[counter].inst3 = /* 1 */ + MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ONE) + | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ONE) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[0])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | R500_ALU_RGBA_SEL_C_SRC2 + | MAKE_SWIZ_RGBA_C(make_rgb_swizzle(fpi->SrcReg[1])) + | R500_ALU_RGBA_MOD_C_NEG + | R500_ALU_RGBA_ALPHA_SEL_C_SRC2 + | MAKE_SWIZ_ALPHA_C(make_alpha_swizzle(fpi->SrcReg[1])) + | R500_ALU_RGBA_ALPHA_MOD_C_NEG; + counter++; + /* This inst's selects need to be swapped as follows: + * 0 -> C ; 1 -> B ; 2 -> A */ + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(get_temp(fp, 0)); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(R500_SWIZ_RGB_ZERO) + | R500_ALU_RGB_SEL_B_SRC0 + | MAKE_SWIZ_RGB_B(R500_SWIZ_RGB_ONE); + fp->inst[counter].inst4 |= R500_ALPHA_OP_CMP + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ZERO) + | R500_ALPHA_SEL_B_SRC0 | MAKE_SWIZ_ALPHA_B(R500_SWIZZLE_ONE); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_CMP + | R500_ALU_RGBA_ADDRD(dest) + | R500_ALU_RGBA_SEL_C_SRC0 + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_RGB) + | R500_ALU_RGBA_ALPHA_SEL_C_SRC0 + | R500_ALU_RGBA_A_SWIZ_A; + break; + case OPCODE_SUB: + /* Variation on MAD: 1*src0-src1 */ + fpi->SrcReg[1].NegateBase = 0xF; /* NEG_XYZW */ + emit_mad(fp, counter, fpi, R500_SWIZZLE_ONE, 0, 1); + break; + case OPCODE_SWZ: + /* TODO: The rarer negation masks! */ + emit_mov(fp, counter, fpi, make_src(fp, fpi->SrcReg[0]), fpi->SrcReg[0].Swizzle, dest); + break; + case OPCODE_XPD: + /* src0 * src1 - src1 * src0 + * 1) MUL temp.xyz, src0.yzx, src1.zxy + * 2) MAD src0.zxy, src1.yzx, -temp.xyz */ + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + fp->inst[counter].inst0 = R500_INST_TYPE_ALU | R500_INST_TEX_SEM_WAIT + | (R500_WRITEMASK_RGB << 11); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]); + /* Select [y, z, x] */ + temp_swiz = make_rgb_swizzle(fpi->SrcReg[0]); + temp_swiz = (GET_SWZ(temp_swiz, 1) << 0) | (GET_SWZ(temp_swiz, 2) << 3) | (GET_SWZ(temp_swiz, 0) << 6); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(temp_swiz); + /* Select [z, x, y] */ + temp_swiz = make_rgb_swizzle(fpi->SrcReg[1]); + temp_swiz = (GET_SWZ(temp_swiz, 2) << 0) | (GET_SWZ(temp_swiz, 0) << 3) | (GET_SWZ(temp_swiz, 1) << 6); + fp->inst[counter].inst3 |= R500_ALU_RGB_SEL_B_SRC1 + | MAKE_SWIZ_RGB_B(temp_swiz); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(get_temp(fp, 0)) + | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(make_alpha_swizzle(fpi->SrcReg[0])) + | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1])); + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(get_temp(fp, 0)) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + counter++; + emit_alu(fp, counter, fpi); + fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0]) + | R500_RGB_ADDR1(src[1]) + | R500_RGB_ADDR2(get_temp(fp, 0)); + fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0]) + | R500_ALPHA_ADDR1(src[1]) + | R500_ALPHA_ADDR2(get_temp(fp, 0)); + /* Select [z, x, y] */ + temp_swiz = make_rgb_swizzle(fpi->SrcReg[0]); + temp_swiz = (GET_SWZ(temp_swiz, 2) << 0) | (GET_SWZ(temp_swiz, 0) << 3) | (GET_SWZ(temp_swiz, 1) << 6); + fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0 + | MAKE_SWIZ_RGB_A(temp_swiz); + /* Select [y, z, x] */ + temp_swiz = make_rgb_swizzle(fpi->SrcReg[1]); + temp_swiz = (GET_SWZ(temp_swiz, 1) << 0) | (GET_SWZ(temp_swiz, 2) << 3) | (GET_SWZ(temp_swiz, 0) << 6); + fp->inst[counter].inst3 |= R500_ALU_RGB_SEL_B_SRC1 + | MAKE_SWIZ_RGB_B(temp_swiz); + fp->inst[counter].inst4 |= R500_ALPHA_OP_MAD + | R500_ALPHA_ADDRD(dest) + | R500_ALPHA_SWIZ_A_1 + | R500_ALPHA_SWIZ_B_1; + fp->inst[counter].inst5 = R500_ALU_RGBA_OP_MAD + | R500_ALU_RGBA_ADDRD(dest) + | R500_ALU_RGBA_SEL_C_SRC2 + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_RGB) + | R500_ALU_RGBA_MOD_C_NEG + | R500_ALU_RGBA_A_SWIZ_0; + break; + case OPCODE_KIL: + case OPCODE_TEX: + case OPCODE_TXB: + case OPCODE_TXP: + emit_tex(fp, fpi, dest, counter); + if (fpi->DstReg.File == PROGRAM_OUTPUT) + counter++; + break; + default: + ERROR("unknown fpi->Opcode %s\n", _mesa_opcode_string(fpi->Opcode)); + break; + } + + /* Finishing touches */ + if (fpi->SaturateMode == SATURATE_ZERO_ONE) { + fp->inst[counter].inst0 |= R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP; + } + + counter++; + + if (fp->error) + return GL_FALSE; + + } + + /* Finish him! (If it's an ALU/OUT instruction...) */ + if ((fp->inst[counter-1].inst0 & 0x3) == 1) { + fp->inst[counter-1].inst0 |= R500_INST_LAST; + } else { + /* We still need to put an output inst, right? */ + WARN_ONCE("Final FP instruction is not an OUT.\n"); + } + + fp->cs->nrslots = counter; + + fp->max_temp_idx++; + + return GL_TRUE; +} + +static void init_program(r300ContextPtr r300, struct r500_fragment_program *fp) +{ + struct r300_pfs_compile_state *cs = NULL; + struct gl_fragment_program *mp = &fp->mesa_program; + struct prog_instruction *fpi; + GLuint InputsRead = mp->Base.InputsRead; + GLuint temps_used = 0; + int i, j; + + /* New compile, reset tracking data */ + fp->optimization = + driQueryOptioni(&r300->radeon.optionCache, "fp_optimization"); + fp->translated = GL_FALSE; + fp->error = GL_FALSE; + fp->cs = cs = &(R300_CONTEXT(fp->ctx)->state.pfs_compile); + fp->const_nr = 0; + /* Size of pixel stack, plus 1. */ + fp->max_temp_idx = 1; + /* Temp register offset. */ + fp->temp_reg_offset = 0; + /* Whether or not we perform any depth writing. */ + fp->writes_depth = GL_FALSE; + + _mesa_memset(cs, 0, sizeof(*fp->cs)); + for (i = 0; i < PFS_MAX_ALU_INST; i++) { + for (j = 0; j < 3; j++) { + cs->slot[i].vsrc[j] = SRC_CONST; + cs->slot[i].ssrc[j] = SRC_CONST; + } + } + + /* Work out what temps the Mesa inputs correspond to, this must match + * what setup_rs_unit does, which shouldn't be a problem as rs_unit + * configures itself based on the fragprog's InputsRead + * + * NOTE: this depends on get_hw_temp() allocating registers in order, + * starting from register 0, so we're just going to do that instead. + */ + + /* Texcoords come first */ + for (i = 0; i < fp->ctx->Const.MaxTextureUnits; i++) { + if (InputsRead & (FRAG_BIT_TEX0 << i)) { + cs->inputs[FRAG_ATTRIB_TEX0 + i].refcount = 0; + cs->inputs[FRAG_ATTRIB_TEX0 + i].reg = + fp->temp_reg_offset; + fp->temp_reg_offset++; + } + } + InputsRead &= ~FRAG_BITS_TEX_ANY; + + /* fragment position treated as a texcoord */ + if (InputsRead & FRAG_BIT_WPOS) { + cs->inputs[FRAG_ATTRIB_WPOS].refcount = 0; + cs->inputs[FRAG_ATTRIB_WPOS].reg = + fp->temp_reg_offset; + fp->temp_reg_offset++; + } + InputsRead &= ~FRAG_BIT_WPOS; + + /* Then primary colour */ + if (InputsRead & FRAG_BIT_COL0) { + cs->inputs[FRAG_ATTRIB_COL0].refcount = 0; + cs->inputs[FRAG_ATTRIB_COL0].reg = + fp->temp_reg_offset; + fp->temp_reg_offset++; + } + InputsRead &= ~FRAG_BIT_COL0; + + /* Secondary color */ + if (InputsRead & FRAG_BIT_COL1) { + cs->inputs[FRAG_ATTRIB_COL1].refcount = 0; + cs->inputs[FRAG_ATTRIB_COL1].reg = + fp->temp_reg_offset; + fp->temp_reg_offset++; + } + InputsRead &= ~FRAG_BIT_COL1; + + /* Anything else */ + if (InputsRead) { + WARN_ONCE("Don't know how to handle inputs 0x%x\n", InputsRead); + /* force read from hwreg 0 for now */ + for (i = 0; i < 32; i++) + if (InputsRead & (1 << i)) + cs->inputs[i].reg = 0; + } + + if (!mp->Base.Instructions) { + ERROR("No instructions found in program, going to go die now.\n"); + return; + } + + for (fpi = mp->Base.Instructions; fpi->Opcode != OPCODE_END; fpi++) { + for (i = 0; i < 3; i++) { + if (fpi->SrcReg[i].File == PROGRAM_TEMPORARY) { + if (fpi->SrcReg[i].Index >= temps_used) + temps_used = fpi->SrcReg[i].Index + 1; + } + } + } + + cs->temp_in_use = temps_used + 1; + + fp->max_temp_idx = fp->temp_reg_offset + cs->temp_in_use; + + if (RADEON_DEBUG & DEBUG_PIXEL) + fprintf(stderr, "FP temp indices: fp->max_temp_idx: %d cs->temp_in_use: %d\n", fp->max_temp_idx, cs->temp_in_use); +} + +static void update_params(struct r500_fragment_program *fp) +{ + struct gl_fragment_program *mp = &fp->mesa_program; + + /* Ask Mesa nicely to fill in ParameterValues for us */ + if (mp->Base.Parameters) + _mesa_load_state_parameters(fp->ctx, mp->Base.Parameters); +} + +static void dumb_shader(struct r500_fragment_program *fp) +{ + fp->inst[0].inst0 = R500_INST_TYPE_TEX + | R500_INST_TEX_SEM_WAIT + | R500_INST_RGB_WMASK_R + | R500_INST_RGB_WMASK_G + | R500_INST_RGB_WMASK_B + | R500_INST_ALPHA_WMASK + | R500_INST_RGB_CLAMP + | R500_INST_ALPHA_CLAMP; + fp->inst[0].inst1 = R500_TEX_ID(0) + | R500_TEX_INST_LD + | R500_TEX_SEM_ACQUIRE + | R500_TEX_IGNORE_UNCOVERED; + fp->inst[0].inst2 = R500_TEX_SRC_ADDR(0) + | R500_TEX_SRC_S_SWIZ_R + | R500_TEX_SRC_T_SWIZ_G + | R500_TEX_DST_ADDR(0) + | R500_TEX_DST_R_SWIZ_R + | R500_TEX_DST_G_SWIZ_G + | R500_TEX_DST_B_SWIZ_B + | R500_TEX_DST_A_SWIZ_A; + fp->inst[0].inst3 = R500_DX_ADDR(0) + | R500_DX_S_SWIZ_R + | R500_DX_T_SWIZ_R + | R500_DX_R_SWIZ_R + | R500_DX_Q_SWIZ_R + | R500_DY_ADDR(0) + | R500_DY_S_SWIZ_R + | R500_DY_T_SWIZ_R + | R500_DY_R_SWIZ_R + | R500_DY_Q_SWIZ_R; + fp->inst[0].inst4 = 0x0; + fp->inst[0].inst5 = 0x0; + + fp->inst[1].inst0 = R500_INST_TYPE_OUT | + R500_INST_TEX_SEM_WAIT | + R500_INST_LAST | + R500_INST_RGB_OMASK_R | + R500_INST_RGB_OMASK_G | + R500_INST_RGB_OMASK_B | + R500_INST_ALPHA_OMASK; + fp->inst[1].inst1 = R500_RGB_ADDR0(0) | + R500_RGB_ADDR1(0) | + R500_RGB_ADDR1_CONST | + R500_RGB_ADDR2(0) | + R500_RGB_ADDR2_CONST | + R500_RGB_SRCP_OP_1_MINUS_2RGB0; + fp->inst[1].inst2 = R500_ALPHA_ADDR0(0) | + R500_ALPHA_ADDR1(0) | + R500_ALPHA_ADDR1_CONST | + R500_ALPHA_ADDR2(0) | + R500_ALPHA_ADDR2_CONST | + R500_ALPHA_SRCP_OP_1_MINUS_2A0; + fp->inst[1].inst3 = R500_ALU_RGB_SEL_A_SRC0 | + R500_ALU_RGB_R_SWIZ_A_R | + R500_ALU_RGB_G_SWIZ_A_G | + R500_ALU_RGB_B_SWIZ_A_B | + R500_ALU_RGB_SEL_B_SRC0 | + R500_ALU_RGB_R_SWIZ_B_1 | + R500_ALU_RGB_B_SWIZ_B_1 | + R500_ALU_RGB_G_SWIZ_B_1; + fp->inst[1].inst4 = R500_ALPHA_OP_MAD | + R500_ALPHA_SWIZ_A_A | + R500_ALPHA_SWIZ_B_1; + fp->inst[1].inst5 = R500_ALU_RGBA_OP_MAD | + R500_ALU_RGBA_R_SWIZ_0 | + R500_ALU_RGBA_G_SWIZ_0 | + R500_ALU_RGBA_B_SWIZ_0 | + R500_ALU_RGBA_A_SWIZ_0; + + fp->cs->nrslots = 2; + fp->translated = GL_TRUE; +} + +void r500TranslateFragmentShader(r300ContextPtr r300, + struct r500_fragment_program *fp) +{ + + struct r300_pfs_compile_state *cs = NULL; + + if (!fp->translated) { + + init_program(r300, fp); + cs = fp->cs; + + if (parse_program(fp) == GL_FALSE) { + ERROR("Huh. Couldn't parse program. There should be additional errors explaining why.\nUsing dumb shader...\n"); + dumb_shader(fp); + fp->inst_offset = 0; + fp->inst_end = cs->nrslots - 1; + return; + } + fp->inst_offset = 0; + fp->inst_end = cs->nrslots - 1; + + fp->translated = GL_TRUE; + if (RADEON_DEBUG & DEBUG_PIXEL) { + fprintf(stderr, "Mesa program:\n"); + fprintf(stderr, "-------------\n"); + _mesa_print_program(&fp->mesa_program.Base); + fflush(stdout); + dump_program(fp); + } + + + r300UpdateStateParameters(fp->ctx, _NEW_PROGRAM); + } + + update_params(fp); + +} + +static char *toswiz(int swiz_val) { + switch(swiz_val) { + case 0: return "R"; + case 1: return "G"; + case 2: return "B"; + case 3: return "A"; + case 4: return "0"; + case 5: return "1/2"; + case 6: return "1"; + case 7: return "U"; + } + return NULL; +} + +static char *toop(int op_val) +{ + char *str = NULL; + switch (op_val) { + case 0: str = "MAD"; break; + case 1: str = "DP3"; break; + case 2: str = "DP4"; break; + case 3: str = "D2A"; break; + case 4: str = "MIN"; break; + case 5: str = "MAX"; break; + case 6: str = "Reserved"; break; + case 7: str = "CND"; break; + case 8: str = "CMP"; break; + case 9: str = "FRC"; break; + case 10: str = "SOP"; break; + case 11: str = "MDH"; break; + case 12: str = "MDV"; break; + } + return str; +} + +static char *to_alpha_op(int op_val) +{ + char *str = NULL; + switch (op_val) { + case 0: str = "MAD"; break; + case 1: str = "DP"; break; + case 2: str = "MIN"; break; + case 3: str = "MAX"; break; + case 4: str = "Reserved"; break; + case 5: str = "CND"; break; + case 6: str = "CMP"; break; + case 7: str = "FRC"; break; + case 8: str = "EX2"; break; + case 9: str = "LN2"; break; + case 10: str = "RCP"; break; + case 11: str = "RSQ"; break; + case 12: str = "SIN"; break; + case 13: str = "COS"; break; + case 14: str = "MDH"; break; + case 15: str = "MDV"; break; + } + return str; +} + +static char *to_mask(int val) +{ + char *str = NULL; + switch(val) { + case 0: str = "NONE"; break; + case 1: str = "R"; break; + case 2: str = "G"; break; + case 3: str = "RG"; break; + case 4: str = "B"; break; + case 5: str = "RB"; break; + case 6: str = "GB"; break; + case 7: str = "RGB"; break; + case 8: str = "A"; break; + case 9: str = "AR"; break; + case 10: str = "AG"; break; + case 11: str = "ARG"; break; + case 12: str = "AB"; break; + case 13: str = "ARB"; break; + case 14: str = "AGB"; break; + case 15: str = "ARGB"; break; + } + return str; +} + +static char *to_texop(int val) +{ + switch(val) { + case 0: return "NOP"; + case 1: return "LD"; + case 2: return "TEXKILL"; + case 3: return "PROJ"; + case 4: return "LODBIAS"; + case 5: return "LOD"; + case 6: return "DXDY"; + } + return NULL; +} + +static void dump_program(struct r500_fragment_program *fp) +{ + + fprintf(stderr, "R500 Fragment Program:\n--------\n"); + + int n; + uint32_t inst; + uint32_t inst0; + char *str = NULL; + + if (fp->const_nr) { + fprintf(stderr, "--------\nConstants:\n"); + for (n = 0; n < fp->const_nr; n++) { + fprintf(stderr, "Constant %d: %f %f\n\t %f %f\n", n, + fp->constant[n][0], fp->constant[n][1], fp->constant[n][2], + fp->constant[n][3]); + } + fprintf(stderr, "--------\n"); + } + + for (n = 0; n < fp->inst_end+1; n++) { + inst0 = inst = fp->inst[n].inst0; + fprintf(stderr,"%d\t0:CMN_INST 0x%08x:", n, inst); + switch(inst & 0x3) { + case R500_INST_TYPE_ALU: str = "ALU"; break; + case R500_INST_TYPE_OUT: str = "OUT"; break; + case R500_INST_TYPE_FC: str = "FC"; break; + case R500_INST_TYPE_TEX: str = "TEX"; break; + }; + fprintf(stderr,"%s %s %s %s %s ", str, + inst & R500_INST_TEX_SEM_WAIT ? "TEX_WAIT" : "", + inst & R500_INST_LAST ? "LAST" : "", + inst & R500_INST_NOP ? "NOP" : "", + inst & R500_INST_ALU_WAIT ? "ALU WAIT" : ""); + fprintf(stderr,"wmask: %s omask: %s\n", to_mask((inst >> 11) & 0xf), + to_mask((inst >> 15) & 0xf)); + + switch(inst0 & 0x3) { + case 0: + case 1: + fprintf(stderr,"\t1:RGB_ADDR 0x%08x:", fp->inst[n].inst1); + inst = fp->inst[n].inst1; + + fprintf(stderr,"Addr0: %d%c, Addr1: %d%c, Addr2: %d%c, srcp:%d\n", + inst & 0xff, (inst & (1<<8)) ? 'c' : 't', + (inst >> 10) & 0xff, (inst & (1<<18)) ? 'c' : 't', + (inst >> 20) & 0xff, (inst & (1<<28)) ? 'c' : 't', + (inst >> 30)); + + fprintf(stderr,"\t2:ALPHA_ADDR 0x%08x:", fp->inst[n].inst2); + inst = fp->inst[n].inst2; + fprintf(stderr,"Addr0: %d%c, Addr1: %d%c, Addr2: %d%c, srcp:%d\n", + inst & 0xff, (inst & (1<<8)) ? 'c' : 't', + (inst >> 10) & 0xff, (inst & (1<<18)) ? 'c' : 't', + (inst >> 20) & 0xff, (inst & (1<<28)) ? 'c' : 't', + (inst >> 30)); + fprintf(stderr,"\t3 RGB_INST: 0x%08x:", fp->inst[n].inst3); + inst = fp->inst[n].inst3; + fprintf(stderr,"rgb_A_src:%d %s/%s/%s %d rgb_B_src:%d %s/%s/%s %d\n", + (inst) & 0x3, toswiz((inst >> 2) & 0x7), toswiz((inst >> 5) & 0x7), toswiz((inst >> 8) & 0x7), + (inst >> 11) & 0x3, + (inst >> 13) & 0x3, toswiz((inst >> 15) & 0x7), toswiz((inst >> 18) & 0x7), toswiz((inst >> 21) & 0x7), + (inst >> 24) & 0x3); + + + fprintf(stderr,"\t4 ALPHA_INST:0x%08x:", fp->inst[n].inst4); + inst = fp->inst[n].inst4; + fprintf(stderr,"%s dest:%d%s alp_A_src:%d %s %d alp_B_src:%d %s %d w:%d\n", to_alpha_op(inst & 0xf), + (inst >> 4) & 0x7f, inst & (1<<11) ? "(rel)":"", + (inst >> 12) & 0x3, toswiz((inst >> 14) & 0x7), (inst >> 17) & 0x3, + (inst >> 19) & 0x3, toswiz((inst >> 21) & 0x7), (inst >> 24) & 0x3, + (inst >> 31) & 0x1); + + fprintf(stderr,"\t5 RGBA_INST: 0x%08x:", fp->inst[n].inst5); + inst = fp->inst[n].inst5; + fprintf(stderr,"%s dest:%d%s rgb_C_src:%d %s/%s/%s %d alp_C_src:%d %s %d\n", toop(inst & 0xf), + (inst >> 4) & 0x7f, inst & (1<<11) ? "(rel)":"", + (inst >> 12) & 0x3, toswiz((inst >> 14) & 0x7), toswiz((inst >> 17) & 0x7), toswiz((inst >> 20) & 0x7), + (inst >> 23) & 0x3, + (inst >> 25) & 0x3, toswiz((inst >> 27) & 0x7), (inst >> 30) & 0x3); + break; + case 2: + break; + case 3: + inst = fp->inst[n].inst1; + fprintf(stderr,"\t1:TEX_INST: 0x%08x: id: %d op:%s, %s, %s %s\n", inst, (inst >> 16) & 0xf, + to_texop((inst >> 22) & 0x7), (inst & (1<<25)) ? "ACQ" : "", + (inst & (1<<26)) ? "IGNUNC" : "", (inst & (1<<27)) ? "UNSCALED" : "SCALED"); + inst = fp->inst[n].inst2; + fprintf(stderr,"\t2:TEX_ADDR: 0x%08x: src: %d%s %s/%s/%s/%s dst: %d%s %s/%s/%s/%s\n", inst, + inst & 127, inst & (1<<7) ? "(rel)" : "", + toswiz((inst >> 8) & 0x3), toswiz((inst >> 10) & 0x3), + toswiz((inst >> 12) & 0x3), toswiz((inst >> 14) & 0x3), + (inst >> 16) & 127, inst & (1<<23) ? "(rel)" : "", + toswiz((inst >> 24) & 0x3), toswiz((inst >> 26) & 0x3), + toswiz((inst >> 28) & 0x3), toswiz((inst >> 30) & 0x3)); + + fprintf(stderr,"\t3:TEX_DXDY: 0x%08x\n", fp->inst[n].inst3); + break; + } + fprintf(stderr,"\n"); + } + +} diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h new file mode 100644 index 00000000000..5dd2def1c40 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2005 Ben Skeggs. + * + * 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 (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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: + * Ben Skeggs <[email protected]> + * Jerome Glisse <[email protected]> + */ +#ifndef __R500_FRAGPROG_H_ +#define __R500_FRAGPROG_H_ + +#include "glheader.h" +#include "macros.h" +#include "enums.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" + +#include "r300_context.h" + +/* supported hw opcodes */ +#define PFS_OP_MAD 0 +#define PFS_OP_DP3 1 +#define PFS_OP_DP4 2 +#define PFS_OP_MIN 3 +#define PFS_OP_MAX 4 +#define PFS_OP_CMP 5 +#define PFS_OP_FRC 6 +#define PFS_OP_EX2 7 +#define PFS_OP_LG2 8 +#define PFS_OP_RCP 9 +#define PFS_OP_RSQ 10 +#define PFS_OP_REPL_ALPHA 11 +#define PFS_OP_CMPH 12 +#define MAX_PFS_OP 12 + +#define PFS_FLAG_SAT (1 << 0) +#define PFS_FLAG_ABS (1 << 1) + +#define ARG_NEG (1 << 5) +#define ARG_ABS (1 << 6) +#define ARG_MASK (127 << 0) +#define ARG_STRIDE 7 +#define SRC_CONST (1 << 5) +#define SRC_MASK (63 << 0) +#define SRC_STRIDE 6 + +#define DRI_CONF_FP_OPTIMIZATION_SPEED 0 +#define DRI_CONF_FP_OPTIMIZATION_QUALITY 1 + +struct r500_fragment_program; + +extern void r500TranslateFragmentShader(r300ContextPtr r300, + struct r500_fragment_program *fp); + +#endif diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 9c0a5868b5f..3fc724a5531 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -135,6 +135,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, /* Fill in additional standard functions. */ radeonInitDriverFuncs(functions); + radeon->radeonScreen = screen; /* Allocate and initialize the Mesa context */ if (sharedContextPrivate) shareCtx = ((radeonContextPtr)sharedContextPrivate)->glCtx; @@ -158,7 +159,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->dri.fd = sPriv->fd; radeon->dri.drmMinor = sPriv->drm_version.minor; - radeon->radeonScreen = screen; radeon->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA + screen->sarea_priv_offset); diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c index 31a000d5e66..0c1a19507b2 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.c +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c @@ -215,16 +215,18 @@ void radeonCopyBuffer(__DRIdrawablePrivate * dPriv, if (rect->y2 < b->y2) b->y2 = rect->y2; - if (b->x1 < b->x2 && b->y1 < b->y2) - b++; + if (b->x1 >= b->x2 || b->y1 >= b->y2) + continue; } - else - b++; + b++; n++; } radeon->sarea->nbox = n; + if (!n) + continue; + ret = drmCommandNone(radeon->dri.fd, DRM_RADEON_SWAP); if (ret) { diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h index 6ad441bdd04..2821ecc0c08 100644 --- a/src/mesa/drivers/dri/radeon/radeon_chipset.h +++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h @@ -146,10 +146,112 @@ #define PCI_CHIP_RV410_5E4C 0x5E4C #define PCI_CHIP_RV410_5E4D 0x5E4D #define PCI_CHIP_RV410_5E4F 0x5E4F + +#define PCI_CHIP_R520_7100 0x7100 +#define PCI_CHIP_R520_7101 0x7101 +#define PCI_CHIP_R520_7102 0x7102 +#define PCI_CHIP_R520_7103 0x7103 +#define PCI_CHIP_R520_7104 0x7104 +#define PCI_CHIP_R520_7105 0x7105 +#define PCI_CHIP_R520_7106 0x7106 +#define PCI_CHIP_R520_7108 0x7108 +#define PCI_CHIP_R520_7109 0x7109 +#define PCI_CHIP_R520_710A 0x710A +#define PCI_CHIP_R520_710B 0x710B +#define PCI_CHIP_R520_710C 0x710C +#define PCI_CHIP_R520_710E 0x710E +#define PCI_CHIP_R520_710F 0x710F +#define PCI_CHIP_RV515_7140 0x7140 +#define PCI_CHIP_RV515_7141 0x7141 +#define PCI_CHIP_RV515_7142 0x7142 +#define PCI_CHIP_RV515_7143 0x7143 +#define PCI_CHIP_RV515_7144 0x7144 +#define PCI_CHIP_RV515_7145 0x7145 +#define PCI_CHIP_RV515_7146 0x7146 +#define PCI_CHIP_RV515_7147 0x7147 +#define PCI_CHIP_RV515_7149 0x7149 +#define PCI_CHIP_RV515_714A 0x714A +#define PCI_CHIP_RV515_714B 0x714B +#define PCI_CHIP_RV515_714C 0x714C +#define PCI_CHIP_RV515_714D 0x714D +#define PCI_CHIP_RV515_714E 0x714E +#define PCI_CHIP_RV515_714F 0x714F +#define PCI_CHIP_RV515_7151 0x7151 +#define PCI_CHIP_RV515_7152 0x7152 +#define PCI_CHIP_RV515_7153 0x7153 +#define PCI_CHIP_RV515_715E 0x715E +#define PCI_CHIP_RV515_715F 0x715F +#define PCI_CHIP_RV515_7180 0x7180 +#define PCI_CHIP_RV515_7181 0x7181 +#define PCI_CHIP_RV515_7183 0x7183 +#define PCI_CHIP_RV515_7186 0x7186 +#define PCI_CHIP_RV515_7187 0x7187 +#define PCI_CHIP_RV515_7188 0x7188 +#define PCI_CHIP_RV515_718A 0x718A +#define PCI_CHIP_RV515_718B 0x718B +#define PCI_CHIP_RV515_718C 0x718C +#define PCI_CHIP_RV515_718D 0x718D +#define PCI_CHIP_RV515_718F 0x718F +#define PCI_CHIP_RV515_7193 0x7193 +#define PCI_CHIP_RV515_7196 0x7196 +#define PCI_CHIP_RV515_719B 0x719B +#define PCI_CHIP_RV515_719F 0x719F +#define PCI_CHIP_RV530_71C0 0x71C0 +#define PCI_CHIP_RV530_71C1 0x71C1 +#define PCI_CHIP_RV530_71C2 0x71C2 +#define PCI_CHIP_RV530_71C3 0x71C3 +#define PCI_CHIP_RV530_71C4 0x71C4 +#define PCI_CHIP_RV530_71C5 0x71C5 +#define PCI_CHIP_RV530_71C6 0x71C6 +#define PCI_CHIP_RV530_71C7 0x71C7 +#define PCI_CHIP_RV530_71CD 0x71CD +#define PCI_CHIP_RV530_71CE 0x71CE +#define PCI_CHIP_RV530_71D2 0x71D2 +#define PCI_CHIP_RV530_71D4 0x71D4 +#define PCI_CHIP_RV530_71D5 0x71D5 +#define PCI_CHIP_RV530_71D6 0x71D6 +#define PCI_CHIP_RV530_71DA 0x71DA +#define PCI_CHIP_RV530_71DE 0x71DE +#define PCI_CHIP_RV515_7200 0x7200 +#define PCI_CHIP_RV515_7210 0x7210 +#define PCI_CHIP_RV515_7211 0x7211 +#define PCI_CHIP_R580_7240 0x7240 +#define PCI_CHIP_R580_7243 0x7243 +#define PCI_CHIP_R580_7244 0x7244 +#define PCI_CHIP_R580_7245 0x7245 +#define PCI_CHIP_R580_7246 0x7246 +#define PCI_CHIP_R580_7247 0x7247 +#define PCI_CHIP_R580_7248 0x7248 +#define PCI_CHIP_R580_7249 0x7249 +#define PCI_CHIP_R580_724A 0x724A +#define PCI_CHIP_R580_724B 0x724B +#define PCI_CHIP_R580_724C 0x724C +#define PCI_CHIP_R580_724D 0x724D +#define PCI_CHIP_R580_724E 0x724E +#define PCI_CHIP_R580_724F 0x724F +#define PCI_CHIP_RV570_7280 0x7280 +#define PCI_CHIP_RV560_7281 0x7281 +#define PCI_CHIP_RV560_7283 0x7283 +#define PCI_CHIP_R580_7284 0x7284 +#define PCI_CHIP_RV560_7287 0x7287 +#define PCI_CHIP_RV570_7288 0x7288 +#define PCI_CHIP_RV570_7289 0x7289 +#define PCI_CHIP_RV570_728B 0x728B +#define PCI_CHIP_RV570_728C 0x728C +#define PCI_CHIP_RV560_7290 0x7290 +#define PCI_CHIP_RV560_7291 0x7291 +#define PCI_CHIP_RV560_7293 0x7293 +#define PCI_CHIP_RV560_7297 0x7297 + #define PCI_CHIP_RS350_7834 0x7834 #define PCI_CHIP_RS350_7835 0x7835 #define PCI_CHIP_RS690_791E 0x791E #define PCI_CHIP_RS690_791F 0x791F +#define PCI_CHIP_RS740_796C 0x796C +#define PCI_CHIP_RS740_796D 0x796D +#define PCI_CHIP_RS740_796E 0x796E +#define PCI_CHIP_RS740_796F 0x796F + enum { CHIP_FAMILY_R100, @@ -169,6 +271,13 @@ enum { CHIP_FAMILY_RV410, CHIP_FAMILY_RS400, CHIP_FAMILY_RS690, + CHIP_FAMILY_RS740, + CHIP_FAMILY_RV515, + CHIP_FAMILY_R520, + CHIP_FAMILY_RV530, + CHIP_FAMILY_R580, + CHIP_FAMILY_RV560, + CHIP_FAMILY_RV570, CHIP_FAMILY_LAST }; diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 078ac9a29a2..446025b6312 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -919,16 +919,18 @@ void radeonCopyBuffer( __DRIdrawablePrivate *dPriv, if (rect->y2 < b->y2) b->y2 = rect->y2; - if (b->x1 < b->x2 && b->y1 < b->y2) - b++; + if (b->x1 >= b->x2 || b->y1 >= b->y2) + continue; } - else - b++; + b++; n++; } rmesa->sarea->nbox = n; + if (!n) + continue; + ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP ); if ( ret ) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 6107577e408..08568a407ed 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -188,7 +188,7 @@ DRI_CONF_BEGIN 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 @@ -649,13 +649,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->chip_flags = RADEON_CHIPSET_TCL; break; - /* RV410 SE chips have half the pipes of regular RV410 */ case PCI_CHIP_RV410_5E4C: case PCI_CHIP_RV410_5E4F: - screen->chip_family = CHIP_FAMILY_RV380; - screen->chip_flags = RADEON_CHIPSET_TCL; - break; - case PCI_CHIP_RV410_564A: case PCI_CHIP_RV410_564B: case PCI_CHIP_RV410_564F: @@ -678,12 +673,132 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) case PCI_CHIP_RC410_5A61: case PCI_CHIP_RC410_5A62: screen->chip_family = CHIP_FAMILY_RS400; - fprintf(stderr, "Warning, xpress200 detected.\n"); break; case PCI_CHIP_RS690_791E: + case PCI_CHIP_RS690_791F: screen->chip_family = CHIP_FAMILY_RS690; - fprintf(stderr, "Warning, RS690 detected, 3D support is incomplete.\n"); + break; + case PCI_CHIP_RS740_796C: + case PCI_CHIP_RS740_796D: + case PCI_CHIP_RS740_796E: + case PCI_CHIP_RS740_796F: + screen->chip_family = CHIP_FAMILY_RS740; + break; + + case PCI_CHIP_R520_7100: + case PCI_CHIP_R520_7101: + case PCI_CHIP_R520_7102: + case PCI_CHIP_R520_7103: + case PCI_CHIP_R520_7104: + case PCI_CHIP_R520_7105: + case PCI_CHIP_R520_7106: + case PCI_CHIP_R520_7108: + case PCI_CHIP_R520_7109: + case PCI_CHIP_R520_710A: + case PCI_CHIP_R520_710B: + case PCI_CHIP_R520_710C: + case PCI_CHIP_R520_710E: + case PCI_CHIP_R520_710F: + screen->chip_family = CHIP_FAMILY_R520; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_RV515_7140: + case PCI_CHIP_RV515_7141: + case PCI_CHIP_RV515_7142: + case PCI_CHIP_RV515_7143: + case PCI_CHIP_RV515_7144: + case PCI_CHIP_RV515_7145: + case PCI_CHIP_RV515_7146: + case PCI_CHIP_RV515_7147: + case PCI_CHIP_RV515_7149: + case PCI_CHIP_RV515_714A: + case PCI_CHIP_RV515_714B: + case PCI_CHIP_RV515_714C: + case PCI_CHIP_RV515_714D: + case PCI_CHIP_RV515_714E: + case PCI_CHIP_RV515_714F: + case PCI_CHIP_RV515_7151: + case PCI_CHIP_RV515_7152: + case PCI_CHIP_RV515_7153: + case PCI_CHIP_RV515_715E: + case PCI_CHIP_RV515_715F: + case PCI_CHIP_RV515_7180: + case PCI_CHIP_RV515_7181: + case PCI_CHIP_RV515_7183: + case PCI_CHIP_RV515_7186: + case PCI_CHIP_RV515_7187: + case PCI_CHIP_RV515_7188: + case PCI_CHIP_RV515_718A: + case PCI_CHIP_RV515_718B: + case PCI_CHIP_RV515_718C: + case PCI_CHIP_RV515_718D: + case PCI_CHIP_RV515_718F: + case PCI_CHIP_RV515_7193: + case PCI_CHIP_RV515_7196: + case PCI_CHIP_RV515_719B: + case PCI_CHIP_RV515_719F: + case PCI_CHIP_RV515_7200: + case PCI_CHIP_RV515_7210: + case PCI_CHIP_RV515_7211: + screen->chip_family = CHIP_FAMILY_RV515; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_RV530_71C0: + case PCI_CHIP_RV530_71C1: + case PCI_CHIP_RV530_71C2: + case PCI_CHIP_RV530_71C3: + case PCI_CHIP_RV530_71C4: + case PCI_CHIP_RV530_71C5: + case PCI_CHIP_RV530_71C6: + case PCI_CHIP_RV530_71C7: + case PCI_CHIP_RV530_71CD: + case PCI_CHIP_RV530_71CE: + case PCI_CHIP_RV530_71D2: + case PCI_CHIP_RV530_71D4: + case PCI_CHIP_RV530_71D5: + case PCI_CHIP_RV530_71D6: + case PCI_CHIP_RV530_71DA: + case PCI_CHIP_RV530_71DE: + screen->chip_family = CHIP_FAMILY_RV530; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_R580_7240: + case PCI_CHIP_R580_7243: + case PCI_CHIP_R580_7244: + case PCI_CHIP_R580_7245: + case PCI_CHIP_R580_7246: + case PCI_CHIP_R580_7247: + case PCI_CHIP_R580_7248: + case PCI_CHIP_R580_7249: + case PCI_CHIP_R580_724A: + case PCI_CHIP_R580_724B: + case PCI_CHIP_R580_724C: + case PCI_CHIP_R580_724D: + case PCI_CHIP_R580_724E: + case PCI_CHIP_R580_724F: + case PCI_CHIP_R580_7284: + screen->chip_family = CHIP_FAMILY_R580; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + + case PCI_CHIP_RV570_7280: + case PCI_CHIP_RV560_7281: + case PCI_CHIP_RV560_7283: + case PCI_CHIP_RV560_7287: + case PCI_CHIP_RV570_7288: + case PCI_CHIP_RV570_7289: + case PCI_CHIP_RV570_728B: + case PCI_CHIP_RV570_728C: + case PCI_CHIP_RV560_7290: + case PCI_CHIP_RV560_7291: + case PCI_CHIP_RV560_7293: + case PCI_CHIP_RV560_7297: + screen->chip_family = CHIP_FAMILY_RV560; + screen->chip_flags = RADEON_CHIPSET_TCL; break; default: @@ -697,6 +812,14 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } + if ((sPriv->drm_version.minor < 29) && (screen->chip_family >= CHIP_FAMILY_RV515)) { + fprintf(stderr, "R500 support requires a newer drm.\n"); + return NULL; + } + + if (getenv("R300_NO_TCL")) + screen->chip_flags &= ~RADEON_CHIPSET_TCL; + if (screen->chip_family <= CHIP_FAMILY_RS200) screen->chip_flags |= RADEON_CLASS_R100; else if (screen->chip_family <= CHIP_FAMILY_RV280) @@ -721,6 +844,36 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->fbLocation = (temp & 0xffff) << 16; } + if (screen->chip_family >= CHIP_FAMILY_RV515) { + ret = radeonGetParam( sPriv->fd, RADEON_PARAM_NUM_GB_PIPES, + &temp); + if (ret) { + fprintf(stderr, "Unable to get num_pipes, need newer drm\n"); + switch (screen->chip_family) { + case CHIP_FAMILY_R300: + case CHIP_FAMILY_R350: + screen->num_gb_pipes = 2; + break; + case CHIP_FAMILY_R420: + case CHIP_FAMILY_R520: + case CHIP_FAMILY_R580: + case CHIP_FAMILY_RV560: + case CHIP_FAMILY_RV570: + screen->num_gb_pipes = 4; + break; + case CHIP_FAMILY_RV350: + case CHIP_FAMILY_RV515: + case CHIP_FAMILY_RV530: + case CHIP_FAMILY_RV410: + default: + screen->num_gb_pipes = 1; + break; + } + } else { + screen->num_gb_pipes = temp; + } + } + if ( sPriv->drm_version.minor >= 10 ) { drm_radeon_setparam_t sp; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 184b0d225ef..ab859d55bd8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -105,6 +105,8 @@ typedef struct { driOptionCache optionCache; const __DRIextension *extensions[8]; + + int num_gb_pipes; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/swrast/Makefile b/src/mesa/drivers/dri/swrast/Makefile new file mode 100644 index 00000000000..5f3a4f2191b --- /dev/null +++ b/src/mesa/drivers/dri/swrast/Makefile @@ -0,0 +1,24 @@ +# src/mesa/drivers/dri/swrast/Makefile + +TOP = ../../../../.. +include $(TOP)/configs/current + +LIBNAME = swrast_dri.so + +DRIVER_SOURCES = \ + swrast.c \ + swrast_span.c + +C_SOURCES = \ + $(SWRAST_COMMON_SOURCES) \ + $(DRIVER_SOURCES) + +ASM_SOURCES = + +SWRAST_COMMON_SOURCES = \ + ../../common/driverfuncs.c \ + ../common/utils.c + +include ../Makefile.template + +symlinks: diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c new file mode 100644 index 00000000000..c4dba591987 --- /dev/null +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -0,0 +1,727 @@ +/* + * Copyright (C) 2008 George Sapountzis <[email protected]> + * + * 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. + */ + +/* + * DRI software rasterizer + * + * This is the mesa swrast module packaged into a DRI driver structure. + * + * The front-buffer is allocated by the loader. The loader provides read/write + * callbacks for access to the front-buffer. The driver uses a scratch row for + * front-buffer rendering to avoid repeated calls to the loader. + * + * The back-buffer is allocated by the driver and is private. + */ + +#include "context.h" +#include "extensions.h" +#include "framebuffer.h" +#include "imports.h" +#include "renderbuffer.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "tnl/tnl.h" +#include "tnl/t_context.h" +#include "tnl/t_pipeline.h" +#include "vbo/vbo.h" +#include "drivers/common/driverfuncs.h" + +#include "swrast_priv.h" + + +#define need_GL_VERSION_1_3 +#define need_GL_VERSION_1_4 +#define need_GL_VERSION_1_5 +#define need_GL_VERSION_2_0 + +/* sw extensions for imaging */ +#define need_GL_EXT_blend_color +#define need_GL_EXT_blend_minmax +#define need_GL_EXT_convolution +#define need_GL_EXT_histogram +#define need_GL_SGI_color_table + +/* sw extensions not associated with some GL version */ +#define need_GL_ARB_shader_objects +#define need_GL_ARB_vertex_program +#define need_GL_APPLE_vertex_array_object +#define need_GL_ATI_fragment_shader +#define need_GL_EXT_depth_bounds_test +#define need_GL_EXT_framebuffer_object +#define need_GL_EXT_framebuffer_blit +#define need_GL_EXT_gpu_program_parameters +#define need_GL_EXT_paletted_texture +#define need_GL_IBM_multimode_draw_arrays +#define need_GL_MESA_resize_buffers +#define need_GL_NV_vertex_program +#define need_GL_NV_fragment_program + +#include "extension_helper.h" +#include "utils.h" + +const struct dri_extension card_extensions[] = +{ + { "GL_VERSION_1_3", GL_VERSION_1_3_functions }, + { "GL_VERSION_1_4", GL_VERSION_1_4_functions }, + { "GL_VERSION_1_5", GL_VERSION_1_5_functions }, + { "GL_VERSION_2_0", GL_VERSION_2_0_functions }, + + { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, + { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, + { "GL_EXT_convolution", GL_EXT_convolution_functions }, + { "GL_EXT_histogram", GL_EXT_histogram_functions }, + { "GL_SGI_color_table", GL_SGI_color_table_functions }, + + { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, + { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, + { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, + { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions }, + { "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions }, + { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, + { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, + { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, + { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, + { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, + { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, + { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, + { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, + { NULL, NULL } +}; + + +/** + * Screen and config-related functions + */ + +static void +setupLoaderExtensions(__DRIscreen *psp, + const __DRIextension **extensions) +{ + int i; + + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_SWRAST_LOADER) == 0) + psp->swrast_loader = (__DRIswrastLoaderExtension *) extensions[i]; + } +} + +static __DRIconfig ** +swrastFillInModes(__DRIscreen *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer) +{ + __DRIconfig **configs; + unsigned depth_buffer_factor; + unsigned back_buffer_factor; + GLenum fb_format; + GLenum fb_type; + + /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't + * support pageflipping at all. + */ + static const GLenum back_buffer_modes[] = { + GLX_NONE, GLX_SWAP_UNDEFINED_OML + }; + + u_int8_t depth_bits_array[4]; + u_int8_t stencil_bits_array[4]; + + depth_bits_array[0] = 0; + depth_bits_array[1] = 0; + depth_bits_array[2] = depth_bits; + depth_bits_array[3] = depth_bits; + + /* Just like with the accumulation buffer, always provide some modes + * with a stencil buffer. + */ + stencil_bits_array[0] = 0; + stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; + stencil_bits_array[2] = 0; + stencil_bits_array[3] = (stencil_bits == 0) ? 8 : stencil_bits; + + depth_buffer_factor = 4; + back_buffer_factor = 2; + + if (pixel_bits == 8) { + fb_format = GL_RGB; + fb_type = GL_UNSIGNED_BYTE_2_3_3_REV; + } + else if (pixel_bits == 16) { + fb_format = GL_RGB; + fb_type = GL_UNSIGNED_SHORT_5_6_5; + } + else { + fb_format = GL_BGRA; + fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; + } + + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor); + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, + __LINE__); + return NULL; + } + + return configs; +} + +static __DRIscreen * +driCreateNewScreen(int scrn, const __DRIextension **extensions, + const __DRIconfig ***driver_configs, void *data) +{ + static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; + __DRIconfig **configs8, **configs16, **configs32; + + (void) data; + + TRACE; + + psp = _mesa_calloc(sizeof(*psp)); + if (!psp) + return NULL; + + setupLoaderExtensions(psp, extensions); + + psp->num = scrn; + psp->extensions = emptyExtensionList; + + configs8 = swrastFillInModes(psp, 8, 8, 0, 1); + configs16 = swrastFillInModes(psp, 16, 16, 0, 1); + configs32 = swrastFillInModes(psp, 32, 24, 8, 1); + + configs16 = (__DRIconfig **)driConcatConfigs(configs8, configs16); + + *driver_configs = driConcatConfigs(configs16, configs32); + + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + return psp; +} + +static void driDestroyScreen(__DRIscreen *psp) +{ + TRACE; + + if (psp) { + _mesa_free(psp); + } +} + +static const __DRIextension **driGetExtensions(__DRIscreen *psp) +{ + TRACE; + + return psp->extensions; +} + + +/** + * Framebuffer and renderbuffer-related functions. + */ + +static GLuint +choose_pixel_format(const GLvisual *v) +{ + if (v->rgbMode) { + int bpp = v->rgbBits; + + if (bpp == 32 + && v->redMask == 0xff0000 + && v->greenMask == 0x00ff00 + && v->blueMask == 0x0000ff) + return PF_A8R8G8B8; + else if (bpp == 16 + && v->redMask == 0xf800 + && v->greenMask == 0x07e0 + && v->blueMask == 0x001f) + return PF_R5G6B5; + else if (bpp == 8 + && v->redMask == 0x07 + && v->greenMask == 0x38 + && v->blueMask == 0xc0) + return PF_R3G3B2; + } + else { + if (v->indexBits == 8) + return PF_CI8; + } + + _mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ ); + return 0; +} + +static void +swrast_delete_renderbuffer(struct gl_renderbuffer *rb) +{ + TRACE; + + _mesa_free(rb->Data); + _mesa_free(rb); +} + +static GLboolean +swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, + GLenum internalFormat, GLuint width, GLuint height) +{ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); + int bpp; + unsigned mask = PITCH_ALIGN_BITS - 1; + + TRACE; + + rb->Data = NULL; + rb->Width = width; + rb->Height = height; + + switch (internalFormat) { + case GL_RGB: + bpp = rb->RedBits + rb->GreenBits + rb->BlueBits; + break; + case GL_RGBA: + bpp = rb->RedBits + rb->GreenBits + rb->BlueBits + rb->AlphaBits; + break; + case GL_COLOR_INDEX8_EXT: + bpp = rb->IndexBits; + break; + default: + _mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ ); + return GL_FALSE; + } + + /* always pad to PITCH_ALIGN_BITS */ + xrb->pitch = ((width * bpp + mask) & ~mask) / 8; + + return GL_TRUE; +} + +static GLboolean +swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, + GLenum internalFormat, GLuint width, GLuint height) +{ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); + + TRACE; + + _mesa_free(rb->Data); + + (void) swrast_alloc_front_storage(ctx, rb, internalFormat, width, height); + + rb->Data = _mesa_malloc(height * xrb->pitch); + + return GL_TRUE; +} + +static struct swrast_renderbuffer * +swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) +{ + struct swrast_renderbuffer *xrb = _mesa_calloc(sizeof *xrb); + GLuint pixel_format; + + TRACE; + + if (xrb) { + _mesa_init_renderbuffer(&xrb->Base, 0); + + pixel_format = choose_pixel_format(visual); + + xrb->Base.Delete = swrast_delete_renderbuffer; + if (front) { + xrb->Base.AllocStorage = swrast_alloc_front_storage; + swrast_set_span_funcs_front(xrb, pixel_format); + } + else { + xrb->Base.AllocStorage = swrast_alloc_back_storage; + swrast_set_span_funcs_back(xrb, pixel_format); + } + + switch (pixel_format) { + case PF_A8R8G8B8: + xrb->Base.InternalFormat = GL_RGBA; + xrb->Base._BaseFormat = GL_RGBA; + xrb->Base.DataType = GL_UNSIGNED_BYTE; + xrb->Base.RedBits = 8 * sizeof(GLubyte); + xrb->Base.GreenBits = 8 * sizeof(GLubyte); + xrb->Base.BlueBits = 8 * sizeof(GLubyte); + xrb->Base.AlphaBits = 8 * sizeof(GLubyte); + break; + case PF_R5G6B5: + xrb->Base.InternalFormat = GL_RGB; + xrb->Base._BaseFormat = GL_RGB; + xrb->Base.DataType = GL_UNSIGNED_BYTE; + xrb->Base.RedBits = 5 * sizeof(GLubyte); + xrb->Base.GreenBits = 6 * sizeof(GLubyte); + xrb->Base.BlueBits = 5 * sizeof(GLubyte); + xrb->Base.AlphaBits = 0; + break; + case PF_R3G3B2: + xrb->Base.InternalFormat = GL_RGB; + xrb->Base._BaseFormat = GL_RGB; + xrb->Base.DataType = GL_UNSIGNED_BYTE; + xrb->Base.RedBits = 3 * sizeof(GLubyte); + xrb->Base.GreenBits = 3 * sizeof(GLubyte); + xrb->Base.BlueBits = 2 * sizeof(GLubyte); + xrb->Base.AlphaBits = 0; + break; + case PF_CI8: + xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT; + xrb->Base._BaseFormat = GL_COLOR_INDEX; + xrb->Base.DataType = GL_UNSIGNED_BYTE; + xrb->Base.IndexBits = 8 * sizeof(GLubyte); + break; + default: + return NULL; + } + } + return xrb; +} + +static __DRIdrawable * +driCreateNewDrawable(__DRIscreen *screen, + const __DRIconfig *config, void *data) +{ + __DRIdrawable *buf; + struct swrast_renderbuffer *frontrb, *backrb; + + TRACE; + + buf = _mesa_calloc(sizeof *buf); + if (!buf) + return NULL; + + buf->loaderPrivate = data; + + buf->driScreenPriv = screen; + + buf->row = _mesa_malloc(MAX_WIDTH * 4); + + /* basic framebuffer setup */ + _mesa_initialize_framebuffer(&buf->Base, &config->modes); + + /* add front renderbuffer */ + frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE); + _mesa_add_renderbuffer(&buf->Base, BUFFER_FRONT_LEFT, &frontrb->Base); + + /* add back renderbuffer */ + if (config->modes.doubleBufferMode) { + backrb = swrast_new_renderbuffer(&config->modes, GL_FALSE); + _mesa_add_renderbuffer(&buf->Base, BUFFER_BACK_LEFT, &backrb->Base); + } + + /* add software renderbuffers */ + _mesa_add_soft_renderbuffers(&buf->Base, + GL_FALSE, /* color */ + config->modes.haveDepthBuffer, + config->modes.haveStencilBuffer, + config->modes.haveAccumBuffer, + GL_FALSE, /* alpha */ + GL_FALSE /* aux bufs */); + + return buf; +} + +static void +driDestroyDrawable(__DRIdrawable *buf) +{ + TRACE; + + if (buf) { + struct gl_framebuffer *fb = &buf->Base; + + _mesa_free(buf->row); + + fb->DeletePending = GL_TRUE; + _mesa_unreference_framebuffer(&fb); + } +} + +static void driSwapBuffers(__DRIdrawable *buf) +{ + GET_CURRENT_CONTEXT(ctx); + + struct swrast_renderbuffer *frontrb = + swrast_renderbuffer(buf->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + struct swrast_renderbuffer *backrb = + swrast_renderbuffer(buf->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer); + + __DRIscreen *screen = buf->driScreenPriv; + + TRACE; + + /* check for signle-buffered */ + if (backrb == NULL) + return; + + /* check if swapping currently bound buffer */ + if (ctx && ctx->DrawBuffer == &(buf->Base)) { + /* flush pending rendering */ + _mesa_notifySwapBuffers(ctx); + } + + screen->swrast_loader->putImage(buf, __DRI_SWRAST_IMAGE_OP_SWAP, + 0, 0, + frontrb->Base.Width, + frontrb->Base.Height, + backrb->Base.Data, + buf->loaderPrivate); +} + + +/** + * General device driver functions. + */ + +static void +get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h ) +{ + __DRIdrawable *buf = swrast_drawable(fb); + __DRIscreen *screen = buf->driScreenPriv; + int x, y; + + screen->swrast_loader->getDrawableInfo(buf, + &x, &y, w, h, + buf->loaderPrivate); +} + +static void +swrast_check_and_update_window_size( GLcontext *ctx, GLframebuffer *fb ) +{ + GLsizei width, height; + + get_window_size(fb, &width, &height); + if (fb->Width != width || fb->Height != height) { + _mesa_resize_framebuffer(ctx, fb, width, height); + } +} + +static const GLubyte * +get_string(GLcontext *ctx, GLenum pname) +{ + (void) ctx; + switch (pname) { + case GL_VENDOR: + return (const GLubyte *) "Mesa Project"; + case GL_RENDERER: + return (const GLubyte *) "Software Rasterizer"; + default: + return NULL; + } +} + +static void +update_state( GLcontext *ctx, GLuint new_state ) +{ + /* not much to do here - pass it on */ + _swrast_InvalidateState( ctx, new_state ); + _swsetup_InvalidateState( ctx, new_state ); + _vbo_InvalidateState( ctx, new_state ); + _tnl_InvalidateState( ctx, new_state ); +} + +static void +viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + GLframebuffer *draw = ctx->WinSysDrawBuffer; + GLframebuffer *read = ctx->WinSysReadBuffer; + + swrast_check_and_update_window_size(ctx, draw); + swrast_check_and_update_window_size(ctx, read); +} + +static void +swrast_init_driver_functions(struct dd_function_table *driver) +{ + driver->GetString = get_string; + driver->UpdateState = update_state; + driver->GetBufferSize = NULL; + driver->Viewport = viewport; +} + + +/** + * Context-related functions. + */ + +static __DRIcontext * +driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + __DRIcontext *ctx; + GLcontext *mesaCtx; + struct dd_function_table functions; + + TRACE; + + ctx = _mesa_calloc(sizeof *ctx); + if (!ctx) + return NULL; + + ctx->loaderPrivate = data; + + ctx->driScreenPriv = screen; + + /* build table of device driver functions */ + _mesa_init_driver_functions(&functions); + swrast_init_driver_functions(&functions); + + if (!_mesa_initialize_context(&ctx->Base, &config->modes, + shared ? &shared->Base : NULL, + &functions, (void *) ctx)) { + _mesa_free(ctx); + return NULL; + } + + mesaCtx = &ctx->Base; + + /* do bounds checking to prevent segfaults and server crashes! */ + mesaCtx->Const.CheckArrayBounds = GL_TRUE; + + /* create module contexts */ + _swrast_CreateContext( mesaCtx ); + _vbo_CreateContext( mesaCtx ); + _tnl_CreateContext( mesaCtx ); + _swsetup_CreateContext( mesaCtx ); + _swsetup_Wakeup( mesaCtx ); + + /* use default TCL pipeline */ + { + TNLcontext *tnl = TNL_CONTEXT(mesaCtx); + tnl->Driver.RunPipeline = _tnl_run_pipeline; + } + + _mesa_enable_sw_extensions(mesaCtx); + _mesa_enable_1_3_extensions(mesaCtx); + _mesa_enable_1_4_extensions(mesaCtx); + _mesa_enable_1_5_extensions(mesaCtx); + _mesa_enable_2_0_extensions(mesaCtx); + _mesa_enable_2_1_extensions(mesaCtx); + + return ctx; +} + +static void +driDestroyContext(__DRIcontext *ctx) +{ + GLcontext *mesaCtx; + TRACE; + + if (ctx) { + mesaCtx = &ctx->Base; + _swsetup_DestroyContext( mesaCtx ); + _swrast_DestroyContext( mesaCtx ); + _tnl_DestroyContext( mesaCtx ); + _vbo_DestroyContext( mesaCtx ); + _mesa_destroy_context( mesaCtx ); + } +} + +static int +driCopyContext(__DRIcontext *dst, __DRIcontext *src, unsigned long mask) +{ + TRACE; + + _mesa_copy_context(&src->Base, &dst->Base, mask); + return GL_TRUE; +} + +static int driBindContext(__DRIcontext *ctx, + __DRIdrawable *draw, + __DRIdrawable *read) +{ + GLcontext *mesaCtx; + GLframebuffer *mesaDraw; + GLframebuffer *mesaRead; + TRACE; + + if (ctx) { + if (!draw || !read) + return GL_FALSE; + + mesaCtx = &ctx->Base; + mesaDraw = &draw->Base; + mesaRead = &read->Base; + + /* check for same context and buffer */ + if (mesaCtx == _mesa_get_current_context() + && mesaCtx->DrawBuffer == mesaDraw + && mesaCtx->ReadBuffer == mesaRead) { + return GL_TRUE; + } + + _glapi_check_multithread(); + + swrast_check_and_update_window_size(mesaCtx, mesaDraw); + if (read != draw) + swrast_check_and_update_window_size(mesaCtx, mesaRead); + + _mesa_make_current( mesaCtx, + mesaDraw, + mesaRead ); + } + else { + /* unbind */ + _mesa_make_current( NULL, NULL, NULL ); + } + + return GL_TRUE; +} + +static int driUnbindContext(__DRIcontext *ctx) +{ + TRACE; + (void) ctx; + _mesa_make_current(NULL, NULL, NULL); + return GL_TRUE; +} + + +static const __DRIcoreExtension driCoreExtension = { + { __DRI_CORE, __DRI_CORE_VERSION }, + NULL, /* driCreateNewScreen */ + driDestroyScreen, + driGetExtensions, + driGetConfigAttrib, + driIndexConfigAttrib, + NULL, /* driCreateNewDrawable */ + driDestroyDrawable, + driSwapBuffers, + driCreateNewContext, + driCopyContext, + driDestroyContext, + driBindContext, + driUnbindContext +}; + +static const __DRIswrastExtension driSWRastExtension = { + { __DRI_SWRAST, __DRI_SWRAST_VERSION }, + driCreateNewScreen, + driCreateNewDrawable +}; + +/* This is the table of extensions that the loader will dlsym() for. */ +PUBLIC const __DRIextension *__driDriverExtensions[] = { + &driCoreExtension.base, + &driSWRastExtension.base, + NULL +}; diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h new file mode 100644 index 00000000000..a3e3922f128 --- /dev/null +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -0,0 +1,142 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 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. + */ + +/* + * Authors: + * George Sapountzis <[email protected]> + */ + + +#ifndef _SWRAST_PRIV_H +#define _SWRAST_PRIV_H + +#include <GL/gl.h> +#include <GL/internal/dri_interface.h> +#include "mtypes.h" + + +/** + * Debugging + */ +#define DEBUG_CORE 0 +#define DEBUG_SPAN 0 + +#if DEBUG_CORE +#define TRACE _mesa_printf("--> %s\n", __FUNCTION__) +#else +#define TRACE +#endif + +#if DEBUG_SPAN +#define TRACE_SPAN _mesa_printf("--> %s\n", __FUNCTION__) +#else +#define TRACE_SPAN +#endif + + +/** + * Data types + */ +struct __DRIscreenRec { + int num; + + const __DRIextension **extensions; + + const __DRIswrastLoaderExtension *swrast_loader; +}; + +struct __DRIcontextRec { + GLcontext Base; + + void *loaderPrivate; + + __DRIscreen *driScreenPriv; +}; + +struct __DRIdrawableRec { + GLframebuffer Base; + + void *loaderPrivate; + + __DRIscreen *driScreenPriv; + + /* scratch row for optimized front-buffer rendering */ + char *row; +}; + +struct swrast_renderbuffer { + struct gl_renderbuffer Base; + + /* renderbuffer pitch (in bytes) */ + GLuint pitch; +}; + +static inline __DRIcontext * +swrast_context(GLcontext *ctx) +{ + return (__DRIcontext *) ctx; +} + +static inline __DRIdrawable * +swrast_drawable(GLframebuffer *fb) +{ + return (__DRIdrawable *) fb; +} + +static inline struct swrast_renderbuffer * +swrast_renderbuffer(struct gl_renderbuffer *rb) +{ + return (struct swrast_renderbuffer *) rb; +} + + +/** + * Pixel formats we support + */ +#define PF_CI8 1 /**< Color Index mode */ +#define PF_A8R8G8B8 2 /**< 32-bit TrueColor: 8-A, 8-R, 8-G, 8-B bits */ +#define PF_R5G6B5 3 /**< 16-bit TrueColor: 5-R, 6-G, 5-B bits */ +#define PF_R3G3B2 4 /**< 8-bit TrueColor: 3-R, 3-G, 2-B bits */ + + +/** + * Renderbuffer pitch alignment (in bits). + * + * The xorg loader requires padding images to 32 bits. However, this should + * become a screen/drawable parameter XXX + */ +#define PITCH_ALIGN_BITS 32 + + +/* swrast_span.c */ + +extern void +swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb, + GLuint pixel_format); + +extern void +swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb, + GLuint pixel_format); + +#endif /* _SWRAST_PRIV_H_ */ diff --git a/src/mesa/drivers/dri/swrast/swrast_span.c b/src/mesa/drivers/dri/swrast/swrast_span.c new file mode 100644 index 00000000000..5e990368b2e --- /dev/null +++ b/src/mesa/drivers/dri/swrast/swrast_span.c @@ -0,0 +1,367 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 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. + */ + +/* + * Authors: + * George Sapountzis <[email protected]> + */ + +#include "swrast_priv.h" + +#define YFLIP(_xrb, Y) ((_xrb)->Base.Height - (Y) - 1) + +/* + * Dithering support takes the "computation" extreme in the "computation vs. + * storage" trade-off. This approach is very simple to implement and any + * computational overhead should be acceptable. XMesa uses table lookups for + * around 8KB of storage overhead per visual. + */ +#define DITHER 1 + +static const GLubyte kernel[16] = { + 0*16, 8*16, 2*16, 10*16, + 12*16, 4*16, 14*16, 6*16, + 3*16, 11*16, 1*16, 9*16, + 15*16, 7*16, 13*16, 5*16, +}; + +#if DITHER +#define DITHER_COMP(X, Y) kernel[((X) & 0x3) | (((Y) & 0x3) << 2)] + +#define DITHER_CLAMP(X) (((X) < CHAN_MAX) ? (X) : CHAN_MAX) +#else +#define DITHER_COMP(X, Y) 0 + +#define DITHER_CLAMP(X) (X) +#endif + + +/* + * Pixel macros shared across front/back buffer span functions. + */ + +/* 32-bit BGRA */ +#define STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) \ + DST[3] = VALUE[ACOMP]; \ + DST[2] = VALUE[RCOMP]; \ + DST[1] = VALUE[GCOMP]; \ + DST[0] = VALUE[BCOMP] +#define STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE) \ + DST[3] = 0xff; \ + DST[2] = VALUE[RCOMP]; \ + DST[1] = VALUE[GCOMP]; \ + DST[0] = VALUE[BCOMP] +#define FETCH_PIXEL_A8R8G8B8(DST, SRC) \ + DST[ACOMP] = SRC[3]; \ + DST[RCOMP] = SRC[2]; \ + DST[GCOMP] = SRC[1]; \ + DST[BCOMP] = SRC[0] + + +/* 16-bit BGR */ +#define STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) \ + do { \ + int d = DITHER_COMP(X, Y) >> 6; \ + GLushort *p = (GLushort *)DST; \ + *p = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xf8) << 8) | \ + ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xfc) << 3) | \ + ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xf8) >> 3) ); \ + } while(0) +#define FETCH_PIXEL_R5G6B5(DST, SRC) \ + do { \ + GLushort p = *(GLushort *)SRC; \ + DST[ACOMP] = 0xff; \ + DST[RCOMP] = ((p >> 8) & 0xf8) * 255 / 0xf8; \ + DST[GCOMP] = ((p >> 3) & 0xfc) * 255 / 0xfc; \ + DST[BCOMP] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + } while(0) + + +/* 8-bit BGR */ +#define STORE_PIXEL_R3G3B2(DST, X, Y, VALUE) \ + do { \ + int d = DITHER_COMP(X, Y) >> 3; \ + GLubyte *p = (GLubyte *)DST; \ + *p = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xe0) >> 5) | \ + ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xe0) >> 2) | \ + ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xc0) >> 0) ); \ + } while(0) +#define FETCH_PIXEL_R3G3B2(DST, SRC) \ + do { \ + GLubyte p = *(GLubyte *)SRC; \ + DST[ACOMP] = 0xff; \ + DST[RCOMP] = ((p << 5) & 0xe0) * 255 / 0xe0; \ + DST[GCOMP] = ((p << 2) & 0xe0) * 255 / 0xe0; \ + DST[BCOMP] = ((p << 0) & 0xc0) * 255 / 0xc0; \ + } while(0) + + +/* + * Generate code for back-buffer span functions. + */ + +/* 32-bit BGRA */ +#define NAME(FUNC) FUNC##_A8R8G8B8 +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 4; +#define INC_PIXEL_PTR(P) P += 4 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) +#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ + STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_A8R8G8B8(DST, SRC) + +#include "swrast/s_spantemp.h" + + +/* 16-bit BGR */ +#define NAME(FUNC) FUNC##_R5G6B5 +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 2; +#define INC_PIXEL_PTR(P) P += 2 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_R5G6B5(DST, SRC) + +#include "swrast/s_spantemp.h" + + +/* 8-bit BGR */ +#define NAME(FUNC) FUNC##_R3G3B2 +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 1; +#define INC_PIXEL_PTR(P) P += 1 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_R3G3B2(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_R3G3B2(DST, SRC) + +#include "swrast/s_spantemp.h" + + +/* 8-bit color index */ +#define NAME(FUNC) FUNC##_CI8 +#define CI_MODE +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X); +#define INC_PIXEL_PTR(P) P += 1 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + *DST = VALUE[0] +#define FETCH_PIXEL(DST, SRC) \ + DST = SRC[0] + +#include "swrast/s_spantemp.h" + + +/* + * Generate code for front-buffer span functions. + */ + +/* 32-bit BGRA */ +#define NAME(FUNC) FUNC##_A8R8G8B8_front +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)row; +#define INC_PIXEL_PTR(P) P += 4 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) +#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ + STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_A8R8G8B8(DST, SRC) + +#include "swrast_spantemp.h" + + +/* 16-bit BGR */ +#define NAME(FUNC) FUNC##_R5G6B5_front +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)row; +#define INC_PIXEL_PTR(P) P += 2 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_R5G6B5(DST, SRC) + +#include "swrast_spantemp.h" + + +/* 8-bit BGR */ +#define NAME(FUNC) FUNC##_R3G3B2_front +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)row; +#define INC_PIXEL_PTR(P) P += 1 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_R3G3B2(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_R3G3B2(DST, SRC) + +#include "swrast_spantemp.h" + + +/* 8-bit color index */ +#define NAME(FUNC) FUNC##_CI8_front +#define CI_MODE +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)row; +#define INC_PIXEL_PTR(P) P += 1 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + *DST = VALUE[0] +#define FETCH_PIXEL(DST, SRC) \ + DST = SRC[0] + +#include "swrast_spantemp.h" + + +/* + * Back-buffers are malloced memory and always private. + * + * BACK_PIXMAP (not supported) + * BACK_XIMAGE + */ +void +swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb, + GLuint pixel_format) +{ + switch (pixel_format) { + case PF_A8R8G8B8: + xrb->Base.GetRow = get_row_A8R8G8B8; + xrb->Base.GetValues = get_values_A8R8G8B8; + xrb->Base.PutRow = put_row_A8R8G8B8; + xrb->Base.PutRowRGB = put_row_rgb_A8R8G8B8; + xrb->Base.PutMonoRow = put_mono_row_A8R8G8B8; + xrb->Base.PutValues = put_values_A8R8G8B8; + xrb->Base.PutMonoValues = put_mono_values_A8R8G8B8; + break; + case PF_R5G6B5: + xrb->Base.GetRow = get_row_R5G6B5; + xrb->Base.GetValues = get_values_R5G6B5; + xrb->Base.PutRow = put_row_R5G6B5; + xrb->Base.PutRowRGB = put_row_rgb_R5G6B5; + xrb->Base.PutMonoRow = put_mono_row_R5G6B5; + xrb->Base.PutValues = put_values_R5G6B5; + xrb->Base.PutMonoValues = put_mono_values_R5G6B5; + break; + case PF_R3G3B2: + xrb->Base.GetRow = get_row_R3G3B2; + xrb->Base.GetValues = get_values_R3G3B2; + xrb->Base.PutRow = put_row_R3G3B2; + xrb->Base.PutRowRGB = put_row_rgb_R3G3B2; + xrb->Base.PutMonoRow = put_mono_row_R3G3B2; + xrb->Base.PutValues = put_values_R3G3B2; + xrb->Base.PutMonoValues = put_mono_values_R3G3B2; + break; + case PF_CI8: + xrb->Base.GetRow = get_row_CI8; + xrb->Base.GetValues = get_values_CI8; + xrb->Base.PutRow = put_row_CI8; + xrb->Base.PutMonoRow = put_mono_row_CI8; + xrb->Base.PutValues = put_values_CI8; + xrb->Base.PutMonoValues = put_mono_values_CI8; + break; + default: + assert(0); + return; + } +} + + +/* + * Front-buffers are provided by the loader, the xorg loader uses pixmaps. + * + * WINDOW, An X window + * GLXWINDOW, GLX window + * PIXMAP, GLX pixmap + * PBUFFER GLX Pbuffer + */ +void +swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb, + GLuint pixel_format) +{ + switch (pixel_format) { + case PF_A8R8G8B8: + xrb->Base.GetRow = get_row_A8R8G8B8_front; + xrb->Base.GetValues = get_values_A8R8G8B8_front; + xrb->Base.PutRow = put_row_A8R8G8B8_front; + xrb->Base.PutRowRGB = put_row_rgb_A8R8G8B8_front; + xrb->Base.PutMonoRow = put_mono_row_A8R8G8B8_front; + xrb->Base.PutValues = put_values_A8R8G8B8_front; + xrb->Base.PutMonoValues = put_mono_values_A8R8G8B8_front; + break; + case PF_R5G6B5: + xrb->Base.GetRow = get_row_R5G6B5_front; + xrb->Base.GetValues = get_values_R5G6B5_front; + xrb->Base.PutRow = put_row_R5G6B5_front; + xrb->Base.PutRowRGB = put_row_rgb_R5G6B5_front; + xrb->Base.PutMonoRow = put_mono_row_R5G6B5_front; + xrb->Base.PutValues = put_values_R5G6B5_front; + xrb->Base.PutMonoValues = put_mono_values_R5G6B5_front; + break; + case PF_R3G3B2: + xrb->Base.GetRow = get_row_R3G3B2_front; + xrb->Base.GetValues = get_values_R3G3B2_front; + xrb->Base.PutRow = put_row_R3G3B2_front; + xrb->Base.PutRowRGB = put_row_rgb_R3G3B2_front; + xrb->Base.PutMonoRow = put_mono_row_R3G3B2_front; + xrb->Base.PutValues = put_values_R3G3B2_front; + xrb->Base.PutMonoValues = put_mono_values_R3G3B2_front; + break; + case PF_CI8: + xrb->Base.GetRow = get_row_CI8_front; + xrb->Base.GetValues = get_values_CI8_front; + xrb->Base.PutRow = put_row_CI8_front; + xrb->Base.PutMonoRow = put_mono_row_CI8_front; + xrb->Base.PutValues = put_values_CI8_front; + xrb->Base.PutMonoValues = put_mono_values_CI8_front; + break; + default: + assert(0); + return; + } +} diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h new file mode 100644 index 00000000000..e7a9c86d7de --- /dev/null +++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h @@ -0,0 +1,328 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5.1 + * + * 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. + */ + + +/* + * Modified version of swrast/s_spantemp.h for front-buffer rendering. The + * no-mask paths use a scratch row to avoid repeated calls to the loader. + * + * For the mask paths we always use an array of 4 elements of RB_TYPE. This is + * to satisfy the xorg loader requirement of an image pitch of 32 bits and + * should be ok for other loaders also. + */ + + +#ifndef _SWRAST_SPANTEMP_ONCE +#define _SWRAST_SPANTEMP_ONCE + +static inline void +PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) +{ + __DRIcontext *ctx = swrast_context(glCtx); + __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer); + + __DRIscreen *screen = ctx->driScreenPriv; + + screen->swrast_loader->putImage(draw, __DRI_SWRAST_IMAGE_OP_DRAW, + x, y, 1, 1, (char *)p, + draw->loaderPrivate); +} + + +static inline void +GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) +{ + __DRIcontext *ctx = swrast_context(glCtx); + __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer); + + __DRIscreen *screen = ctx->driScreenPriv; + + screen->swrast_loader->getImage(read, x, y, 1, 1, (char *)p, + read->loaderPrivate); +} + +static inline void +PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) +{ + __DRIcontext *ctx = swrast_context(glCtx); + __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer); + + __DRIscreen *screen = ctx->driScreenPriv; + + screen->swrast_loader->putImage(draw, __DRI_SWRAST_IMAGE_OP_DRAW, + x, y, n, 1, row, + draw->loaderPrivate); +} + +static inline void +GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) +{ + __DRIcontext *ctx = swrast_context(glCtx); + __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer); + + __DRIscreen *screen = ctx->driScreenPriv; + + screen->swrast_loader->getImage(read, x, y, n, 1, row, + read->loaderPrivate); +} + +#endif /* _SWRAST_SPANTEMP_ONCE */ + + +/* + * Templates for the span/pixel-array write/read functions called via + * the gl_renderbuffer's GetRow, GetValues, PutRow, PutMonoRow, PutValues + * and PutMonoValues functions. + * + * Define the following macros before including this file: + * NAME(BASE) to generate the function name (i.e. add prefix or suffix) + * RB_TYPE the renderbuffer DataType + * CI_MODE if set, color index mode, else RGBA + * SPAN_VARS to declare any local variables + * INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel + * INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel + * STORE_PIXEL(DST, X, Y, VALUE) to store pixel values in buffer + * FETCH_PIXEL(DST, SRC) to fetch pixel values from buffer + * + * Note that in the STORE_PIXEL macros, we also pass in the (X,Y) coordinates + * for the pixels to be stored. This is useful when dithering and probably + * ignored otherwise. + */ + +#include "macros.h" + + +#ifdef CI_MODE +#define RB_COMPONENTS 1 +#elif !defined(RB_COMPONENTS) +#define RB_COMPONENTS 4 +#endif + + +static void +NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, void *values ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#ifdef CI_MODE + RB_TYPE *dest = (RB_TYPE *) values; +#else + RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values; +#endif + GLuint i; + char *row = swrast_drawable(ctx->ReadBuffer)->row; + INIT_PIXEL_PTR(pixel, x, y); + GET_ROW( ctx, x, YFLIP(xrb, y), count, row ); + for (i = 0; i < count; i++) { + FETCH_PIXEL(dest[i], pixel); + INC_PIXEL_PTR(pixel); + } + (void) rb; +} + + +static void +NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], void *values ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#ifdef CI_MODE + RB_TYPE *dest = (RB_TYPE *) values; +#else + RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values; +#endif + GLuint i; + for (i = 0; i < count; i++) { + RB_TYPE pixel[4]; + GET_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel); + FETCH_PIXEL(dest[i], pixel); + } + (void) rb; +} + + +static void +NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif + const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values; + GLuint i; + if (mask) { + for (i = 0; i < count; i++) { + if (mask[i]) { + RB_TYPE pixel[4]; + STORE_PIXEL(pixel, x + i, y, src[i]); + PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel); + } + } + } + else { + char *row = swrast_drawable(ctx->DrawBuffer)->row; + INIT_PIXEL_PTR(pixel, x, y); + for (i = 0; i < count; i++) { + STORE_PIXEL(pixel, x + i, y, src[i]); + INC_PIXEL_PTR(pixel); + } + PUT_ROW( ctx, x, YFLIP(xrb, y), count, row ); + } + (void) rb; +} + + +#if !defined(CI_MODE) +static void +NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif + const RB_TYPE (*src)[3] = (const RB_TYPE (*)[3]) values; + GLuint i; + if (mask) { + for (i = 0; i < count; i++) { + if (mask[i]) { + RB_TYPE pixel[4]; +#ifdef STORE_PIXEL_RGB + STORE_PIXEL_RGB(pixel, x + i, y, src[i]); +#else + STORE_PIXEL(pixel, x + i, y, src[i]); +#endif + PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel); + } + } + } + else { + char *row = swrast_drawable(ctx->DrawBuffer)->row; + INIT_PIXEL_PTR(pixel, x, y); + for (i = 0; i < count; i++) { +#ifdef STORE_PIXEL_RGB + STORE_PIXEL_RGB(pixel, x + i, y, src[i]); +#else + STORE_PIXEL(pixel, x + i, y, src[i]); +#endif + INC_PIXEL_PTR(pixel); + } + PUT_ROW( ctx, x, YFLIP(xrb, y), count, row ); + } + (void) rb; +} +#endif + + +static void +NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *value, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif + const RB_TYPE *src = (const RB_TYPE *) value; + GLuint i; + if (mask) { + for (i = 0; i < count; i++) { + if (mask[i]) { + RB_TYPE pixel[4]; + STORE_PIXEL(pixel, x + i, y, src); + PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel); + } + } + } + else { + char *row = swrast_drawable(ctx->DrawBuffer)->row; + INIT_PIXEL_PTR(pixel, x, y); + for (i = 0; i < count; i++) { + STORE_PIXEL(pixel, x + i, y, src); + INC_PIXEL_PTR(pixel); + } + PUT_ROW( ctx, x, YFLIP(xrb, y), count, row ); + } + (void) rb; +} + + +static void +NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif + const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values; + GLuint i; + ASSERT(mask); + for (i = 0; i < count; i++) { + if (mask[i]) { + RB_TYPE pixel[4]; + STORE_PIXEL(pixel, x[i], y[i], src[i]); + PUT_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel); + } + } + (void) rb; +} + + +static void +NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + const void *value, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif + const RB_TYPE *src = (const RB_TYPE *) value; + GLuint i; + ASSERT(mask); + for (i = 0; i < count; i++) { + if (mask[i]) { + RB_TYPE pixel[4]; + STORE_PIXEL(pixel, x[i], y[i], src); + PUT_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel); + } + } + (void) rb; +} + + +#undef NAME +#undef RB_TYPE +#undef RB_COMPONENTS +#undef CI_MODE +#undef SPAN_VARS +#undef INIT_PIXEL_PTR +#undef INC_PIXEL_PTR +#undef STORE_PIXEL +#undef STORE_PIXEL_RGB +#undef FETCH_PIXEL diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index bbb198bf0e8..d9b4f2d112a 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -679,46 +679,48 @@ void viaDestroyContext(__DRIcontextPrivate *driContextPriv) { GET_CURRENT_CONTEXT(ctx); - struct via_context *vmesa = + struct via_context *vmesa = (struct via_context *)driContextPriv->driverPrivate; struct via_context *current = ctx ? VIA_CONTEXT(ctx) : NULL; + assert(vmesa); /* should never be null */ + if (vmesa->driDrawable) { + viaWaitIdle(vmesa, GL_FALSE); + + if (vmesa->doPageFlip) { + LOCK_HARDWARE(vmesa); + if (vmesa->pfCurrentOffset != 0) { + fprintf(stderr, "%s - reset pf\n", __FUNCTION__); + viaResetPageFlippingLocked(vmesa); + } + UNLOCK_HARDWARE(vmesa); + } + } + /* check if we're deleting the currently bound context */ if (vmesa == current) { VIA_FLUSH_DMA(vmesa); _mesa_make_current(NULL, NULL, NULL); } - if (vmesa) { - viaWaitIdle(vmesa, GL_FALSE); - if (vmesa->doPageFlip) { - LOCK_HARDWARE(vmesa); - if (vmesa->pfCurrentOffset != 0) { - fprintf(stderr, "%s - reset pf\n", __FUNCTION__); - viaResetPageFlippingLocked(vmesa); - } - UNLOCK_HARDWARE(vmesa); - } - - _swsetup_DestroyContext(vmesa->glCtx); - _tnl_DestroyContext(vmesa->glCtx); - _vbo_DestroyContext(vmesa->glCtx); - _swrast_DestroyContext(vmesa->glCtx); - /* free the Mesa context */ - _mesa_destroy_context(vmesa->glCtx); - /* release our data */ - FreeBuffer(vmesa); + _swsetup_DestroyContext(vmesa->glCtx); + _tnl_DestroyContext(vmesa->glCtx); + _vbo_DestroyContext(vmesa->glCtx); + _swrast_DestroyContext(vmesa->glCtx); + /* free the Mesa context */ + _mesa_destroy_context(vmesa->glCtx); + /* release our data */ + FreeBuffer(vmesa); - assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP])); - assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO])); - assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM])); - assert (is_empty_list(&vmesa->freed_tex_buffers)); + assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP])); + assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO])); + assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM])); + assert (is_empty_list(&vmesa->freed_tex_buffers)); - driDestroyOptionCache(&vmesa->optionCache); + driDestroyOptionCache(&vmesa->optionCache); - FREE(vmesa); - } + FREE(vmesa); } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index ca193bfa538..3648710533b 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -24,8 +24,8 @@ #include <stdio.h> -#include "utils.h" #include "dri_util.h" +#include "utils.h" #include "glheader.h" #include "context.h" #include "framebuffer.h" diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 0261a3ff177..15f15a89a6f 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -820,9 +820,7 @@ static void viaTexImage(GLcontext *ctx, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + _mesa_generate_mipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); diff --git a/src/mesa/drivers/glslcompiler/Makefile b/src/mesa/drivers/glslcompiler/Makefile index 858457ddd40..dc4abd44d49 100644 --- a/src/mesa/drivers/glslcompiler/Makefile +++ b/src/mesa/drivers/glslcompiler/Makefile @@ -41,4 +41,4 @@ glslcompiler.o: glslcompiler.c clean: - rm -f *.o *~ $(PROGRAM) + -rm -f *.o *~ $(PROGRAM) diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def index c525945426f..3f2d644e86e 100644 --- a/src/mesa/drivers/windows/gdi/mesa.def +++ b/src/mesa/drivers/windows/gdi/mesa.def @@ -867,8 +867,6 @@ EXPORTS _glapi_get_proc_address _mesa_add_soft_renderbuffers _mesa_add_renderbuffer - _mesa_attach_shader - _mesa_bind_attrib_location _mesa_buffer_data _mesa_buffer_get_subdata _mesa_buffer_map @@ -877,24 +875,20 @@ EXPORTS _mesa_bzero _mesa_calloc _mesa_choose_tex_format - _mesa_compile_shader _mesa_compressed_texture_size _mesa_create_framebuffer - _mesa_create_program - _mesa_create_shader _mesa_create_visual _mesa_delete_array_object _mesa_delete_buffer_object _mesa_delete_program - _mesa_delete_program2 - _mesa_delete_shader _mesa_delete_texture_object _mesa_destroy_framebuffer _mesa_destroy_visual - _mesa_detach_shader _mesa_enable_1_3_extensions _mesa_enable_1_4_extensions _mesa_enable_1_5_extensions + _mesa_enable_2_0_extensions + _mesa_enable_2_1_extensions _mesa_enable_sw_extensions _mesa_error _mesa_finish_render_texture @@ -902,28 +896,15 @@ EXPORTS _mesa_free _mesa_free_context_data _mesa_free_texture_image_data - _mesa_get_active_attrib - _mesa_get_active_uniform - _mesa_get_attached_shaders - _mesa_get_attrib_location + _mesa_generate_mipmap _mesa_get_compressed_teximage _mesa_get_current_context - _mesa_get_handle - _mesa_get_programiv - _mesa_get_program_info_log _mesa_get_program_register - _mesa_get_shaderiv - _mesa_get_shader_info_log - _mesa_get_shader_source _mesa_get_teximage - _mesa_get_uniformfv - _mesa_get_uniform_location _mesa_init_driver_functions + _mesa_init_glsl_driver_functions _mesa_init_renderbuffer _mesa_initialize_context - _mesa_is_program - _mesa_is_shader - _mesa_link_program _mesa_make_current _mesa_memcpy _mesa_memset @@ -942,7 +923,6 @@ EXPORTS _mesa_render_texture _mesa_ResizeBuffersMESA _mesa_resize_framebuffer - _mesa_shader_source _mesa_store_compressed_teximage1d _mesa_store_compressed_teximage2d _mesa_store_compressed_teximage3d @@ -957,12 +937,9 @@ EXPORTS _mesa_store_texsubimage3d _mesa_strcmp _mesa_test_proxy_teximage - _mesa_uniform - _mesa_uniform_matrix _mesa_unreference_framebuffer _mesa_update_framebuffer_visual _mesa_use_program - _mesa_validate_program _mesa_Viewport _swrast_Accum _swrast_Bitmap diff --git a/src/mesa/drivers/windows/gdi/wgl.c b/src/mesa/drivers/windows/gdi/wgl.c index f7028d01a36..0e2d2b3ca84 100644 --- a/src/mesa/drivers/windows/gdi/wgl.c +++ b/src/mesa/drivers/windows/gdi/wgl.c @@ -581,6 +581,13 @@ WINGDIAPI BOOL GLAPIENTRY wglUseFontBitmapsA(HDC hdc, DWORD first, return success; } +WINGDIAPI BOOL GLAPIENTRY wglShareLists(HGLRC hglrc1, + HGLRC hglrc2) +{ + WMesaShareLists((WMesaContext)hglrc1, (WMesaContext)hglrc2); + return(TRUE); +} + /* NOT IMPLEMENTED YET */ @@ -600,13 +607,6 @@ WINGDIAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC hdc, return(NULL); } -WINGDIAPI BOOL GLAPIENTRY wglShareLists(HGLRC hglrc1, - HGLRC hglrc2) -{ - WMesaShareLists(hglrc1, hglrc2); - return(TRUE); -} - WINGDIAPI BOOL GLAPIENTRY wglUseFontBitmapsW(HDC hdc, DWORD first, diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 7a170b4d3d1..e5cd8f0b805 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1183,11 +1183,12 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) * 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. diff --git a/src/mesa/drivers/xorg/.gitignore b/src/mesa/drivers/xorg/.gitignore deleted file mode 100644 index 18a777939c6..00000000000 --- a/src/mesa/drivers/xorg/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -glxheader.h -xmesaP.h -xm_* diff --git a/src/mesa/drivers/xorg/Makefile b/src/mesa/drivers/xorg/Makefile deleted file mode 100644 index a1b417447be..00000000000 --- a/src/mesa/drivers/xorg/Makefile +++ /dev/null @@ -1,95 +0,0 @@ -# src/mesa/drivers/xorg/Makefile - -TOP = ../../../.. -include $(TOP)/configs/current - -LIBNAME = libGLcore.so - -SYMLINKS = \ - glxheader.h \ - xmesaP.h \ - xm_api.c \ - xm_buffer.c \ - xm_dd.c \ - xm_image.c \ - xm_image.h \ - xm_line.c \ - xm_span.c \ - xm_tri.c - -C_SOURCES = \ - xm_api.c \ - xm_buffer.c \ - xm_dd.c \ - xm_image.c \ - xm_line.c \ - xm_span.c \ - xm_tri.c \ - glcore.c - -######################################## - -MESA_MODULES = $(TOP)/src/mesa/libmesa.a - -C_SOURCES += ../common/driverfuncs.c -ifeq ("${DRIVER_DIRS}", "dri") -C_SOURCES += ../dri/common/utils.c -endif - -OBJECTS = $(C_SOURCES:.c=.o) - -### Include directories -INCLUDES = \ - -I. \ - -I.. \ - -I$(TOP)/include \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ - `pkg-config --cflags xorg-server` - -ifeq ("${DRIVER_DIRS}", "dri") -INCLUDES += \ - -I$(TOP)/src/mesa/drivers/dri/common \ - `pkg-config --cflags libdrm` -endif - -# undef 'USE_XSHM' to make it explicit that 'XFree86Server' takes precedence -DRIVER_DEFINES = -UUSE_XSHM -DXFree86Server - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: depend symlinks $(LIBNAME) - - -$(LIBNAME): $(OBJECTS) $(MESA_MODULES) Makefile - $(TOP)/bin/mklib -noprefix -o $@ \ - $(OBJECTS) $(MESA_MODULES) $(GLCORE_LIB_DEPS) - - -depend: $(C_SOURCES) $(SYMLINKS) - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ - > /dev/null - - -clean: - -rm -f *.o *.so $(SYMLINKS) - -rm -f depend depend.bak - -install: $(LIBNAME) - $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) - $(INSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) - -$(SYMLINKS): - @[ -e $@ ] || ln -sf ../x11/$@ ./ - -symlinks: $(SYMLINKS) - -include depend diff --git a/src/mesa/drivers/xorg/glcore.c b/src/mesa/drivers/xorg/glcore.c deleted file mode 100644 index a0199117c67..00000000000 --- a/src/mesa/drivers/xorg/glcore.c +++ /dev/null @@ -1,24 +0,0 @@ - -#define _NEED_GL_CORE_IF -#include <GL/xmesa.h> -#include <GL/internal/glcore.h> -#include "xmesaP.h" - -PUBLIC -__GLcoreModule GL_Core = { - XMesaCreateVisual, - XMesaDestroyVisual, - - XMesaCreateWindowBuffer, - XMesaCreatePixmapBuffer, - XMesaDestroyBuffer, - XMesaSwapBuffers, - XMesaResizeBuffers, - - XMesaCreateContext, - XMesaDestroyContext, - XMesaCopyContext, - XMesaMakeCurrent2, - XMesaForceCurrent, - XMesaLoseCurrent -}; diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile index 6520f75e134..adc53d92494 100644 --- a/src/mesa/glapi/Makefile +++ b/src/mesa/glapi/Makefile @@ -7,27 +7,43 @@ 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/x11/indirect.c \ + ../../glx/x11/indirect.h \ + ../../glx/x11/indirect_init.c \ + ../../glx/x11/indirect_size.h \ + ../../glx/x11/indirect_size.c + + +GLX_DIR = $(XORG_BASE)/glx + +SERVER_GLAPI_FILES = \ + $(GLX_DIR)/glapi.h \ + $(GLX_DIR)/glapi.c \ + $(GLX_DIR)/glthread.c \ + $(GLX_DIR)/glthread.h + +SERVER_OUTPUTS = \ $(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.h \ $(GLX_DIR)/indirect_size_get.c \ $(GLX_DIR)/indirect_size_get.h \ - $(GLX_DIR)/indirect_table.c + $(GLX_DIR)/indirect_table.c \ + $(GLX_DIR)/glapitemp.h \ + $(GLX_DIR)/glapitable.h \ + $(GLX_DIR)/glapioffsets.h \ + $(GLX_DIR)/glprocs.h \ + $(GLX_DIR)/dispatch.h \ + $(SERVER_GLAPI_FILES) API_XML = gl_API.xml \ EXT_framebuffer_object.xml \ @@ -36,21 +52,33 @@ API_XML = gl_API.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) +all: check-xorg-source $(OUTPUTS) $(SERVER_OUTPUTS) + +check-xorg-source: + @if ! test -d $(GLX_DIR); then \ + echo "ERROR: Must specify path to xserver checkout; set XORG_BASE."; \ + exit 1; \ + fi + +$(GLX_DIR)/%.c: %.c + cp $< $@ + +$(GLX_DIR)/%.h: %.h + cp $< $@ -glprocs.h: gl_procs.py $(COMMON) +glprocs.h $(GLX_DIR)/glprocs.h: gl_procs.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ -glapitemp.h: gl_apitemp.py $(COMMON) +glapitemp.h $(GLX_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ -glapioffsets.h: gl_offsets.py $(COMMON) +glapioffsets.h $(GLX_DIR)/glapioffsets.h: gl_offsets.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ -glapitable.h: gl_table.py $(COMMON) +glapitable.h $(GLX_DIR)/glapitable.h: gl_table.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ -dispatch.h: gl_table.py $(COMMON) +dispatch.h $(GLX_DIR)/dispatch.h: gl_table.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@ ../main/enums.c: gl_enums.py $(COMMON) @@ -69,20 +97,20 @@ dispatch.h: gl_table.py $(COMMON) ../drivers/dri/common/extension_helper.h: extension_helper.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ -$(GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) +../../glx/x11/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) +../../glx/x11/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) +../../glx/x11/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) +../../glx/x11/indirect_size.h $(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) +../../glx/x11/indirect_size.c: glX_proto_size.py $(COMMON_GLX) $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \ | $(INDENT) $(INDENT_FLAGS) > $@ @@ -113,5 +141,5 @@ $(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) + -rm -f *~ *.pyo + -rm -f $(OUTPUTS) diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 36b09e68e50..c4d101aee55 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -51,10 +51,19 @@ #ifdef HAVE_DIX_CONFIG_H + #include <dix-config.h> -#endif +#define PUBLIC + +#else #include "glheader.h" + +#endif + +#include <stdlib.h> +#include <string.h> + #include "glapi.h" #include "glapioffsets.h" #include "glapitable.h" diff --git a/src/mesa/glapi/glthread.c b/src/mesa/glapi/glthread.c index 92f2e5bf560..813d6f9dbc2 100644 --- a/src/mesa/glapi/glthread.c +++ b/src/mesa/glapi/glthread.c @@ -25,7 +25,7 @@ /* * XXX There's probably some work to do in order to make this file - * truly reusable outside of Mesa. First, the glheader.h include must go. + * truly reusable outside of Mesa. */ @@ -33,7 +33,7 @@ #include <dix-config.h> #endif -#include "glheader.h" +#include <stdlib.h> #include "glthread.h" diff --git a/src/mesa/glapi/glthread.h b/src/mesa/glapi/glthread.h index a61086d0dc6..e2765cebb10 100644 --- a/src/mesa/glapi/glthread.h +++ b/src/mesa/glapi/glthread.h @@ -259,11 +259,11 @@ typedef benaphore _glthread_Mutex; * THREADS not defined */ -typedef GLuint _glthread_TSD; +typedef int _glthread_TSD; -typedef GLuint _glthread_Thread; +typedef int _glthread_Thread; -typedef GLuint _glthread_Mutex; +typedef int _glthread_Mutex; #define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index ab0f035b45b..58a39d11d4d 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -188,6 +188,7 @@ #define MAX_PROGRAM_ADDRESS_REGS 2 #define MAX_UNIFORMS 128 #define MAX_VARYING 8 +#define MAX_SAMPLERS 8 /*@}*/ /** For GL_NV_vertex_program */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 733aaad0309..2c387d8e2cb 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -149,8 +149,6 @@ int MESA_DEBUG_FLAGS = 0; /* ubyte -> float conversion */ GLfloat _mesa_ubyte_to_float_color_tab[256]; -static void -free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); /** @@ -420,12 +418,14 @@ alloc_shared_state( GLcontext *ctx ) #endif #if FEATURE_ARB_vertex_program - ss->DefaultVertexProgram = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + ss->DefaultVertexProgram = (struct gl_vertex_program *) + ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); if (!ss->DefaultVertexProgram) goto cleanup; #endif #if FEATURE_ARB_fragment_program - ss->DefaultFragmentProgram = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); + ss->DefaultFragmentProgram = (struct gl_fragment_program *) + ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); if (!ss->DefaultFragmentProgram) goto cleanup; #endif @@ -502,12 +502,10 @@ cleanup: _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program - if (ss->DefaultVertexProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); + _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL); #endif #if FEATURE_ARB_fragment_program - if (ss->DefaultFragmentProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); + _mesa_reference_fragprog(ctx, &ss->DefaultFragmentProgram, NULL); #endif #if FEATURE_ATI_fragment_shader if (ss->DefaultFragmentShader) @@ -584,6 +582,8 @@ delete_program_cb(GLuint id, void *data, void *userData) { struct gl_program *prog = (struct gl_program *) data; GLcontext *ctx = (GLcontext *) userData; + ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */ + prog->RefCount = 0; /* now going away */ ctx->Driver.DeleteProgram(ctx, prog); } @@ -709,15 +709,21 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_HashDeleteAll(ss->DisplayList, delete_displaylist_cb, ctx); _mesa_DeleteHashTable(ss->DisplayList); +#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 + #if defined(FEATURE_NV_vertex_program) || defined(FEATURE_NV_fragment_program) _mesa_HashDeleteAll(ss->Programs, delete_program_cb, ctx); _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program - ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); + _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL); #endif #if FEATURE_ARB_fragment_program - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); + _mesa_reference_fragprog(ctx, &ss->DefaultFragmentProgram, NULL); #endif #if FEATURE_ATI_fragment_shader @@ -734,12 +740,6 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_HashDeleteAll(ss->ArrayObjects, delete_arrayobj_cb, ctx); _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 - #if FEATURE_EXT_framebuffer_object _mesa_HashDeleteAll(ss->FrameBuffers, delete_framebuffer_cb, ctx); _mesa_DeleteHashTable(ss->FrameBuffers); @@ -1251,6 +1251,14 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_unreference_framebuffer(&ctx->DrawBuffer); _mesa_unreference_framebuffer(&ctx->ReadBuffer); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL); + + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); + _mesa_free_attrib_data(ctx); _mesa_free_lighting_data( ctx ); _mesa_free_eval_data( ctx ); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index ce33905af13..e3ded41acac 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -328,6 +328,12 @@ struct dd_function_table { GLsizei width, GLsizei height ); /** + * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. + */ + void (*GenerateMipmap)(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj); + + /** * Called by glTexImage[123]D when user specifies a proxy texture * target. * diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 23ede7bb68f..63a00e04f51 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -3248,6 +3248,36 @@ save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) 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); @@ -7838,6 +7868,9 @@ _mesa_init_dlist_table(struct _glapi_table *table) 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); diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9b60c732940..8e9948cb45d 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1544,7 +1544,7 @@ _mesa_GenerateMipmapEXT(GLenum target) /* XXX this might not handle cube maps correctly */ _mesa_lock_texture(ctx, texObj); - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); _mesa_unlock_texture(ctx, texObj); } diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 44357fbd6a3..8ca912b3a9d 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -934,7 +934,6 @@ make_2d_stack_mipmap(const struct gl_texture_format *format, GLint border, */ void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj) { const struct gl_texture_image *srcImage; diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h index df786032838..46e16902c86 100644 --- a/src/mesa/main/mipmap.h +++ b/src/mesa/main/mipmap.h @@ -30,7 +30,6 @@ extern void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c8718a7f636..04da767ec91 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1544,19 +1544,17 @@ struct gl_texture_unit /*@}*/ }; -struct texenvprog_cache_item { - GLuint hash; - void *key; - struct gl_fragment_program *data; - struct texenvprog_cache_item *next; -}; -struct texenvprog_cache { +struct texenvprog_cache_item; + +struct texenvprog_cache +{ struct texenvprog_cache_item **items; GLuint size, n_items; GLcontext *ctx; }; + /** * Texture attribute group (GL_TEXTURE_BIT). */ @@ -1865,6 +1863,7 @@ enum register_file /** Vertex and fragment instructions */ struct prog_instruction; struct gl_program_parameter_list; +struct gl_uniform_list; /** @@ -1884,6 +1883,7 @@ struct gl_program GLbitfield InputsRead; /**< Bitmask of which input regs are read */ GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */ GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ + GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */ GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */ /** Named parameters, constants, etc. from program text */ @@ -1896,6 +1896,11 @@ struct gl_program /** Vertex program user-defined attributes */ struct gl_program_parameter_list *Attributes; + /** Map from sampler unit to texture unit (set by glUniform1i()) */ + GLubyte SamplerUnits[MAX_SAMPLERS]; + /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */ + GLubyte SamplerTargets[MAX_SAMPLERS]; + /** Logical counts */ /*@{*/ GLuint NumInstructions; @@ -2088,7 +2093,7 @@ struct gl_query_state /** - * A GLSL shader object. + * A GLSL vertex or fragment shader object. */ struct gl_shader { @@ -2106,7 +2111,8 @@ struct gl_shader /** - * A GLSL program object. Basically a linked collection of "shaders". + * A GLSL program object. + * Basically a linked collection of vertex and fragment shaders. */ struct gl_shader_program { @@ -2121,7 +2127,7 @@ struct gl_shader_program /* post-link info: */ struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ - struct gl_program_parameter_list *Uniforms; /**< Plus constants, etc */ + struct gl_uniform_list *Uniforms; struct gl_program_parameter_list *Varying; struct gl_program_parameter_list *Attributes; /**< Vertex attributes */ GLboolean LinkStatus; /**< GL_LINK_STATUS */ @@ -2185,10 +2191,10 @@ struct gl_shared_state /*@{*/ struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */ #if FEATURE_ARB_vertex_program - struct gl_program *DefaultVertexProgram; + struct gl_vertex_program *DefaultVertexProgram; #endif #if FEATURE_ARB_fragment_program - struct gl_program *DefaultFragmentProgram; + struct gl_fragment_program *DefaultFragmentProgram; #endif /*@}*/ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 5ff67b654e8..1c73c5c462b 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -978,50 +978,60 @@ update_program(GLcontext *ctx) * 3. Programs derived from fixed-function state. */ - ctx->FragmentProgram._Current = NULL; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); if (shProg && shProg->LinkStatus) { /* Use shader programs */ /* XXX this isn't quite right, since we may have either a vertex * _or_ fragment shader (not always both). */ - ctx->VertexProgram._Current = shProg->VertexProgram; - ctx->FragmentProgram._Current = shProg->FragmentProgram; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + shProg->VertexProgram); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + shProg->FragmentProgram); } else { if (ctx->VertexProgram._Enabled) { /* use user-defined vertex program */ - ctx->VertexProgram._Current = ctx->VertexProgram.Current; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + ctx->VertexProgram.Current); } else if (ctx->VertexProgram._MaintainTnlProgram) { /* Use vertex program generated from fixed-function state. * The _Current pointer will get set in * _tnl_UpdateFixedFunctionProgram() later if appropriate. */ - ctx->VertexProgram._Current = NULL; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); } else { /* no vertex program */ - ctx->VertexProgram._Current = NULL; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); } if (ctx->FragmentProgram._Enabled) { /* use user-defined vertex program */ - ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + ctx->FragmentProgram.Current); } else if (ctx->FragmentProgram._MaintainTexEnvProgram) { /* Use fragment program generated from fixed-function state. * The _Current pointer will get set in _mesa_UpdateTexEnvProgram() * later if appropriate. */ - ctx->FragmentProgram._Current = NULL; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); } else { /* no fragment program */ - ctx->FragmentProgram._Current = NULL; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); } } + if (ctx->VertexProgram._Current) + assert(ctx->VertexProgram._Current->Base.Parameters); + if (ctx->FragmentProgram._Current) + assert(ctx->FragmentProgram._Current->Base.Parameters); + + ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; if (ctx->FragmentProgram._MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) { diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index b6991f45ed8..45f344b0c52 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 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"), @@ -298,22 +298,17 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { /* * Define a 64-bit unsigned integer type and macros */ -#if defined(__GNUC__) && !defined(__cplusplus) +#ifdef GL_EXT_timer_query /* this extensions defines the GLuint64EXT type */ #define FX64_NATIVE 1 -#ifdef __MINGW32__ -typedef unsigned long Fx64; -#else -typedef unsigned long long Fx64; -#endif - +typedef GLuint64EXT Fx64; #define FX64_MOV32(a, b) a = b #define FX64_OR32(a, b) a |= b #define FX64_SHL(a, c) a <<= c -#else /* !__GNUC__ */ +#else /* !GL_EXT_timer_query */ #define FX64_NATIVE 0 @@ -335,7 +330,7 @@ typedef struct { } \ } while (0) -#endif /* !__GNUC__ */ +#endif /* !GL_EXT_timer_query */ #define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */ diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index fb68bf0720e..af19a38c42b 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -28,12 +28,23 @@ #include "glheader.h" #include "macros.h" #include "enums.h" +#include "shader/program.h" #include "shader/prog_parameter.h" #include "shader/prog_instruction.h" #include "shader/prog_print.h" #include "shader/prog_statevars.h" #include "texenvprogram.h" + +struct texenvprog_cache_item +{ + GLuint hash; + void *key; + struct gl_fragment_program *data; + struct texenvprog_cache_item *next; +}; + + /** * This MAX is probably a bit generous, but that's OK. There can be * up to four instructions per texture unit (TEX + 3 for combine), @@ -1133,7 +1144,7 @@ search_cache(const struct texenvprog_cache *cache, for (c = cache->items[hash % cache->size]; c; c = c->next) { if (c->hash == hash && memcmp(c->key, key, keysize) == 0) - return (struct gl_fragment_program *) c->data; + return c->data; } return NULL; @@ -1161,7 +1172,7 @@ static void rehash( struct texenvprog_cache *cache ) cache->size = size; } -static void clear_cache( struct texenvprog_cache *cache ) +static void clear_cache(GLcontext *ctx, struct texenvprog_cache *cache) { struct texenvprog_cache_item *c, *next; GLuint i; @@ -1170,8 +1181,7 @@ static void clear_cache( struct texenvprog_cache *cache ) for (c = cache->items[i]; c; c = next) { next = c->next; _mesa_free(c->key); - cache->ctx->Driver.DeleteProgram(cache->ctx, - (struct gl_program *) c->data); + _mesa_reference_fragprog(ctx, &c->data, NULL); _mesa_free(c); } cache->items[i] = NULL; @@ -1182,25 +1192,25 @@ static void clear_cache( struct texenvprog_cache *cache ) } -static void cache_item( struct texenvprog_cache *cache, +static void cache_item( GLcontext *ctx, + struct texenvprog_cache *cache, GLuint hash, const struct state_key *key, - void *data ) + struct gl_fragment_program *prog) { - struct texenvprog_cache_item *c - = (struct texenvprog_cache_item *) MALLOC(sizeof(*c)); + struct texenvprog_cache_item *c = CALLOC_STRUCT(texenvprog_cache_item); c->hash = hash; c->key = _mesa_malloc(sizeof(*key)); memcpy(c->key, key, sizeof(*key)); - c->data = (struct gl_fragment_program *) data; + c->data = prog; if (cache->n_items > cache->size * 1.5) { if (cache->size < 1000) rehash(cache); else - clear_cache(cache); + clear_cache(ctx, cache); } cache->n_items++; @@ -1243,32 +1253,30 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) /* If a conventional fragment program/shader isn't in effect... */ if (!ctx->FragmentProgram._Enabled && (!ctx->Shader.CurrentProgram || !ctx->Shader.CurrentProgram->FragmentProgram)) { + struct gl_fragment_program *newProg; + make_state_key(ctx, &key); hash = hash_key(&key); - ctx->FragmentProgram._Current = - ctx->FragmentProgram._TexEnvProgram = - search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key)); + newProg = search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key)); + + if (!newProg) { + /* create new tex env program */ - if (!ctx->FragmentProgram._TexEnvProgram) { if (0) _mesa_printf("Building new texenv proggy for key %x\n", hash); - /* create new tex env program */ - ctx->FragmentProgram._Current = - ctx->FragmentProgram._TexEnvProgram = - (struct gl_fragment_program *) + newProg = (struct gl_fragment_program *) ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); - create_new_program(ctx, &key, ctx->FragmentProgram._TexEnvProgram); + create_new_program(ctx, &key, newProg); - cache_item(&ctx->Texture.env_fp_cache, hash, &key, - ctx->FragmentProgram._TexEnvProgram); - } - else { - if (0) - _mesa_printf("Found existing texenv program for key %x\n", hash); + /* Our ownership of newProg is transferred to the cache */ + cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, newProg); } + + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, newProg); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, newProg); } else { /* _Current pointer has been updated in update_program */ @@ -1298,6 +1306,6 @@ void _mesa_TexEnvProgramCacheInit( GLcontext *ctx ) void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ) { - clear_cache(&ctx->Texture.env_fp_cache); + clear_cache(ctx, &ctx->Texture.env_fp_cache); _mesa_free(ctx->Texture.env_fp_cache.items); } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 90edca86e83..5363e9e0801 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2918,9 +2918,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3004,9 +3002,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3080,9 +3076,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3128,9 +3122,7 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3183,9 +3175,7 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3238,9 +3228,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3314,9 +3302,7 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); @@ -3426,9 +3412,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 9229077f42c..2f459e517a5 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 1 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.1" +#define MESA_VERSION_STRING "7.1 rc1" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 74004e9b137..60aaabe679f 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3851,8 +3851,11 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, program->Base.NumNativeTexIndirections = ap.Base.NumTexIndirections; program->Base.InputsRead = ap.Base.InputsRead; program->Base.OutputsWritten = ap.Base.OutputsWritten; - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) { program->Base.TexturesUsed[i] = ap.TexturesUsed[i]; + if (ap.TexturesUsed[i]) + program->Base.SamplersUsed |= (1 << i); + } program->Base.ShadowSamplers = ap.ShadowSamplers; program->FogOption = ap.FogOption; program->UsesKill = ap.UsesKill; diff --git a/src/mesa/shader/descrip.mms b/src/mesa/shader/descrip.mms index 157c193c792..bdac946efe2 100644 --- a/src/mesa/shader/descrip.mms +++ b/src/mesa/shader/descrip.mms @@ -1,6 +1,6 @@ # Makefile for core library for VMS # contributed by Jouk Jansen [email protected] -# Last revision : 3 October 2007 +# Last revision : 27 May 2008 .first define gl [---.include.gl] define math [-.math] @@ -35,7 +35,7 @@ SOURCES = \ prog_parameter.c \ prog_print.c \ prog_statevars.c \ - shader_api.c + shader_api.c prog_uniform.c OBJECTS = \ atifragshader.obj,\ @@ -52,7 +52,7 @@ OBJECTS = \ prog_parameter.obj,\ prog_print.obj,\ prog_statevars.obj,\ - shader_api.obj + shader_api.obj,prog_uniform.obj ##### RULES ##### @@ -90,3 +90,4 @@ prog_parameter.obj : prog_parameter.c prog_print.obj : prog_print.c prog_statevars.obj : prog_statevars.c shader_api.obj : shader_api.c +prog_uniform.obj : prog_uniform.c diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index cb17aa501ce..8ce2ca39641 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -310,6 +310,8 @@ fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lodBias, GLfloat color[4]) { + const GLuint unit = machine->Samplers[inst->TexSrcUnit]; + /* Note: we only have the right derivatives for fragment input attribs. */ if (machine->NumDeriv > 0 && @@ -320,12 +322,10 @@ fetch_texel(GLcontext *ctx, machine->FetchTexelDeriv(ctx, texcoord, machine->DerivX[attr], machine->DerivY[attr], - lodBias, - inst->TexSrcUnit, color); + lodBias, unit, color); } else { - machine->FetchTexelLod(ctx, texcoord, lodBias, - inst->TexSrcUnit, color); + machine->FetchTexelLod(ctx, texcoord, lodBias, unit, color); } } @@ -1522,9 +1522,7 @@ _mesa_execute_program(GLcontext * ctx, default: _mesa_problem(ctx, "Bad opcode %d in _mesa_execute_program", inst->Opcode); - assert(0); return GL_TRUE; /* return value doesn't matter */ - } numExec++; diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/shader/prog_execute.h index 3ea0ba1565c..18b13e11a41 100644 --- a/src/mesa/shader/prog_execute.h +++ b/src/mesa/shader/prog_execute.h @@ -63,6 +63,8 @@ struct gl_program_machine GLuint CondCodes[4]; /**< COND_* value for x/y/z/w */ GLint AddressReg[MAX_PROGRAM_ADDRESS_REGS][4]; + const GLubyte *Samplers; /** Array mapping sampler var to tex unit */ + GLuint CallStack[MAX_PROGRAM_CALL_DEPTH]; /**< For CAL/RET instructions */ GLuint StackDepth; /**< Index/ptr to top of CallStack[] */ diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index d6b5652a276..bea5d0551e4 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -119,6 +119,23 @@ _mesa_copy_instructions(struct prog_instruction *dest, /** + * Free an array of instructions + */ +void +_mesa_free_instructions(struct prog_instruction *inst, GLuint count) +{ + GLuint i; + for (i = 0; i < count; i++) { + if (inst[i].Data) + _mesa_free(inst[i].Data); + if (inst[i].Comment) + _mesa_free((char *) inst[i].Comment); + } + _mesa_free(inst); +} + + +/** * Basic info about each instruction */ struct instruction_info @@ -126,6 +143,7 @@ struct instruction_info gl_inst_opcode Opcode; const char *Name; GLuint NumSrcRegs; + GLuint NumDstRegs; }; /** @@ -133,91 +151,91 @@ struct instruction_info * \note Opcode should equal array index! */ static const struct instruction_info InstInfo[MAX_OPCODE] = { - { OPCODE_NOP, "NOP", 0 }, - { OPCODE_ABS, "ABS", 1 }, - { OPCODE_ADD, "ADD", 2 }, - { OPCODE_ARA, "ARA", 1 }, - { OPCODE_ARL, "ARL", 1 }, - { OPCODE_ARL_NV, "ARL", 1 }, - { OPCODE_ARR, "ARL", 1 }, - { OPCODE_BGNLOOP,"BGNLOOP", 0 }, - { OPCODE_BGNSUB, "BGNSUB", 0 }, - { OPCODE_BRA, "BRA", 0 }, - { OPCODE_BRK, "BRK", 0 }, - { OPCODE_CAL, "CAL", 0 }, - { OPCODE_CMP, "CMP", 3 }, - { OPCODE_CONT, "CONT", 0 }, - { OPCODE_COS, "COS", 1 }, - { OPCODE_DDX, "DDX", 1 }, - { OPCODE_DDY, "DDY", 1 }, - { OPCODE_DP3, "DP3", 2 }, - { OPCODE_DP4, "DP4", 2 }, - { OPCODE_DPH, "DPH", 2 }, - { OPCODE_DST, "DST", 2 }, - { OPCODE_ELSE, "ELSE", 0 }, - { OPCODE_END, "END", 0 }, - { OPCODE_ENDIF, "ENDIF", 0 }, - { OPCODE_ENDLOOP,"ENDLOOP", 0 }, - { OPCODE_ENDSUB, "ENDSUB", 0 }, - { OPCODE_EX2, "EX2", 1 }, - { OPCODE_EXP, "EXP", 1 }, - { OPCODE_FLR, "FLR", 1 }, - { OPCODE_FRC, "FRC", 1 }, - { OPCODE_IF, "IF", 0 }, - { OPCODE_INT, "INT", 1 }, - { OPCODE_KIL, "KIL", 1 }, - { OPCODE_KIL_NV, "KIL", 0 }, - { OPCODE_LG2, "LG2", 1 }, - { OPCODE_LIT, "LIT", 1 }, - { OPCODE_LOG, "LOG", 1 }, - { OPCODE_LRP, "LRP", 3 }, - { OPCODE_MAD, "MAD", 3 }, - { OPCODE_MAX, "MAX", 2 }, - { OPCODE_MIN, "MIN", 2 }, - { OPCODE_MOV, "MOV", 1 }, - { OPCODE_MUL, "MUL", 2 }, - { OPCODE_NOISE1, "NOISE1", 1 }, - { OPCODE_NOISE2, "NOISE2", 1 }, - { OPCODE_NOISE3, "NOISE3", 1 }, - { OPCODE_NOISE4, "NOISE4", 1 }, - { OPCODE_PK2H, "PK2H", 1 }, - { OPCODE_PK2US, "PK2US", 1 }, - { OPCODE_PK4B, "PK4B", 1 }, - { OPCODE_PK4UB, "PK4UB", 1 }, - { OPCODE_POW, "POW", 2 }, - { OPCODE_POPA, "POPA", 0 }, - { OPCODE_PRINT, "PRINT", 1 }, - { OPCODE_PUSHA, "PUSHA", 0 }, - { OPCODE_RCC, "RCC", 1 }, - { OPCODE_RCP, "RCP", 1 }, - { OPCODE_RET, "RET", 0 }, - { OPCODE_RFL, "RFL", 1 }, - { OPCODE_RSQ, "RSQ", 1 }, - { OPCODE_SCS, "SCS", 1 }, - { OPCODE_SEQ, "SEQ", 2 }, - { OPCODE_SFL, "SFL", 0 }, - { OPCODE_SGE, "SGE", 2 }, - { OPCODE_SGT, "SGT", 2 }, - { OPCODE_SIN, "SIN", 1 }, - { OPCODE_SLE, "SLE", 2 }, - { OPCODE_SLT, "SLT", 2 }, - { OPCODE_SNE, "SNE", 2 }, - { OPCODE_SSG, "SSG", 1 }, - { OPCODE_STR, "STR", 0 }, - { OPCODE_SUB, "SUB", 2 }, - { OPCODE_SWZ, "SWZ", 1 }, - { OPCODE_TEX, "TEX", 1 }, - { OPCODE_TXB, "TXB", 1 }, - { OPCODE_TXD, "TXD", 3 }, - { OPCODE_TXL, "TXL", 1 }, - { OPCODE_TXP, "TXP", 1 }, - { OPCODE_TXP_NV, "TXP", 1 }, - { OPCODE_UP2H, "UP2H", 1 }, - { OPCODE_UP2US, "UP2US", 1 }, - { OPCODE_UP4B, "UP4B", 1 }, - { OPCODE_UP4UB, "UP4UB", 1 }, - { OPCODE_X2D, "X2D", 3 }, - { OPCODE_XPD, "XPD", 2 } + { OPCODE_NOP, "NOP", 0, 0 }, + { OPCODE_ABS, "ABS", 1, 1 }, + { OPCODE_ADD, "ADD", 2, 1 }, + { OPCODE_ARA, "ARA", 1, 1 }, + { OPCODE_ARL, "ARL", 1, 1 }, + { OPCODE_ARL_NV, "ARL", 1, 1 }, + { OPCODE_ARR, "ARL", 1, 1 }, + { OPCODE_BGNLOOP,"BGNLOOP", 0, 0 }, + { OPCODE_BGNSUB, "BGNSUB", 0, 0 }, + { OPCODE_BRA, "BRA", 0, 0 }, + { OPCODE_BRK, "BRK", 0, 0 }, + { OPCODE_CAL, "CAL", 0, 0 }, + { OPCODE_CMP, "CMP", 3, 1 }, + { OPCODE_CONT, "CONT", 0, 0 }, + { OPCODE_COS, "COS", 1, 1 }, + { OPCODE_DDX, "DDX", 1, 1 }, + { OPCODE_DDY, "DDY", 1, 1 }, + { OPCODE_DP3, "DP3", 2, 1 }, + { OPCODE_DP4, "DP4", 2, 1 }, + { OPCODE_DPH, "DPH", 2, 1 }, + { OPCODE_DST, "DST", 2, 1 }, + { OPCODE_ELSE, "ELSE", 0, 0 }, + { OPCODE_END, "END", 0, 0 }, + { OPCODE_ENDIF, "ENDIF", 0, 0 }, + { OPCODE_ENDLOOP,"ENDLOOP", 0, 0 }, + { OPCODE_ENDSUB, "ENDSUB", 0, 0 }, + { OPCODE_EX2, "EX2", 1, 1 }, + { OPCODE_EXP, "EXP", 1, 1 }, + { OPCODE_FLR, "FLR", 1, 1 }, + { OPCODE_FRC, "FRC", 1, 1 }, + { OPCODE_IF, "IF", 1, 0 }, + { OPCODE_INT, "INT", 1, 1 }, + { OPCODE_KIL, "KIL", 1, 0 }, + { OPCODE_KIL_NV, "KIL", 0, 0 }, + { OPCODE_LG2, "LG2", 1, 1 }, + { OPCODE_LIT, "LIT", 1, 1 }, + { OPCODE_LOG, "LOG", 1, 1 }, + { OPCODE_LRP, "LRP", 3, 1 }, + { OPCODE_MAD, "MAD", 3, 1 }, + { OPCODE_MAX, "MAX", 2, 1 }, + { OPCODE_MIN, "MIN", 2, 1 }, + { OPCODE_MOV, "MOV", 1, 1 }, + { OPCODE_MUL, "MUL", 2, 1 }, + { OPCODE_NOISE1, "NOISE1", 1, 1 }, + { OPCODE_NOISE2, "NOISE2", 1, 1 }, + { OPCODE_NOISE3, "NOISE3", 1, 1 }, + { OPCODE_NOISE4, "NOISE4", 1, 1 }, + { OPCODE_PK2H, "PK2H", 1, 1 }, + { OPCODE_PK2US, "PK2US", 1, 1 }, + { OPCODE_PK4B, "PK4B", 1, 1 }, + { OPCODE_PK4UB, "PK4UB", 1, 1 }, + { OPCODE_POW, "POW", 2, 1 }, + { OPCODE_POPA, "POPA", 0, 0 }, + { OPCODE_PRINT, "PRINT", 1, 0 }, + { OPCODE_PUSHA, "PUSHA", 0, 0 }, + { OPCODE_RCC, "RCC", 1, 1 }, + { OPCODE_RCP, "RCP", 1, 1 }, + { OPCODE_RET, "RET", 0, 0 }, + { OPCODE_RFL, "RFL", 1, 1 }, + { OPCODE_RSQ, "RSQ", 1, 1 }, + { OPCODE_SCS, "SCS", 1, 1 }, + { OPCODE_SEQ, "SEQ", 2, 1 }, + { OPCODE_SFL, "SFL", 0, 1 }, + { OPCODE_SGE, "SGE", 2, 1 }, + { OPCODE_SGT, "SGT", 2, 1 }, + { OPCODE_SIN, "SIN", 1, 1 }, + { OPCODE_SLE, "SLE", 2, 1 }, + { OPCODE_SLT, "SLT", 2, 1 }, + { OPCODE_SNE, "SNE", 2, 1 }, + { OPCODE_SSG, "SSG", 1, 1 }, + { OPCODE_STR, "STR", 0, 1 }, + { OPCODE_SUB, "SUB", 2, 1 }, + { OPCODE_SWZ, "SWZ", 1, 1 }, + { OPCODE_TEX, "TEX", 1, 1 }, + { OPCODE_TXB, "TXB", 1, 1 }, + { OPCODE_TXD, "TXD", 3, 1 }, + { OPCODE_TXL, "TXL", 1, 1 }, + { OPCODE_TXP, "TXP", 1, 1 }, + { OPCODE_TXP_NV, "TXP", 1, 1 }, + { OPCODE_UP2H, "UP2H", 1, 1 }, + { OPCODE_UP2US, "UP2US", 1, 1 }, + { OPCODE_UP4B, "UP4B", 1, 1 }, + { OPCODE_UP4UB, "UP4UB", 1, 1 }, + { OPCODE_X2D, "X2D", 3, 1 }, + { OPCODE_XPD, "XPD", 2, 1 } }; @@ -234,6 +252,29 @@ _mesa_num_inst_src_regs(gl_inst_opcode opcode) /** + * Return the number of dst registers for the given instruction/opcode. + */ +GLuint +_mesa_num_inst_dst_regs(gl_inst_opcode opcode) +{ + ASSERT(opcode == InstInfo[opcode].Opcode); + ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode); + return InstInfo[opcode].NumDstRegs; +} + + +GLboolean +_mesa_is_tex_instruction(gl_inst_opcode opcode) +{ + return (opcode == OPCODE_TEX || + opcode == OPCODE_TXB || + opcode == OPCODE_TXD || + opcode == OPCODE_TXL || + opcode == OPCODE_TXP); +} + + +/** * Return string name for given program opcode. */ const char * diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index c800757aa0f..aca768376a2 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -437,9 +437,18 @@ extern struct prog_instruction * _mesa_copy_instructions(struct prog_instruction *dest, const struct prog_instruction *src, GLuint n); +extern void +_mesa_free_instructions(struct prog_instruction *inst, GLuint count); + extern GLuint _mesa_num_inst_src_regs(gl_inst_opcode opcode); +extern GLuint +_mesa_num_inst_dst_regs(gl_inst_opcode opcode); + +extern GLboolean +_mesa_is_tex_instruction(gl_inst_opcode opcode); + extern const char * _mesa_opcode_string(gl_inst_opcode opcode); diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 3ad7215755d..152bd79f695 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -282,6 +282,8 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, * Add a sampler to the parameter list. * \param name uniform's name * \param datatype GL_SAMPLER_2D, GL_SAMPLER_2D_RECT_ARB, etc. + * \param index the sampler number (as seen in TEX instructions) + * \return sampler index (starting at zero) or -1 if error */ GLint _mesa_add_sampler(struct gl_program_parameter_list *paramList, @@ -292,13 +294,20 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList, ASSERT(paramList->Parameters[i].Size == 1); ASSERT(paramList->Parameters[i].DataType == datatype); /* already in list */ - return i; + return (GLint) paramList->ParameterValues[i][0]; } else { const GLint size = 1; /* a sampler is basically a texture unit number */ - i = _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name, - size, datatype, NULL, NULL); - return i; + GLfloat value; + GLint numSamplers = 0; + for (i = 0; i < paramList->NumParameters; i++) { + if (paramList->Parameters[i].Type == PROGRAM_SAMPLER) + numSamplers++; + } + value = (GLfloat) numSamplers; + (void) _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name, + size, datatype, &value, NULL); + return numSamplers; } } @@ -599,11 +608,46 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list) } } + clone->StateFlags = list->StateFlags; + return clone; } /** + * Return a new parameter list which is listA + listB. + */ +struct gl_program_parameter_list * +_mesa_combine_parameter_lists(const struct gl_program_parameter_list *listA, + const struct gl_program_parameter_list *listB) +{ + struct gl_program_parameter_list *list; + + if (listA) { + list = _mesa_clone_parameter_list(listA); + if (list && listB) { + GLuint i; + for (i = 0; i < listB->NumParameters; i++) { + struct gl_program_parameter *param = listB->Parameters + i; + _mesa_add_parameter(list, param->Type, param->Name, param->Size, + param->DataType, + listB->ParameterValues[i], + param->StateIndexes); + } + } + } + else if (listB) { + list = _mesa_clone_parameter_list(listB); + } + else { + list = NULL; + } + return list; +} + + + +/** * Find longest name of all uniform parameters in list. */ GLuint diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index 09ff851ea73..105f6f24deb 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -78,6 +78,16 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList); extern struct gl_program_parameter_list * _mesa_clone_parameter_list(const struct gl_program_parameter_list *list); +extern struct gl_program_parameter_list * +_mesa_combine_parameter_lists(const struct gl_program_parameter_list *a, + const struct gl_program_parameter_list *b); + +static INLINE GLuint +_mesa_num_parameters(const struct gl_program_parameter_list *list) +{ + return list ? list->NumParameters : 0; +} + extern GLint _mesa_add_parameter(struct gl_program_parameter_list *paramList, enum register_file type, const char *name, diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 308cce2206c..1c35ce3fecf 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -320,7 +320,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) if (!extended) s[i++] = '.'; - if (negateBase & 0x1) + if (negateBase & NEGATE_X) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 0)]; @@ -328,7 +328,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & 0x2) + if (negateBase & NEGATE_Y) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 1)]; @@ -336,7 +336,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & 0x4) + if (negateBase & NEGATE_Z) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 2)]; @@ -344,7 +344,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & 0x8) + if (negateBase & NEGATE_W) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 3)]; @@ -541,7 +541,7 @@ _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, _mesa_printf("_SAT"); _mesa_printf(" "); print_dst_reg(&inst->DstReg, mode, prog); - _mesa_printf("%s[%d], %s", + _mesa_printf(", %s[%d], %s", file_string((enum register_file) inst->SrcReg[0].File, mode), inst->SrcReg[0].Index, @@ -551,6 +551,7 @@ _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, break; case OPCODE_TEX: case OPCODE_TXP: + case OPCODE_TXL: case OPCODE_TXB: _mesa_printf("%s", _mesa_opcode_string(inst->Opcode)); if (inst->SaturateMode == SATURATE_ZERO_ONE) @@ -571,6 +572,23 @@ _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, } print_comment(inst); break; + + case OPCODE_KIL: + _mesa_printf("%s", _mesa_opcode_string(inst->Opcode)); + _mesa_printf(" "); + print_src_reg(&inst->SrcReg[0], mode, prog); + print_comment(inst); + break; + case OPCODE_KIL_NV: + _mesa_printf("%s", _mesa_opcode_string(inst->Opcode)); + _mesa_printf(" "); + _mesa_printf("%s.%s", + _mesa_condcode_string(inst->DstReg.CondMask), + _mesa_swizzle_string(inst->DstReg.CondSwizzle, + GL_FALSE, GL_FALSE)); + print_comment(inst); + break; + case OPCODE_ARL: _mesa_printf("ARL addr.x, "); print_src_reg(&inst->SrcReg[0], mode, prog); @@ -735,6 +753,8 @@ _mesa_print_program_opt(const struct gl_program *prog, void _mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) { + GLuint i; + _mesa_printf("InputsRead: 0x%x\n", prog->InputsRead); _mesa_printf("OutputsWritten: 0x%x\n", prog->OutputsWritten); _mesa_printf("NumInstructions=%d\n", prog->NumInstructions); @@ -742,9 +762,14 @@ _mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) _mesa_printf("NumParameters=%d\n", prog->NumParameters); _mesa_printf("NumAttributes=%d\n", prog->NumAttributes); _mesa_printf("NumAddressRegs=%d\n", prog->NumAddressRegs); - + _mesa_printf("Samplers=[ "); + for (i = 0; i < MAX_SAMPLERS; i++) { + _mesa_printf("%d ", prog->SamplerUnits[i]); + } + _mesa_printf("]\n"); + _mesa_load_state_parameters(ctx, prog->Parameters); - + #if 0 _mesa_printf("Local Params:\n"); for (i = 0; i < MAX_PROGRAM_LOCAL_PARAMS; i++){ @@ -762,6 +787,9 @@ _mesa_print_parameter_list(const struct gl_program_parameter_list *list) const gl_prog_print_mode mode = PROG_PRINT_DEBUG; GLuint i; + if (!list) + return; + _mesa_printf("param list %p\n", (void *) list); for (i = 0; i < list->NumParameters; i++){ struct gl_program_parameter *param = list->Parameters + i; diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 4ae74c1d42b..539057b4382 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -253,7 +253,8 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[0] = ctx->Fog.Density; value[1] = ctx->Fog.Start; value[2] = ctx->Fog.End; - value[3] = 1.0F / (ctx->Fog.End - ctx->Fog.Start); + value[3] = (ctx->Fog.End == ctx->Fog.Start) + ? 1.0 : 1.0F / (ctx->Fog.End - ctx->Fog.Start); return; case STATE_CLIPPLANE: { @@ -278,6 +279,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], case STATE_MVP_MATRIX: case STATE_TEXTURE_MATRIX: case STATE_PROGRAM_MATRIX: + case STATE_COLOR_MATRIX: { /* state[0] = modelview, projection, texture, etc. */ /* state[1] = which texture matrix or program matrix */ @@ -311,6 +313,9 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], else if (mat == STATE_PROGRAM_MATRIX) { matrix = ctx->ProgramMatrixStack[index].Top; } + else if (mat == STATE_COLOR_MATRIX) { + matrix = ctx->ColorMatrixStack.Top; + } else { _mesa_problem(ctx, "Bad matrix name in _mesa_fetch_state()"); return; @@ -420,8 +425,9 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], * exp: 2^-(density/ln(2) * fogcoord) * exp2: 2^-((density/(ln(2)^2) * fogcoord)^2) */ - value[0] = -1.0F / (ctx->Fog.End - ctx->Fog.Start); - value[1] = ctx->Fog.End / (ctx->Fog.End - ctx->Fog.Start); + value[0] = (ctx->Fog.End == ctx->Fog.Start) + ? 1.0 : -1.0F / (ctx->Fog.End - ctx->Fog.Start); + value[1] = ctx->Fog.End * -value[0]; value[2] = ctx->Fog.Density * ONE_DIV_LN2; value[3] = ctx->Fog.Density * ONE_DIV_SQRT_LN2; return; @@ -434,6 +440,24 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[3] = ctx->Light.Light[ln]._CosCutoff; return; } + case STATE_PT_SCALE: + value[0] = ctx->Pixel.RedScale; + value[1] = ctx->Pixel.GreenScale; + value[2] = ctx->Pixel.BlueScale; + value[3] = ctx->Pixel.AlphaScale; + break; + case STATE_PT_BIAS: + value[0] = ctx->Pixel.RedBias; + value[1] = ctx->Pixel.GreenBias; + value[2] = ctx->Pixel.BlueBias; + value[3] = ctx->Pixel.AlphaBias; + break; + case STATE_PCM_SCALE: + COPY_4V(value, ctx->Pixel.PostColorMatrixScale); + break; + case STATE_PCM_BIAS: + COPY_4V(value, ctx->Pixel.PostColorMatrixBias); + break; default: /* unknown state indexes are silently ignored * should be handled by the driver. @@ -492,6 +516,8 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) return _NEW_TEXTURE_MATRIX; case STATE_PROGRAM_MATRIX: return _NEW_TRACK_MATRIX; + case STATE_COLOR_MATRIX: + return _NEW_COLOR_MATRIX; case STATE_DEPTH_RANGE: return _NEW_VIEWPORT; @@ -585,6 +611,9 @@ append_token(char *dst, gl_state_index k) case STATE_PROGRAM_MATRIX: append(dst, "matrix.program"); break; + case STATE_COLOR_MATRIX: + append(dst, "matrix.color"); + break; case STATE_MATRIX_INVERSE: append(dst, ".inverse"); break; @@ -670,6 +699,18 @@ append_token(char *dst, gl_state_index k) case STATE_POSITION_NORMALIZED: append(dst, "(internal)"); break; + case STATE_PT_SCALE: + append(dst, "PTscale"); + break; + case STATE_PT_BIAS: + append(dst, "PTbias"); + break; + case STATE_PCM_SCALE: + append(dst, "PCMscale"); + break; + case STATE_PCM_BIAS: + append(dst, "PCMbias"); + break; default: ; } @@ -748,6 +789,7 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) case STATE_MVP_MATRIX: case STATE_TEXTURE_MATRIX: case STATE_PROGRAM_MATRIX: + case STATE_COLOR_MATRIX: { /* state[0] = modelview, projection, texture, etc. */ /* state[1] = which texture matrix or program matrix */ @@ -815,10 +857,12 @@ _mesa_load_state_parameters(GLcontext *ctx, if (!paramList) return; + /*assert(ctx->Driver.NeedFlush == 0);*/ + for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) { _mesa_fetch_state(ctx, - paramList->Parameters[i].StateIndexes, + (gl_state_index *) paramList->Parameters[i].StateIndexes, paramList->ParameterValues[i]); } } diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h index 22bb8e07ad1..64820a5b681 100644 --- a/src/mesa/shader/prog_statevars.h +++ b/src/mesa/shader/prog_statevars.h @@ -67,6 +67,7 @@ typedef enum gl_state_index_ { STATE_MVP_MATRIX, STATE_TEXTURE_MATRIX, STATE_PROGRAM_MATRIX, + STATE_COLOR_MATRIX, STATE_MATRIX_INVERSE, STATE_MATRIX_TRANSPOSE, STATE_MATRIX_INVTRANS, @@ -108,6 +109,10 @@ typedef enum gl_state_index_ { STATE_POSITION_NORMALIZED, /* normalized light position */ STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ STATE_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ + STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ + STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ + STATE_PCM_SCALE, /**< Post color matrix RGBA scale */ + STATE_PCM_BIAS, /**< Post color matrix RGBA bias */ STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */ } gl_state_index; diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/shader/prog_uniform.c new file mode 100644 index 00000000000..20e004b350c --- /dev/null +++ b/src/mesa/shader/prog_uniform.c @@ -0,0 +1,157 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 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 prog_uniform.c + * Shader uniform functions. + * \author Brian Paul + */ + +#include "main/imports.h" +#include "main/mtypes.h" +#include "prog_uniform.h" + + +struct gl_uniform_list * +_mesa_new_uniform_list(void) +{ + return CALLOC_STRUCT(gl_uniform_list); +} + + +void +_mesa_free_uniform_list(struct gl_uniform_list *list) +{ + GLuint i; + for (i = 0; i < list->NumUniforms; i++) { + _mesa_free((void *) list->Uniforms[i].Name); + } + _mesa_free(list->Uniforms); + _mesa_free(list); +} + + +GLboolean +_mesa_append_uniform(struct gl_uniform_list *list, + const char *name, GLenum target, GLuint progPos) +{ + const GLuint oldNum = list->NumUniforms; + GLint index; + + assert(target == GL_VERTEX_PROGRAM_ARB || + target == GL_FRAGMENT_PROGRAM_ARB); + + index = _mesa_lookup_uniform(list, name); + if (index < 0) { + /* not found - append to list */ + + if (oldNum + 1 > list->Size) { + /* Need to grow the list array (alloc some extra) */ + list->Size += 4; + + /* realloc arrays */ + list->Uniforms = (struct gl_uniform *) + _mesa_realloc(list->Uniforms, + oldNum * sizeof(struct gl_uniform), + list->Size * sizeof(struct gl_uniform)); + } + + if (!list->Uniforms) { + /* out of memory */ + list->NumUniforms = 0; + list->Size = 0; + return GL_FALSE; + } + + list->Uniforms[oldNum].Name = _mesa_strdup(name); + list->Uniforms[oldNum].VertPos = -1; + list->Uniforms[oldNum].FragPos = -1; + index = oldNum; + list->NumUniforms++; + } + + /* update position for the vertex or fragment program */ + if (target == GL_VERTEX_PROGRAM_ARB) { + if (list->Uniforms[index].VertPos != -1) { + /* this uniform is already in the list - that shouldn't happen */ + return GL_FALSE; + } + list->Uniforms[index].VertPos = progPos; + } + else { + if (list->Uniforms[index].FragPos != -1) { + /* this uniform is already in the list - that shouldn't happen */ + return GL_FALSE; + } + list->Uniforms[index].FragPos = progPos; + } + + return GL_TRUE; +} + + +/** + * Return the location/index of the named uniform in the uniform list, + * or -1 if not found. + */ +GLint +_mesa_lookup_uniform(const struct gl_uniform_list *list, const char *name) +{ + GLuint i; + for (i = 0; i < list->NumUniforms; i++) { + if (!_mesa_strcmp(list->Uniforms[i].Name, name)) { + return i; + } + } + return -1; +} + + +GLint +_mesa_longest_uniform_name(const struct gl_uniform_list *list) +{ + GLint max = 0; + GLuint i; + for (i = 0; i < list->NumUniforms; i++) { + GLuint len = _mesa_strlen(list->Uniforms[i].Name); + if (len > max) + max = len; + } + return max; +} + + +void +_mesa_print_uniforms(const struct gl_uniform_list *list) +{ + GLuint i; + printf("Uniform list %p:\n", (void *) list); + for (i = 0; i < list->NumUniforms; i++) { + printf("%d: %s %d %d\n", + i, + list->Uniforms[i].Name, + list->Uniforms[i].VertPos, + list->Uniforms[i].FragPos); + } +} diff --git a/src/mesa/shader/prog_uniform.h b/src/mesa/shader/prog_uniform.h new file mode 100644 index 00000000000..735de28705a --- /dev/null +++ b/src/mesa/shader/prog_uniform.h @@ -0,0 +1,91 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 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 prog_uniform.c + * Shader uniform functions. + * \author Brian Paul + */ + +#ifndef PROG_UNIFORM_H +#define PROG_UNIFORM_H + +#include "main/mtypes.h" +#include "prog_statevars.h" + + +/** + * Shader program uniform variable. + * The glGetUniformLocation() and glUniform() commands will use this + * information. + * Note that a uniform such as "binormal" might be used in both the + * vertex shader and the fragment shader. When glUniform() is called to + * set the uniform's value, it must be updated in both the vertex and + * fragment shaders. The uniform may be in different locations in the + * two shaders so we keep track of that here. + */ +struct gl_uniform +{ + const char *Name; /**< Null-terminated string */ + GLint VertPos; + GLint FragPos; +#if 0 + GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ + GLuint Size; /**< Number of components (1..4) */ +#endif +}; + + +/** + * List of gl_uniforms + */ +struct gl_uniform_list +{ + GLuint Size; /**< allocated size of Uniforms array */ + GLuint NumUniforms; /**< number of uniforms in the array */ + struct gl_uniform *Uniforms; /**< Array [Size] */ +}; + + +extern struct gl_uniform_list * +_mesa_new_uniform_list(void); + +extern void +_mesa_free_uniform_list(struct gl_uniform_list *list); + +extern GLboolean +_mesa_append_uniform(struct gl_uniform_list *list, + const char *name, GLenum target, GLuint progPos); + +extern GLint +_mesa_lookup_uniform(const struct gl_uniform_list *list, const char *name); + +extern GLint +_mesa_longest_uniform_name(const struct gl_uniform_list *list); + +extern void +_mesa_print_uniforms(const struct gl_uniform_list *list); + + +#endif /* PROG_UNIFORM_H */ diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index c539b527204..7048770cf74 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -59,9 +59,9 @@ _mesa_init_program(GLcontext *ctx) ctx->VertexProgram.Enabled = GL_FALSE; ctx->VertexProgram.PointSizeEnabled = GL_FALSE; ctx->VertexProgram.TwoSideEnabled = GL_FALSE; - ctx->VertexProgram.Current = (struct gl_vertex_program *) ctx->Shared->DefaultVertexProgram; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + ctx->Shared->DefaultVertexProgram); assert(ctx->VertexProgram.Current); - ctx->VertexProgram.Current->Base.RefCount++; for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { ctx->VertexProgram.TrackMatrix[i] = GL_NONE; ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; @@ -70,9 +70,9 @@ _mesa_init_program(GLcontext *ctx) #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program ctx->FragmentProgram.Enabled = GL_FALSE; - ctx->FragmentProgram.Current = (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + ctx->Shared->DefaultFragmentProgram); assert(ctx->FragmentProgram.Current); - ctx->FragmentProgram.Current->Base.RefCount++; #endif /* XXX probably move this stuff */ @@ -92,18 +92,10 @@ void _mesa_free_program_data(GLcontext *ctx) { #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program - if (ctx->VertexProgram.Current) { - ctx->VertexProgram.Current->Base.RefCount--; - if (ctx->VertexProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base)); - } + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL); #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program - if (ctx->FragmentProgram.Current) { - ctx->FragmentProgram.Current->Base.RefCount--; - if (ctx->FragmentProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base)); - } + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); #endif /* XXX probably move this stuff */ #if FEATURE_ATI_fragment_shader @@ -127,25 +119,17 @@ void _mesa_update_default_objects_program(GLcontext *ctx) { #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program - if (ctx->VertexProgram.Current) { - ctx->VertexProgram.Current->Base.RefCount--; - if (ctx->VertexProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base)); - } - ctx->VertexProgram.Current = (struct gl_vertex_program *) ctx->Shared->DefaultVertexProgram; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + (struct gl_vertex_program *) + ctx->Shared->DefaultVertexProgram); assert(ctx->VertexProgram.Current); - ctx->VertexProgram.Current->Base.RefCount++; #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program - if (ctx->FragmentProgram.Current) { - ctx->FragmentProgram.Current->Base.RefCount--; - if (ctx->FragmentProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base)); - } - ctx->FragmentProgram.Current = (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + (struct gl_fragment_program *) + ctx->Shared->DefaultFragmentProgram); assert(ctx->FragmentProgram.Current); - ctx->FragmentProgram.Current->Base.RefCount++; #endif /* XXX probably move this stuff */ @@ -230,11 +214,17 @@ _mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog, { (void) ctx; if (prog) { + GLuint i; + _mesa_bzero(prog, sizeof(*prog)); prog->Id = id; prog->Target = target; prog->Resident = GL_TRUE; prog->RefCount = 1; prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; + + /* default mapping from samplers to texture units */ + for (i = 0; i < MAX_SAMPLERS; i++) + prog->SamplerUnits[i] = i; } return prog; @@ -284,19 +274,23 @@ _mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog, struct gl_program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) { + struct gl_program *prog; switch (target) { case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - return _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), + prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), target, id ); + break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: - return _mesa_init_fragment_program(ctx, + prog =_mesa_init_fragment_program(ctx, CALLOC_STRUCT(gl_fragment_program), target, id ); + break; default: _mesa_problem(ctx, "bad target in _mesa_new_program"); - return NULL; + prog = NULL; } + return prog; } @@ -311,6 +305,7 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) { (void) ctx; ASSERT(prog); + ASSERT(prog->RefCount==0); if (prog == &_mesa_DummyProgram) return; @@ -318,16 +313,7 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) if (prog->String) _mesa_free(prog->String); - if (prog->Instructions) { - GLuint i; - for (i = 0; i < prog->NumInstructions; i++) { - if (prog->Instructions[i].Data) - _mesa_free(prog->Instructions[i].Data); - if (prog->Instructions[i].Comment) - _mesa_free((char *) prog->Instructions[i].Comment); - } - _mesa_free(prog->Instructions); - } + _mesa_free_instructions(prog->Instructions, prog->NumInstructions); if (prog->Parameters) { _mesa_free_parameter_list(prog->Parameters); @@ -366,6 +352,63 @@ _mesa_lookup_program(GLcontext *ctx, GLuint id) /** + * Reference counting for vertex/fragment programs + */ +void +_mesa_reference_program(GLcontext *ctx, + struct gl_program **ptr, + struct gl_program *prog) +{ + assert(ptr); + if (*ptr && prog) { + /* sanity check */ + ASSERT((*ptr)->Target == prog->Target); + } + if (*ptr == prog) { + return; /* no change */ + } + if (*ptr) { + GLboolean deleteFlag; + + /*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/ +#if 0 + printf("Program %p ID=%u Target=%s Refcount-- to %d\n", + *ptr, (*ptr)->Id, + ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : "FP"), + (*ptr)->RefCount - 1); +#endif + ASSERT((*ptr)->RefCount > 0); + (*ptr)->RefCount--; + + deleteFlag = ((*ptr)->RefCount == 0); + /*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/ + + if (deleteFlag) { + ASSERT(ctx); + ctx->Driver.DeleteProgram(ctx, *ptr); + } + + *ptr = NULL; + } + + assert(!*ptr); + if (prog) { + /*_glthread_LOCK_MUTEX(prog->Mutex);*/ + prog->RefCount++; +#if 0 + printf("Program %p ID=%u Target=%s Refcount++ to %d\n", + prog, prog->Id, + (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : "FP"), + prog->RefCount); +#endif + /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/ + } + + *ptr = prog; +} + + +/** * Return a copy of a program. * XXX Problem here if the program object is actually OO-derivation * made by a device driver. @@ -380,18 +423,20 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) return NULL; assert(clone->Target == prog->Target); + assert(clone->RefCount == 1); + clone->String = (GLubyte *) _mesa_strdup((char *) prog->String); - clone->RefCount = 1; clone->Format = prog->Format; clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions); if (!clone->Instructions) { - ctx->Driver.DeleteProgram(ctx, clone); + _mesa_reference_program(ctx, &clone, NULL); return NULL; } _mesa_copy_instructions(clone->Instructions, prog->Instructions, prog->NumInstructions); clone->InputsRead = prog->InputsRead; clone->OutputsWritten = prog->OutputsWritten; + clone->SamplersUsed = prog->SamplersUsed; memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed)); if (prog->Parameters) @@ -445,6 +490,236 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) } +/** + * Insert 'count' NOP instructions at 'start' in the given program. + * Adjust branch targets accordingly. + */ +GLboolean +_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count) +{ + const GLuint origLen = prog->NumInstructions; + const GLuint newLen = origLen + count; + struct prog_instruction *newInst; + GLuint i; + + /* adjust branches */ + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->BranchTarget > 0) { + if (inst->BranchTarget >= start) { + inst->BranchTarget += count; + } + } + } + + /* Alloc storage for new instructions */ + newInst = _mesa_alloc_instructions(newLen); + if (!newInst) { + return GL_FALSE; + } + + /* Copy 'start' instructions into new instruction buffer */ + _mesa_copy_instructions(newInst, prog->Instructions, start); + + /* init the new instructions */ + _mesa_init_instructions(newInst + start, count); + + /* Copy the remaining/tail instructions to new inst buffer */ + _mesa_copy_instructions(newInst + start + count, + prog->Instructions + start, + origLen - start); + + /* free old instructions */ + _mesa_free_instructions(prog->Instructions, origLen); + + /* install new instructions */ + prog->Instructions = newInst; + prog->NumInstructions = newLen; + + return GL_TRUE; +} + + +/** + * Search instructions for registers that match (oldFile, oldIndex), + * replacing them with (newFile, newIndex). + */ +static void +replace_registers(struct prog_instruction *inst, GLuint numInst, + GLuint oldFile, GLuint oldIndex, + GLuint newFile, GLuint newIndex) +{ + GLuint i, j; + for (i = 0; i < numInst; i++) { + /* src regs */ + for (j = 0; j < _mesa_num_inst_src_regs(inst->Opcode); j++) { + if (inst[i].SrcReg[j].File == oldFile && + inst[i].SrcReg[j].Index == oldIndex) { + inst[i].SrcReg[j].File = newFile; + inst[i].SrcReg[j].Index = newIndex; + } + } + /* dst reg */ + if (inst[i].DstReg.File == oldFile && inst[i].DstReg.Index == oldIndex) { + inst[i].DstReg.File = newFile; + inst[i].DstReg.Index = newIndex; + } + } +} + + +/** + * Search instructions for references to program parameters. When found, + * increment the parameter index by 'offset'. + * Used when combining programs. + */ +static void +adjust_param_indexes(struct prog_instruction *inst, GLuint numInst, + GLuint offset) +{ + GLuint i, j; + for (i = 0; i < numInst; i++) { + for (j = 0; j < _mesa_num_inst_src_regs(inst->Opcode); j++) { + GLuint f = inst[i].SrcReg[j].File; + if (f == PROGRAM_CONSTANT || + f == PROGRAM_UNIFORM || + f == PROGRAM_STATE_VAR) { + inst[i].SrcReg[j].Index += offset; + } + } + } +} + + +/** + * Combine two programs into one. Fix instructions so the outputs of + * the first program go to the inputs of the second program. + */ +struct gl_program * +_mesa_combine_programs(GLcontext *ctx, + const struct gl_program *progA, + const struct gl_program *progB) +{ + struct prog_instruction *newInst; + struct gl_program *newProg; + const GLuint lenA = progA->NumInstructions - 1; /* omit END instr */ + const GLuint lenB = progB->NumInstructions; + const GLuint numParamsA = _mesa_num_parameters(progA->Parameters); + const GLuint newLength = lenA + lenB; + GLbitfield inputsB; + GLuint i; + + ASSERT(progA->Target == progB->Target); + + newInst = _mesa_alloc_instructions(newLength); + if (!newInst) + return GL_FALSE; + + _mesa_copy_instructions(newInst, progA->Instructions, lenA); + _mesa_copy_instructions(newInst + lenA, progB->Instructions, lenB); + + /* adjust branch / instruction addresses for B's instructions */ + for (i = 0; i < lenB; i++) { + newInst[lenA + i].BranchTarget += lenA; + } + + newProg = ctx->Driver.NewProgram(ctx, progA->Target, 0); + newProg->Instructions = newInst; + newProg->NumInstructions = newLength; + + if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) { + struct gl_fragment_program *fprogA, *fprogB, *newFprog; + fprogA = (struct gl_fragment_program *) progA; + fprogB = (struct gl_fragment_program *) progB; + newFprog = (struct gl_fragment_program *) newProg; + + newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill; + + /* Connect color outputs of fprogA to color inputs of fprogB, via a + * new temporary register. + */ + if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) && + (progB->InputsRead & (1 << FRAG_ATTRIB_COL0))) { + GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY); + if (tempReg < 0) { + _mesa_problem(ctx, "No free temp regs found in " + "_mesa_combine_programs(), using 31"); + tempReg = 31; + } + /* replace writes to result.color[0] with tempReg */ + replace_registers(newInst, lenA, + PROGRAM_OUTPUT, FRAG_RESULT_COLR, + PROGRAM_TEMPORARY, tempReg); + /* replace reads from input.color[0] with tempReg */ + replace_registers(newInst + lenA, lenB, + PROGRAM_INPUT, FRAG_ATTRIB_COL0, + PROGRAM_TEMPORARY, tempReg); + } + + inputsB = progB->InputsRead; + if (progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) { + inputsB &= ~(1 << FRAG_ATTRIB_COL0); + } + newProg->InputsRead = progA->InputsRead | inputsB; + newProg->OutputsWritten = progB->OutputsWritten; + newProg->SamplersUsed = progA->SamplersUsed | progB->SamplersUsed; + } + else { + /* vertex program */ + assert(0); /* XXX todo */ + } + + /* + * Merge parameters (uniforms, constants, etc) + */ + newProg->Parameters = _mesa_combine_parameter_lists(progA->Parameters, + progB->Parameters); + + adjust_param_indexes(newInst + lenA, lenB, numParamsA); + + + return newProg; +} + + + + +/** + * Scan the given program to find a free register of the given type. + * \param regFile - PROGRAM_INPUT, PROGRAM_OUTPUT or PROGRAM_TEMPORARY + */ +GLint +_mesa_find_free_register(const struct gl_program *prog, GLuint regFile) +{ + GLboolean used[MAX_PROGRAM_TEMPS]; + GLuint i, k; + + assert(regFile == PROGRAM_INPUT || + regFile == PROGRAM_OUTPUT || + regFile == PROGRAM_TEMPORARY); + + _mesa_memset(used, 0, sizeof(used)); + + for (i = 0; i < prog->NumInstructions; i++) { + const struct prog_instruction *inst = prog->Instructions + i; + const GLuint n = _mesa_num_inst_src_regs(inst->Opcode); + + for (k = 0; k < n; k++) { + if (inst->SrcReg[k].File == regFile) { + used[inst->SrcReg[k].Index] = GL_TRUE; + } + } + } + + for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { + if (!used[i]) + return i; + } + + return -1; +} + + /** * Mixing ARB and NV vertex/fragment programs can be tricky. @@ -513,9 +788,9 @@ _mesa_BindProgram(GLenum target, GLuint id) /* Bind a default program */ newProg = NULL; if (target == GL_VERTEX_PROGRAM_ARB) /* == GL_VERTEX_PROGRAM_NV */ - newProg = ctx->Shared->DefaultVertexProgram; + newProg = &ctx->Shared->DefaultVertexProgram->Base; else - newProg = ctx->Shared->DefaultFragmentProgram; + newProg = &ctx->Shared->DefaultFragmentProgram->Base; } else { /* Bind a user program */ @@ -543,26 +818,16 @@ _mesa_BindProgram(GLenum target, GLuint id) return; } - /* unbind/delete oldProg */ - if (curProg->Id != 0) { - /* decrement refcount on previously bound fragment program */ - curProg->RefCount--; - /* and delete if refcount goes below one */ - if (curProg->RefCount <= 0) { - /* the program ID was already removed from the hash table */ - ctx->Driver.DeleteProgram(ctx, curProg); - } - } - /* bind newProg */ if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */ - ctx->VertexProgram.Current = (struct gl_vertex_program *) newProg; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + (struct gl_vertex_program *) newProg); } else if (target == GL_FRAGMENT_PROGRAM_NV || target == GL_FRAGMENT_PROGRAM_ARB) { - ctx->FragmentProgram.Current = (struct gl_fragment_program *) newProg; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + (struct gl_fragment_program *) newProg); } - newProg->RefCount++; /* Never null pointers */ ASSERT(ctx->VertexProgram.Current); @@ -620,10 +885,7 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids) } /* The ID is immediately available for re-use now */ _mesa_HashRemove(ctx->Shared->Programs, ids[i]); - prog->RefCount--; - if (prog->RefCount <= 0) { - ctx->Driver.DeleteProgram(ctx, prog); - } + _mesa_reference_program(ctx, &prog, NULL); } } } diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index ea2c8c30508..f1a69a2c016 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -86,10 +86,43 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog); extern struct gl_program * _mesa_lookup_program(GLcontext *ctx, GLuint id); +extern void +_mesa_reference_program(GLcontext *ctx, + struct gl_program **ptr, + struct gl_program *prog); + +static INLINE void +_mesa_reference_vertprog(GLcontext *ctx, + struct gl_vertex_program **ptr, + struct gl_vertex_program *prog) +{ + _mesa_reference_program(ctx, (struct gl_program **) ptr, + (struct gl_program *) prog); +} + +static INLINE void +_mesa_reference_fragprog(GLcontext *ctx, + struct gl_fragment_program **ptr, + struct gl_fragment_program *prog) +{ + _mesa_reference_program(ctx, (struct gl_program **) ptr, + (struct gl_program *) prog); +} extern struct gl_program * _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog); +extern GLboolean +_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count); + +extern struct gl_program * +_mesa_combine_programs(GLcontext *ctx, + const struct gl_program *progA, + const struct gl_program *progB); + +extern GLint +_mesa_find_free_register(const struct gl_program *prog, GLuint regFile); + /* * API functions common to ARB/NV_vertex/fragment_program diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index fc5b0497fe3..7d560c74a54 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -35,6 +35,7 @@ #include "context.h" #include "prog_parameter.h" #include "prog_statevars.h" +#include "program.h" #include "programopt.h" #include "prog_instruction.h" @@ -102,7 +103,7 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen); /* free old instructions */ - _mesa_free(vprog->Base.Instructions); + _mesa_free_instructions(vprog->Base.Instructions, origLen); /* install new instructions */ vprog->Base.Instructions = newInst; @@ -192,13 +193,13 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_INPUT; inst->SrcReg[0].Index = FRAG_ATTRIB_FOGC; - inst->SrcReg[0].Swizzle = SWIZZLE_X; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_STATE_VAR; inst->SrcReg[1].Index = fogPRefOpt; - inst->SrcReg[1].Swizzle = SWIZZLE_X; + inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst->SrcReg[2].File = PROGRAM_STATE_VAR; inst->SrcReg[2].Index = fogPRefOpt; - inst->SrcReg[2].Swizzle = SWIZZLE_Y; + inst->SrcReg[2].Swizzle = SWIZZLE_YYYY; inst->SaturateMode = SATURATE_ZERO_ONE; inst++; } @@ -214,10 +215,10 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->SrcReg[0].File = PROGRAM_STATE_VAR; inst->SrcReg[0].Index = fogPRefOpt; inst->SrcReg[0].Swizzle - = (fprog->FogOption == GL_EXP) ? SWIZZLE_Z : SWIZZLE_W; + = (fprog->FogOption == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW; inst->SrcReg[1].File = PROGRAM_INPUT; inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC; - inst->SrcReg[1].Swizzle = SWIZZLE_X; + inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst++; if (fprog->FogOption == GL_EXP2) { /* MUL fogFactorTemp.x, fogFactorTemp.x, fogFactorTemp.x; */ @@ -227,10 +228,10 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; - inst->SrcReg[0].Swizzle = SWIZZLE_X; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_TEMPORARY; inst->SrcReg[1].Index = fogFactorTemp; - inst->SrcReg[1].Swizzle = SWIZZLE_X; + inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst++; } /* EX2_SAT fogFactorTemp.x, -fogFactorTemp.x; */ @@ -240,8 +241,8 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; - inst->SrcReg[0].NegateBase = GL_TRUE; - inst->SrcReg[0].Swizzle = SWIZZLE_X; + inst->SrcReg[0].NegateBase = NEGATE_XYZW; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SaturateMode = SATURATE_ZERO_ONE; inst++; } @@ -252,8 +253,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_XYZ; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; - inst->SrcReg[0].Swizzle - = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X); + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_TEMPORARY; inst->SrcReg[1].Index = colorTemp; inst->SrcReg[1].Swizzle = SWIZZLE_NOOP; @@ -275,7 +275,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst++; /* free old instructions */ - _mesa_free(fprog->Base.Instructions); + _mesa_free_instructions(fprog->Base.Instructions, origLen); /* install new instructions */ fprog->Base.Instructions = newInst; @@ -365,3 +365,94 @@ _mesa_count_texture_instructions(struct gl_program *prog) } } + +/** + * Scan/rewrite program to remove reads of varying (output) registers. + * In GLSL vertex shaders, varying vars can be read and written. + * Normally, vertex varying vars are implemented as output registers. + * On some hardware, trying to read an output register causes trouble. + * So, rewrite the program to use a temporary register in this case. + */ +void +_mesa_remove_varying_reads(struct gl_program *prog) +{ + GLuint i; + GLint outputMap[VERT_RESULT_MAX]; + GLuint numVaryingReads = 0; + + assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + + for (i = 0; i < VERT_RESULT_MAX; i++) + outputMap[i] = -1; + + /* look for instructions which read from varying vars */ + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); + GLuint j; + for (j = 0; j < numSrc; j++) { + if (inst->SrcReg[j].File == PROGRAM_VARYING) { + /* replace the read with a temp reg */ + const GLuint var = inst->SrcReg[j].Index; + if (outputMap[var] == -1) { + numVaryingReads++; + outputMap[var] = _mesa_find_free_register(prog, + PROGRAM_TEMPORARY); + } + inst->SrcReg[j].File = PROGRAM_TEMPORARY; + inst->SrcReg[j].Index = outputMap[var]; + } + } + } + + if (numVaryingReads == 0) + return; /* nothing to be done */ + + /* look for instructions which write to the varying vars identified above */ + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); + GLuint j; + for (j = 0; j < numSrc; j++) { + if (inst->DstReg.File == PROGRAM_VARYING && + outputMap[inst->DstReg.Index] >= 0) { + /* change inst to write to the temp reg, instead of the varying */ + inst->DstReg.File = PROGRAM_TEMPORARY; + inst->DstReg.Index = outputMap[inst->DstReg.Index]; + } + } + } + + /* insert new instructions to copy the temp vars to the varying vars */ + { + struct prog_instruction *inst; + GLint endPos, var; + + /* Look for END instruction and insert the new varying writes */ + endPos = -1; + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->Opcode == OPCODE_END) { + endPos = i; + _mesa_insert_instructions(prog, i, numVaryingReads); + break; + } + } + + assert(endPos >= 0); + + /* insert new MOV instructions here */ + inst = prog->Instructions + endPos; + for (var = 0; var < VERT_RESULT_MAX; var++) { + if (outputMap[var] >= 0) { + /* MOV VAR[var], TEMP[tmp]; */ + inst->Opcode = OPCODE_MOV; + inst->DstReg.File = PROGRAM_VARYING; + inst->DstReg.Index = var; + inst->SrcReg[0].File = PROGRAM_TEMPORARY; + inst->SrcReg[0].Index = outputMap[var]; + inst++; + } + } + } +} diff --git a/src/mesa/shader/programopt.h b/src/mesa/shader/programopt.h index ce63644bbf5..47ff2f0c7be 100644 --- a/src/mesa/shader/programopt.h +++ b/src/mesa/shader/programopt.h @@ -39,5 +39,7 @@ _mesa_count_texture_indirections(struct gl_program *prog); extern void _mesa_count_texture_instructions(struct gl_program *prog); +extern void +_mesa_remove_varying_reads(struct gl_program *prog); #endif /* PROGRAMOPT_H */ diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index b0f79c29c1e..0bb96a0d6c0 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -43,6 +43,7 @@ #include "prog_parameter.h" #include "prog_print.h" #include "prog_statevars.h" +#include "prog_uniform.h" #include "shader/shader_api.h" #include "shader/slang/slang_compile.h" #include "shader/slang/slang_link.h" @@ -52,7 +53,7 @@ /** * Allocate a new gl_shader_program object, initialize it. */ -struct gl_shader_program * +static struct gl_shader_program * _mesa_new_shader_program(GLcontext *ctx, GLuint name) { struct gl_shader_program *shProg; @@ -74,26 +75,11 @@ void _mesa_clear_shader_program_data(GLcontext *ctx, struct gl_shader_program *shProg) { - if (shProg->VertexProgram) { - if (shProg->VertexProgram->Base.Parameters == shProg->Uniforms) { - /* to prevent a double-free in the next call */ - shProg->VertexProgram->Base.Parameters = NULL; - } - ctx->Driver.DeleteProgram(ctx, &shProg->VertexProgram->Base); - shProg->VertexProgram = NULL; - } - - if (shProg->FragmentProgram) { - if (shProg->FragmentProgram->Base.Parameters == shProg->Uniforms) { - /* to prevent a double-free in the next call */ - shProg->FragmentProgram->Base.Parameters = NULL; - } - ctx->Driver.DeleteProgram(ctx, &shProg->FragmentProgram->Base); - shProg->FragmentProgram = NULL; - } + _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); + _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); if (shProg->Uniforms) { - _mesa_free_parameter_list(shProg->Uniforms); + _mesa_free_uniform_list(shProg->Uniforms); shProg->Uniforms = NULL; } @@ -177,8 +163,10 @@ _mesa_reference_shader_program(GLcontext *ctx, ASSERT(old->RefCount > 0); old->RefCount--; - /*printf("SHPROG DECR %p (%d) to %d\n", - (void*) old, old->Name, old->RefCount);*/ +#if 0 + printf("ShaderProgram %p ID=%u RefCount-- to %d\n", + (void *) old, old->Name, old->RefCount); +#endif deleteFlag = (old->RefCount == 0); if (deleteFlag) { @@ -192,8 +180,10 @@ _mesa_reference_shader_program(GLcontext *ctx, if (shProg) { shProg->RefCount++; - /*printf("SHPROG INCR %p (%d) to %d\n", - (void*) shProg, shProg->Name, shProg->RefCount);*/ +#if 0 + printf("ShaderProgram %p ID=%u RefCount++ to %d\n", + (void *) shProg, shProg->Name, shProg->RefCount); +#endif *ptr = shProg; } } @@ -248,10 +238,8 @@ _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh) _mesa_free((void *) sh->Source); if (sh->InfoLog) _mesa_free(sh->InfoLog); - for (i = 0; i < sh->NumPrograms; i++) { - assert(sh->Programs[i]); - ctx->Driver.DeleteProgram(ctx, sh->Programs[i]); - } + for (i = 0; i < sh->NumPrograms; i++) + _mesa_reference_program(ctx, &sh->Programs[i], NULL); if (sh->Programs) _mesa_free(sh->Programs); _mesa_free(sh); @@ -373,57 +361,9 @@ copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src) /** - * Return size (in floats) of the given GLSL type. - * See also _slang_sizeof_type_specifier(). - */ -static GLint -sizeof_glsl_type(GLenum type) -{ - switch (type) { - case GL_BOOL: - case GL_FLOAT: - case GL_INT: - return 1; - case GL_BOOL_VEC2: - case GL_FLOAT_VEC2: - case GL_INT_VEC2: - return 2; - case GL_BOOL_VEC3: - case GL_FLOAT_VEC3: - case GL_INT_VEC3: - return 3; - case GL_BOOL_VEC4: - case GL_FLOAT_VEC4: - case GL_INT_VEC4: - return 4; - case GL_FLOAT_MAT2: - return 8; /* 2 rows of 4, actually */ - case GL_FLOAT_MAT3: - return 12; /* 3 rows of 4, actually */ - case GL_FLOAT_MAT4: - return 16; - case GL_FLOAT_MAT2x3: - return 8; /* 2 rows of 4, actually */ - case GL_FLOAT_MAT2x4: - return 8; - case GL_FLOAT_MAT3x2: - return 12; /* 3 rows of 4, actually */ - case GL_FLOAT_MAT3x4: - return 12; - case GL_FLOAT_MAT4x2: - return 16; /* 4 rows of 4, actually */ - case GL_FLOAT_MAT4x3: - return 16; /* 4 rows of 4, actually */ - default: - return 0; /* error */ - } -} - - -/** * Called via ctx->Driver.AttachShader() */ -void +static void _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader) { struct gl_shader_program *shProg @@ -464,7 +404,38 @@ _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader) } -void +static GLint +_mesa_get_attrib_location(GLcontext *ctx, GLuint program, + const GLchar *name) +{ + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + + if (!shProg) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetAttribLocation"); + return -1; + } + + if (!shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetAttribLocation(program not linked)"); + return -1; + } + + if (!name) + return -1; + + if (shProg->Attributes) { + GLint i = _mesa_lookup_parameter_index(shProg->Attributes, -1, name); + if (i >= 0) { + return shProg->Attributes->Parameters[i].StateIndexes[0]; + } + } + return -1; +} + + +static void _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, const GLchar *name) { @@ -510,7 +481,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, } -GLuint +static GLuint _mesa_create_shader(GLcontext *ctx, GLenum type) { struct gl_shader *sh; @@ -534,7 +505,7 @@ _mesa_create_shader(GLcontext *ctx, GLenum type) } -GLuint +static GLuint _mesa_create_program(GLcontext *ctx) { GLuint name; @@ -555,7 +526,7 @@ _mesa_create_program(GLcontext *ctx) * Named w/ "2" to indicate OpenGL 2.x vs GL_ARB_fragment_programs's * DeleteProgramARB. */ -void +static void _mesa_delete_program2(GLcontext *ctx, GLuint name) { /* @@ -581,7 +552,7 @@ _mesa_delete_program2(GLcontext *ctx, GLuint name) } -void +static void _mesa_delete_shader(GLcontext *ctx, GLuint shader) { struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); @@ -596,7 +567,7 @@ _mesa_delete_shader(GLcontext *ctx, GLuint shader) } -void +static void _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) { struct gl_shader_program *shProg @@ -658,7 +629,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) } -void +static void _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *nameOut) @@ -684,64 +655,64 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, shProg->Attributes->Parameters[index].Name); sz = shProg->Attributes->Parameters[index].Size; if (size) - *size = 1; /* attributes may not be arrays */ - if (type && sz > 0 && sz <= 4) /* XXX this is a temporary hack */ - *type = vec_types[sz - 1]; + *size = sz; + if (type) + *type = vec_types[sz]; /* XXX this is a temporary hack */ } /** * Called via ctx->Driver.GetActiveUniform(). */ -void +static void _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *nameOut) { - struct gl_shader_program *shProg + const struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); - GLuint ind, j; + const struct gl_program *prog; + GLint progPos; if (!shProg) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform"); return; } - if (!shProg->Uniforms || index >= shProg->Uniforms->NumParameters) { + if (!shProg->Uniforms || index >= shProg->Uniforms->NumUniforms) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); return; } - ind = 0; - for (j = 0; j < shProg->Uniforms->NumParameters; j++) { - if (shProg->Uniforms->Parameters[j].Type == PROGRAM_UNIFORM || - shProg->Uniforms->Parameters[j].Type == PROGRAM_SAMPLER) { - if (ind == index) { - GLuint uSize = shProg->Uniforms->Parameters[j].Size; - GLenum uType = shProg->Uniforms->Parameters[j].DataType; - /* found it */ - copy_string(nameOut, maxLength, length, - shProg->Uniforms->Parameters[j].Name); - if (size) { - /* convert from floats to 'type' (eg: sizeof(mat4x4)=1) */ - *size = uSize / sizeof_glsl_type(uType); - } - if (type) - *type = uType; - return; - } - ind++; + progPos = shProg->Uniforms->Uniforms[index].VertPos; + if (progPos >= 0) { + prog = &shProg->VertexProgram->Base; + } + else { + progPos = shProg->Uniforms->Uniforms[index].FragPos; + if (progPos >= 0) { + prog = &shProg->FragmentProgram->Base; } } - _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); + if (!prog || progPos < 0) + return; /* should never happen */ + + if (nameOut) + copy_string(nameOut, maxLength, length, + prog->Parameters->Parameters[progPos].Name); + if (size) + *size = prog->Parameters->Parameters[progPos].Size; + + if (type) + *type = prog->Parameters->Parameters[progPos].DataType; } /** * Called via ctx->Driver.GetAttachedShaders(). */ -void +static void _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj) { @@ -761,38 +732,7 @@ _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, } -GLint -_mesa_get_attrib_location(GLcontext *ctx, GLuint program, - const GLchar *name) -{ - struct gl_shader_program *shProg - = _mesa_lookup_shader_program(ctx, program); - - if (!shProg) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetAttribLocation"); - return -1; - } - - if (!shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetAttribLocation(program not linked)"); - return -1; - } - - if (!name) - return -1; - - if (shProg->Attributes) { - GLint i = _mesa_lookup_parameter_index(shProg->Attributes, -1, name); - if (i >= 0) { - return shProg->Attributes->Parameters[i].StateIndexes[0]; - } - } - return -1; -} - - -GLuint +static GLuint _mesa_get_handle(GLcontext *ctx, GLenum pname) { #if 0 @@ -816,7 +756,7 @@ _mesa_get_handle(GLcontext *ctx, GLenum pname) } -void +static void _mesa_get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) { @@ -852,14 +792,10 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, PROGRAM_INPUT) + 1; break; case GL_ACTIVE_UNIFORMS: - *params - = _mesa_num_parameters_of_type(shProg->Uniforms, PROGRAM_UNIFORM) - + _mesa_num_parameters_of_type(shProg->Uniforms, PROGRAM_SAMPLER); + *params = shProg->Uniforms ? shProg->Uniforms->NumUniforms : 0; break; case GL_ACTIVE_UNIFORM_MAX_LENGTH: - *params = MAX2( - _mesa_longest_parameter_name(shProg->Uniforms, PROGRAM_UNIFORM), - _mesa_longest_parameter_name(shProg->Uniforms, PROGRAM_SAMPLER)); + *params = _mesa_longest_uniform_name(shProg->Uniforms); if (*params > 0) (*params)++; /* add one for terminating zero */ break; @@ -870,7 +806,7 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, } -void +static void _mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) { struct gl_shader *shader = _mesa_lookup_shader(ctx, name); @@ -903,7 +839,7 @@ _mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) } -void +static void _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { @@ -917,7 +853,7 @@ _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, } -void +static void _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { @@ -933,7 +869,7 @@ _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, /** * Called via ctx->Driver.GetShaderSource(). */ -void +static void _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *sourceOut) { @@ -949,49 +885,34 @@ _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, /** * Called via ctx->Driver.GetUniformfv(). */ -void +static void _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, GLfloat *params) { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); if (shProg) { - GLint i; - if (location >= 0 && location < shProg->Uniforms->NumParameters) { - GLuint uSize; - GLenum uType; - GLint rows = 0; - uType = shProg->Uniforms->Parameters[location].DataType; - uSize = sizeof_glsl_type(uType); - /* Matrix types need special handling, because they span several - * parameters, and may also not be fully packed. - */ - switch (shProg->Uniforms->Parameters[location].DataType) { - case GL_FLOAT_MAT2: - case GL_FLOAT_MAT3x2: - case GL_FLOAT_MAT4x2: - rows = 2; - break; - case GL_FLOAT_MAT2x3: - case GL_FLOAT_MAT3: - case GL_FLOAT_MAT4x3: - rows = 3; - break; - case GL_FLOAT_MAT2x4: - case GL_FLOAT_MAT3x4: - case GL_FLOAT_MAT4: - rows = 4; + if (location < shProg->Uniforms->NumUniforms) { + GLint progPos, i; + const struct gl_program *prog = NULL; + + progPos = shProg->Uniforms->Uniforms[location].VertPos; + if (progPos >= 0) { + prog = &shProg->VertexProgram->Base; } - if (rows != 0) { - GLint r, c; - for (c = 0, i = 0; c * 4 < uSize; c++) - for (r = 0; r < rows; r++, i++) - params[i] = shProg->Uniforms->ParameterValues[location + c][r]; + else { + progPos = shProg->Uniforms->Uniforms[location].FragPos; + if (progPos >= 0) { + prog = &shProg->FragmentProgram->Base; + } } - else - for (i = 0; i < uSize; i++) { - params[i] = shProg->Uniforms->ParameterValues[location][i]; + + ASSERT(prog); + if (prog) { + for (i = 0; i < prog->Parameters->Parameters[progPos].Size; i++) { + params[i] = prog->Parameters->ParameterValues[progPos][i]; } + } } else { _mesa_error(ctx, GL_INVALID_VALUE, "glGetUniformfv(location)"); @@ -1006,32 +927,19 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, /** * Called via ctx->Driver.GetUniformLocation(). */ -GLint +static GLint _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); - if (shProg) { - GLuint loc; - for (loc = 0; loc < shProg->Uniforms->NumParameters; loc++) { - const struct gl_program_parameter *u - = shProg->Uniforms->Parameters + loc; - /* XXX this is a temporary simplification / short-cut. - * We need to handle things like "e.c[0].b" as seen in the - * GLSL orange book, page 189. - */ - if ((u->Type == PROGRAM_UNIFORM || - u->Type == PROGRAM_SAMPLER) && !strcmp(u->Name, name)) { - return loc; - } - } - } - return -1; + if (!shProg) + return -1; + return _mesa_lookup_uniform(shProg->Uniforms, name); } -GLboolean +static GLboolean _mesa_is_program(GLcontext *ctx, GLuint name) { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name); @@ -1039,7 +947,7 @@ _mesa_is_program(GLcontext *ctx, GLuint name) } -GLboolean +static GLboolean _mesa_is_shader(GLcontext *ctx, GLuint name) { struct gl_shader *shader = _mesa_lookup_shader(ctx, name); @@ -1051,7 +959,7 @@ _mesa_is_shader(GLcontext *ctx, GLuint name) /** * Called via ctx->Driver.ShaderSource() */ -void +static void _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) { struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); @@ -1072,7 +980,7 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) /** * Called via ctx->Driver.CompileShader() */ -void +static void _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj) { struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj); @@ -1089,7 +997,7 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj) /** * Called via ctx->Driver.LinkProgram() */ -void +static void _mesa_link_program(GLcontext *ctx, GLuint program) { struct gl_shader_program *shProg; @@ -1100,6 +1008,8 @@ _mesa_link_program(GLcontext *ctx, GLuint program) return; } + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _slang_link(ctx, program, shProg); } @@ -1136,55 +1046,121 @@ _mesa_use_program(GLcontext *ctx, GLuint program) } + /** - * Called via ctx->Driver.Uniform(). + * Update the vertex and fragment program's TexturesUsed arrays. */ -void -_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, - const GLvoid *values, GLenum type) +static void +update_textures_used(struct gl_program *prog) { - struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; - GLint elems, i, k; - GLenum uType; - GLsizei maxCount; + GLuint s; - if (!shProg || !shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(program not linked)"); - return; - } + memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed)); - if (location == -1) - return; /* The standard specifies this as a no-op */ - - /* The spec says this is GL_INVALID_OPERATION, although it seems like it - * ought to be GL_INVALID_VALUE - */ - if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location)"); - return; + for (s = 0; s < MAX_SAMPLERS; s++) { + if (prog->SamplersUsed & (1 << s)) { + GLuint u = prog->SamplerUnits[s]; + GLuint t = prog->SamplerTargets[s]; + assert(u < MAX_TEXTURE_IMAGE_UNITS); + prog->TexturesUsed[u] |= (1 << t); + } } +} - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - uType = shProg->Uniforms->Parameters[location].DataType; - /* - * If we're setting a sampler, we must use glUniformi1()! - */ - if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { - GLint unit; +/** + * Set the value of a program's uniform variable. + * \param program the program whose uniform to update + * \param location the location/index of the uniform + * \param type the datatype of the uniform + * \param count the number of uniforms to set + * \param elems number of elements per uniform + * \param values the new values + */ +static void +set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location, + GLenum type, GLint count, GLint elems, const void *values) +{ + if (program->Parameters->Parameters[location].Type == PROGRAM_SAMPLER) { + /* This controls which texture unit which is used by a sampler */ + GLuint texUnit, sampler; + + /* data type for setting samplers must be int */ if (type != GL_INT || count != 1) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(only glUniform1i can be used " "to set sampler uniforms)"); return; } + + sampler = (GLuint) program->Parameters->ParameterValues[location][0]; + texUnit = ((GLuint *) values)[0]; + /* check that the sampler (tex unit index) is legal */ - unit = ((GLint *) values)[0]; - if (unit >= ctx->Const.MaxTextureImageUnits) { + if (texUnit >= ctx->Const.MaxTextureImageUnits) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniform1(invalid sampler/tex unit index)"); return; } + + /* This maps a sampler to a texture unit: */ + program->SamplerUnits[sampler] = texUnit; + update_textures_used(program); + + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + } + else { + /* ordinary uniform variable */ + GLint k, i; + + if (count * elems > program->Parameters->Parameters[location].Size) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)"); + return; + } + + for (k = 0; k < count; k++) { + GLfloat *uniformVal = program->Parameters->ParameterValues[location + k]; + if (type == GL_INT || + type == GL_INT_VEC2 || + type == GL_INT_VEC3 || + type == GL_INT_VEC4) { + const GLint *iValues = ((const GLint *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = (GLfloat) iValues[i]; + } + } + else { + const GLfloat *fValues = ((const GLfloat *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = fValues[i]; + } + } + } + } +} + + +/** + * Called via ctx->Driver.Uniform(). + */ +static void +_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, + const GLvoid *values, GLenum type) +{ + struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; + GLint elems; + + if (!shProg || !shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(program not linked)"); + return; + } + + if (location == -1) + return; /* The standard specifies this as a no-op */ + + if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)"); + return; } if (count < 0) { @@ -1214,69 +1190,56 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } - /* OpenGL requires types to match exactly, except that one can convert - * float or int array to boolean array. + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + /* A uniform var may be used by both a vertex shader and a fragment + * shader. We may need to update one or both shader's uniform here: */ - switch (uType) - { - case GL_BOOL: - case GL_BOOL_VEC2: - case GL_BOOL_VEC3: - case GL_BOOL_VEC4: - if (elems != sizeof_glsl_type(uType)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count mismatch)"); - } - break; - case PROGRAM_SAMPLER: - break; - default: - if (shProg->Uniforms->Parameters[location].Type != PROGRAM_SAMPLER - && uType != type) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)"); - } - break; + if (shProg->VertexProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].VertPos; + if (loc >= 0) { + set_program_uniform(ctx, &shProg->VertexProgram->Base, + loc, type, count, elems, values); + } + } + + if (shProg->FragmentProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].FragPos; + if (loc >= 0) { + set_program_uniform(ctx, &shProg->FragmentProgram->Base, + loc, type, count, elems, values); + } } +} + - /* XXX if this is a base type, then count must equal 1. However, we - * don't have enough information from the compiler to distinguish a - * base type from a 1-element array of that type. The standard allows - * count to overrun an array, in which case the overflow is ignored. +static void +set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, + GLuint location, GLuint rows, GLuint cols, + GLboolean transpose, const GLfloat *values) +{ + /* + * Note: the _columns_ of a matrix are stored in program registers, not + * the rows. */ - maxCount = shProg->Uniforms->Parameters[location].Size / elems; - if (count > maxCount) count = maxCount; - - for (k = 0; k < count; k++) { - GLfloat *uniformVal = shProg->Uniforms->ParameterValues[location + k]; - if (type == GL_INT || - type == GL_INT_VEC2 || - type == GL_INT_VEC3 || - type == GL_INT_VEC4) { - const GLint *iValues = ((const GLint *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = (GLfloat) iValues[i]; + /* XXXX need to test 3x3 and 2x2 matrices... */ + if (transpose) { + GLuint row, col; + for (col = 0; col < cols; col++) { + GLfloat *v = program->Parameters->ParameterValues[location + col]; + for (row = 0; row < rows; row++) { + v[row] = values[row * cols + col]; } } - else { - const GLfloat *fValues = ((const GLfloat *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = fValues[i]; + } + else { + GLuint row, col; + for (col = 0; col < cols; col++) { + GLfloat *v = program->Parameters->ParameterValues[location + col]; + for (row = 0; row < rows; row++) { + v[row] = values[col * rows + row]; } } - if (uType == GL_BOOL || - uType == GL_BOOL_VEC2 || - uType == GL_BOOL_VEC3 || - uType == GL_BOOL_VEC4) { - for (i = 0; i < elems; i++) - uniformVal[i] = uniformVal[i] ? 1.0f : 0.0f; - } - } - - if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { - if (shProg->VertexProgram) - _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); - if (shProg->FragmentProgram) - _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); - FLUSH_VERTICES(ctx, _NEW_TEXTURE); } } @@ -1284,72 +1247,52 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, /** * Called by ctx->Driver.UniformMatrix(). */ -void +static void _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, GLenum matrixType, GLint location, GLsizei count, GLboolean transpose, const GLfloat *values) { - GLsizei maxCount, i; struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; + if (!shProg || !shProg->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(program not linked)"); return; } + if (location == -1) return; /* The standard specifies this as a no-op */ - /* The spec says this is GL_INVALID_OPERATION, although it seems like it - * ought to be GL_INVALID_VALUE - */ - if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(location)"); + + if (location < 0 || location >= shProg->Uniforms->NumUniforms) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)"); return; } if (values == NULL) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix"); return; } - if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(count < 0)"); - return; - } FLUSH_VERTICES(ctx, _NEW_PROGRAM); - /* - * Note: the _columns_ of a matrix are stored in program registers, not - * the rows. - */ - /* XXXX need to test 3x3 and 2x2 matrices... */ - maxCount = shProg->Uniforms->Parameters[location].Size / (4 * cols); - if (count > maxCount) - count = maxCount; - for (i = 0; i < count; i++) { - if (transpose) { - GLuint row, col; - for (col = 0; col < cols; col++) { - GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; - for (row = 0; row < rows; row++) { - v[row] = values[row * cols + col]; - } - } + if (shProg->VertexProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].VertPos; + if (loc >= 0) { + set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base, + loc, rows, cols, transpose, values); } - else { - GLuint row, col; - for (col = 0; col < cols; col++) { - GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; - for (row = 0; row < rows; row++) { - v[row] = values[col * rows + row]; - } - } + } + + if (shProg->FragmentProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].FragPos; + if (loc >= 0) { + set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base, + loc, rows, cols, transpose, values); } - location += cols; - values += rows * cols; } } -void +static void _mesa_validate_program(GLcontext *ctx, GLuint program) { struct gl_shader_program *shProg; @@ -1375,3 +1318,40 @@ _mesa_validate_program(GLcontext *ctx, GLuint program) image units allowed. */ } + + +/** + * Plug in Mesa's GLSL functions into the device driver function table. + */ +void +_mesa_init_glsl_driver_functions(struct dd_function_table *driver) +{ + driver->AttachShader = _mesa_attach_shader; + driver->BindAttribLocation = _mesa_bind_attrib_location; + driver->CompileShader = _mesa_compile_shader; + driver->CreateProgram = _mesa_create_program; + driver->CreateShader = _mesa_create_shader; + driver->DeleteProgram2 = _mesa_delete_program2; + driver->DeleteShader = _mesa_delete_shader; + driver->DetachShader = _mesa_detach_shader; + driver->GetActiveAttrib = _mesa_get_active_attrib; + driver->GetActiveUniform = _mesa_get_active_uniform; + driver->GetAttachedShaders = _mesa_get_attached_shaders; + driver->GetAttribLocation = _mesa_get_attrib_location; + driver->GetHandle = _mesa_get_handle; + driver->GetProgramiv = _mesa_get_programiv; + driver->GetProgramInfoLog = _mesa_get_program_info_log; + driver->GetShaderiv = _mesa_get_shaderiv; + driver->GetShaderInfoLog = _mesa_get_shader_info_log; + driver->GetShaderSource = _mesa_get_shader_source; + driver->GetUniformfv = _mesa_get_uniformfv; + driver->GetUniformLocation = _mesa_get_uniform_location; + driver->IsProgram = _mesa_is_program; + driver->IsShader = _mesa_is_shader; + driver->LinkProgram = _mesa_link_program; + driver->ShaderSource = _mesa_shader_source; + driver->Uniform = _mesa_uniform; + driver->UniformMatrix = _mesa_uniform_matrix; + driver->UseProgram = _mesa_use_program; + driver->ValidateProgram = _mesa_validate_program; +} diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h index 27e5870d705..5521c585b53 100644 --- a/src/mesa/shader/shader_api.h +++ b/src/mesa/shader/shader_api.h @@ -41,9 +41,10 @@ _mesa_init_shader_state(GLcontext * ctx); extern void _mesa_free_shader_state(GLcontext *ctx); +/* extern struct gl_shader_program * _mesa_new_shader_program(GLcontext *ctx, GLuint name); - +*/ extern void _mesa_clear_shader_program_data(GLcontext *ctx, struct gl_shader_program *shProg); @@ -78,108 +79,12 @@ extern struct gl_shader * _mesa_lookup_shader(GLcontext *ctx, GLuint name); -/** - * API/Driver functions - */ - -extern void -_mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader); - -extern void -_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, - const GLchar *name); - -extern void -_mesa_compile_shader(GLcontext *ctx, GLuint shaderObj); - -extern GLuint -_mesa_create_shader(GLcontext *ctx, GLenum type); - -extern GLuint -_mesa_create_program(GLcontext *ctx); - -extern void -_mesa_delete_program2(GLcontext *ctx, GLuint name); - -extern void -_mesa_delete_shader(GLcontext *ctx, GLuint shader); - -extern void -_mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader); - -extern void -_mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, - GLsizei maxLength, GLsizei *length, GLint *size, - GLenum *type, GLchar *name); - -extern void -_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, - GLsizei maxLength, GLsizei *length, GLint *size, - GLenum *type, GLchar *name); - -extern void -_mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, - GLsizei *count, GLuint *obj); - -extern GLint -_mesa_get_attrib_location(GLcontext *ctx, GLuint program, - const GLchar *name); - -extern GLuint -_mesa_get_handle(GLcontext *ctx, GLenum pname); - -extern void -_mesa_get_programiv(GLcontext *ctx, GLuint program, - GLenum pname, GLint *params); - -extern void -_mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, - GLsizei *length, GLchar *infoLog); - -extern void -_mesa_get_shaderiv(GLcontext *ctx, GLuint shader, GLenum pname, GLint *params); - -extern void -_mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, - GLsizei *length, GLchar *infoLog); - -extern void -_mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, - GLsizei *length, GLchar *sourceOut); - -extern void -_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, - GLfloat *params); - -extern GLint -_mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name); - -extern GLboolean -_mesa_is_program(GLcontext *ctx, GLuint name); - -extern GLboolean -_mesa_is_shader(GLcontext *ctx, GLuint name); - -extern void -_mesa_link_program(GLcontext *ctx, GLuint program); - -extern void -_mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source); - -extern void -_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, - const GLvoid *values, GLenum type); - -void -_mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, - GLenum matrixType, GLint location, GLsizei count, - GLboolean transpose, const GLfloat *values); - extern void _mesa_use_program(GLcontext *ctx, GLuint program); + extern void -_mesa_validate_program(GLcontext *ctx, GLuint program); +_mesa_init_glsl_driver_functions(struct dd_function_table *driver); #endif /* SHADER_API_H */ diff --git a/src/mesa/shader/slang/library/Makefile b/src/mesa/shader/slang/library/Makefile index dc67b590886..0e03fac2ee1 100644 --- a/src/mesa/shader/slang/library/Makefile +++ b/src/mesa/shader/slang/library/Makefile @@ -17,7 +17,7 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) default: syntax builtin clean: - rm -f syn_to_c gc_to_bin *_syn.h *_gc.h + -rm -f syn_to_c gc_to_bin *_syn.h *_gc.h syntax: slang_pp_directives_syn.h slang_pp_expression_syn.h slang_shader_syn.h slang_pp_version_syn.h diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index ebead3274e1..d19d5a0abb6 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1090,7 +1090,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun, slang_operation_copy(inlined, fun->body); /*** XXX review this */ - assert(inlined->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE); + assert(inlined->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE); inlined->type = SLANG_OPER_BLOCK_NEW_SCOPE; #if 0 @@ -2836,14 +2836,13 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, const GLint texIndex = sampler_to_texture_index(var->type.specifier.type); if (texIndex != -1) { - /* Texture sampler: + /* This is a texture sampler variable... * store->File = PROGRAM_SAMPLER - * store->Index = sampler uniform location + * store->Index = sampler number (0..7, typically) * store->Size = texture type index (1D, 2D, 3D, cube, etc) */ - GLint samplerUniform - = _mesa_add_sampler(prog->Parameters, varName, datatype); - store = _slang_new_ir_storage(PROGRAM_SAMPLER, samplerUniform, texIndex); + GLint sampNum = _mesa_add_sampler(prog->Parameters, varName, datatype); + store = _slang_new_ir_storage(PROGRAM_SAMPLER, sampNum, texIndex); if (dbg) printf("SAMPLER "); } else if (var->type.qualifier == SLANG_QUAL_UNIFORM) { diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 2be89a5ce05..46b5c54bbeb 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -31,6 +31,8 @@ #include "main/imports.h" #include "main/context.h" #include "shader/program.h" +#include "shader/programopt.h" +#include "shader/prog_print.h" #include "shader/prog_parameter.h" #include "shader/grammar/grammar_mesa.h" #include "slang_codegen.h" @@ -2180,6 +2182,19 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) _slang_delete_mempool((slang_mempool *) ctx->Shader.MemPool); ctx->Shader.MemPool = NULL; + if (shader->Type == GL_VERTEX_SHADER) { + /* remove any reads of varying (output) registers */ +#if 0 + printf("Pre-remove output reads:\n"); + _mesa_print_program(shader->Programs[0]); +#endif + _mesa_remove_varying_reads(shader->Programs[0]); +#if 0 + printf("Post-remove output reads:\n"); + _mesa_print_program(shader->Programs[0]); +#endif + } + return success; } diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 9c307c6275b..ff63e05dd20 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -79,7 +79,7 @@ new_subroutine(slang_emit_info *emitInfo, GLuint *id) _mesa_realloc(emitInfo->Subroutines, n * sizeof(struct gl_program), (n + 1) * sizeof(struct gl_program)); - emitInfo->Subroutines[n] = _mesa_new_program(ctx, emitInfo->prog->Target, 0); + emitInfo->Subroutines[n] = ctx->Driver.NewProgram(ctx, emitInfo->prog->Target, 0); emitInfo->Subroutines[n]->Parameters = emitInfo->prog->Parameters; emitInfo->NumSubroutines++; *id = n; @@ -922,11 +922,15 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n) assert(n->Children[0]->Store->Size >= TEXTURE_1D_INDEX); assert(n->Children[0]->Store->Size <= TEXTURE_RECT_INDEX); - inst->Sampler = n->Children[0]->Store->Index; /* i.e. uniform's index */ inst->TexSrcTarget = n->Children[0]->Store->Size; +#if 0 inst->TexSrcUnit = 27; /* Dummy value; the TexSrcUnit will be computed at * link time, using the sampler uniform's value. */ + inst->Sampler = n->Children[0]->Store->Index; /* i.e. uniform's index */ +#else + inst->TexSrcUnit = n->Children[0]->Store->Index; /* i.e. uniform's index */ +#endif return inst; } @@ -1793,7 +1797,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo) sub->NumInstructions); /* delete subroutine code */ sub->Parameters = NULL; /* prevent double-free */ - _mesa_delete_program(ctx, sub); + _mesa_reference_program(ctx, &emitInfo->Subroutines[i], NULL); } /* free subroutine list */ diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index c8457fc483d..80cd4b6df62 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -37,12 +37,17 @@ #include "shader/prog_parameter.h" #include "shader/prog_print.h" #include "shader/prog_statevars.h" +#include "shader/prog_uniform.h" #include "shader/shader_api.h" #include "slang_link.h" - +/** + * Linking varying vars involves rearranging varying vars so that the + * vertex program's output varyings matches the order of the fragment + * program's input varyings. + */ static GLboolean link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) { @@ -132,145 +137,65 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) } -static GLboolean -is_uniform(GLuint file) -{ - return (file == PROGRAM_ENV_PARAM || - file == PROGRAM_STATE_VAR || - file == PROGRAM_NAMED_PARAM || - file == PROGRAM_CONSTANT || - file == PROGRAM_SAMPLER || - file == PROGRAM_UNIFORM); -} - - -static GLboolean -link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) +/** + * Build the shProg->Uniforms list. + * This is basically a list/index of all uniforms found in either/both of + * the vertex and fragment shaders. + */ +static void +link_uniform_vars(struct gl_shader_program *shProg, + struct gl_program *prog, + GLuint *numSamplers) { - GLuint *map, i; - -#if 0 - printf("================ pre link uniforms ===============\n"); - _mesa_print_parameter_list(shProg->Uniforms); -#endif - - map = (GLuint *) malloc(prog->Parameters->NumParameters * sizeof(GLuint)); - if (!map) - return GL_FALSE; + GLuint samplerMap[MAX_SAMPLERS]; + GLuint i; - for (i = 0; i < prog->Parameters->NumParameters; /* incr below*/) { - /* see if this uniform is in the linked uniform list */ + for (i = 0; i < prog->Parameters->NumParameters; i++) { const struct gl_program_parameter *p = prog->Parameters->Parameters + i; - const GLfloat *pVals = prog->Parameters->ParameterValues[i]; - GLint j; - GLint size; - - /* sanity check */ - assert(is_uniform(p->Type)); - - if (p->Name) { - j = _mesa_lookup_parameter_index(shProg->Uniforms, -1, p->Name); - } - else { - /*GLuint swizzle;*/ - ASSERT(p->Type == PROGRAM_CONSTANT); - if (_mesa_lookup_parameter_constant(shProg->Uniforms, pVals, - p->Size, &j, NULL)) { - assert(j >= 0); - } - else { - j = -1; - } - } - if (j >= 0) { - /* already in list, check size XXX check this */ -#if 0 - assert(p->Size == shProg->Uniforms->Parameters[j].Size); -#endif - } - else { - /* not already in linked list */ - switch (p->Type) { - case PROGRAM_ENV_PARAM: - j = _mesa_add_named_parameter(shProg->Uniforms, p->Name, pVals); - break; - case PROGRAM_CONSTANT: - j = _mesa_add_named_constant(shProg->Uniforms, p->Name, pVals, p->Size); - break; - case PROGRAM_STATE_VAR: - j = _mesa_add_state_reference(shProg->Uniforms, p->StateIndexes); - break; - case PROGRAM_UNIFORM: - j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size, p->DataType); - break; - case PROGRAM_SAMPLER: - j = _mesa_add_sampler(shProg->Uniforms, p->Name, p->DataType); - break; - default: - _mesa_problem(NULL, "bad parameter type in link_uniform_vars()"); - return GL_FALSE; - } + /* + * XXX FIX NEEDED HERE + * We should also be adding a uniform if p->Type == PROGRAM_STATE_VAR. + * For example, modelview matrix, light pos, etc. + * Also, we need to update the state-var name-generator code to + * generate GLSL-style names, like "gl_LightSource[0].position". + * Furthermore, we'll need to fix the state-var's size/datatype info. + */ + + if (p->Type == PROGRAM_UNIFORM || + p->Type == PROGRAM_SAMPLER) { + _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); } - ASSERT(j >= 0); - - size = p->Size; - while (size > 0) { - map[i] = j; - i++; - j++; - size -= 4; + if (p->Type == PROGRAM_SAMPLER) { + /* Allocate a new sampler index */ + GLuint sampNum = *numSamplers; + GLuint oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; + assert(oldSampNum < MAX_SAMPLERS); + samplerMap[oldSampNum] = sampNum; + (*numSamplers)++; } - } -#if 0 - printf("================ post link uniforms ===============\n"); - _mesa_print_parameter_list(shProg->Uniforms); -#endif -#if 0 - { - GLuint i; - for (i = 0; i < prog->Parameters->NumParameters; i++) { - printf("map[%d] = %d\n", i, map[i]); - } - _mesa_print_parameter_list(shProg->Uniforms); - } -#endif - - /* OK, now scan the program/shader instructions looking for uniform vars, + /* OK, now scan the program/shader instructions looking for sampler vars, * replacing the old index with the new index. */ + prog->SamplersUsed = 0x0; for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = prog->Instructions + i; - GLuint j; - - if (is_uniform(inst->DstReg.File)) { - inst->DstReg.Index = map[ inst->DstReg.Index ]; - } - - for (j = 0; j < 3; j++) { - if (is_uniform(inst->SrcReg[j].File)) { - inst->SrcReg[j].Index = map[ inst->SrcReg[j].Index ]; - } - } - - if (inst->Opcode == OPCODE_TEX || - inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXP) { + if (_mesa_is_tex_instruction(inst->Opcode)) { /* printf("====== remap sampler from %d to %d\n", inst->Sampler, map[ inst->Sampler ]); */ - inst->Sampler = map[ inst->Sampler ]; + /* here, texUnit is really samplerUnit */ + inst->TexSrcUnit = samplerMap[inst->TexSrcUnit]; + prog->SamplerTargets[inst->TexSrcUnit] = inst->TexSrcTarget; + prog->SamplersUsed |= (1 << inst->TexSrcUnit); } } - free(map); - - return GL_TRUE; } @@ -329,10 +254,8 @@ _slang_resolve_attributes(struct gl_shader_program *shProg, * glVertex/position. */ for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) { - if (((1 << attr) & usedAttributes) == 0) { - usedAttributes |= (1 << attr); + if (((1 << attr) & usedAttributes) == 0) break; - } } if (attr == MAX_VERTEX_ATTRIBS) { /* too many! XXX record error log */ @@ -406,36 +329,6 @@ _slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttr -/** - * Scan program for texture instructions, lookup sampler/uniform's value - * to determine which texture unit to use. - * Also, update the program's TexturesUsed[] array. - */ -void -_slang_resolve_samplers(struct gl_shader_program *shProg, - struct gl_program *prog) -{ - GLuint i; - - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - prog->TexturesUsed[i] = 0; - - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - if (inst->Opcode == OPCODE_TEX || - inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXP) { - GLint sampleUnit = (GLint) shProg->Uniforms->ParameterValues[inst->Sampler][0]; - assert(sampleUnit < MAX_TEXTURE_IMAGE_UNITS); - inst->TexSrcUnit = sampleUnit; - - prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); - } - } -} - - - /** cast wrapper */ static struct gl_vertex_program * vertex_program(struct gl_program *prog) @@ -476,12 +369,9 @@ link_error(struct gl_shader_program *shProg, const char *msg) * 2. Varying vars in the two shaders are combined so their locations * agree between the vertex and fragment stages. They're treated as * vertex program output attribs and as fragment program input attribs. - * 3. Uniform vars (including state references, constants, etc) from the - * vertex and fragment shaders are merged into one group. Recall that - * GLSL uniforms are shared by all linked shaders. - * 4. The vertex and fragment programs are cloned and modified to update - * src/dst register references so they use the new, linked uniform/ - * varying storage locations. + * 3. The vertex and fragment programs are cloned and modified to update + * src/dst register references so they use the new, linked varying + * storage locations. */ void _slang_link(GLcontext *ctx, @@ -490,11 +380,12 @@ _slang_link(GLcontext *ctx, { const struct gl_vertex_program *vertProg; const struct gl_fragment_program *fragProg; + GLuint numSamplers = 0; GLuint i; _mesa_clear_shader_program_data(ctx, shProg); - shProg->Uniforms = _mesa_new_parameter_list(); + shProg->Uniforms = _mesa_new_uniform_list(); shProg->Varying = _mesa_new_parameter_list(); /** @@ -515,48 +406,35 @@ _slang_link(GLcontext *ctx, * Make copies of the vertex/fragment programs now since we'll be * changing src/dst registers after merging the uniforms and varying vars. */ + _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); if (vertProg) { - shProg->VertexProgram - = vertex_program(_mesa_clone_program(ctx, &vertProg->Base)); - } - else { - shProg->VertexProgram = NULL; + struct gl_vertex_program *linked_vprog = + vertex_program(_mesa_clone_program(ctx, &vertProg->Base)); + shProg->VertexProgram = linked_vprog; /* refcount OK */ + ASSERT(shProg->VertexProgram->Base.RefCount == 1); } + _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); if (fragProg) { - shProg->FragmentProgram - = fragment_program(_mesa_clone_program(ctx, &fragProg->Base)); - } - else { - shProg->FragmentProgram = NULL; + struct gl_fragment_program *linked_fprog = + fragment_program(_mesa_clone_program(ctx, &fragProg->Base)); + shProg->FragmentProgram = linked_fprog; /* refcount OK */ + ASSERT(shProg->FragmentProgram->Base.RefCount == 1); } + /* link varying vars */ if (shProg->VertexProgram) link_varying_vars(shProg, &shProg->VertexProgram->Base); if (shProg->FragmentProgram) link_varying_vars(shProg, &shProg->FragmentProgram->Base); + /* link uniform vars */ if (shProg->VertexProgram) - link_uniform_vars(shProg, &shProg->VertexProgram->Base); + link_uniform_vars(shProg, &shProg->VertexProgram->Base, &numSamplers); if (shProg->FragmentProgram) - link_uniform_vars(shProg, &shProg->FragmentProgram->Base); - - /* The vertex and fragment programs share a common set of uniforms now */ - if (shProg->VertexProgram) { - _mesa_free_parameter_list(shProg->VertexProgram->Base.Parameters); - shProg->VertexProgram->Base.Parameters = shProg->Uniforms; - } - if (shProg->FragmentProgram) { - _mesa_free_parameter_list(shProg->FragmentProgram->Base.Parameters); - shProg->FragmentProgram->Base.Parameters = shProg->Uniforms; - } + link_uniform_vars(shProg, &shProg->FragmentProgram->Base, &numSamplers); - if (shProg->VertexProgram) { - _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); - } - if (shProg->FragmentProgram) { - _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); - } + /*_mesa_print_uniforms(shProg->Uniforms);*/ if (shProg->VertexProgram) { if (!_slang_resolve_attributes(shProg, &shProg->VertexProgram->Base)) { diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index 606b9e46b16..8ef8a6b4b3e 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -33,10 +33,6 @@ _slang_link(GLcontext *ctx, GLhandleARB h, struct gl_shader_program *shProg); extern void -_slang_resolve_samplers(struct gl_shader_program *shProg, - struct gl_program *prog); - -extern void _slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttrib); diff --git a/src/mesa/sources b/src/mesa/sources index dbfc01d0edf..054f667a254 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -165,6 +165,7 @@ SHADER_SOURCES = \ shader/prog_parameter.c \ shader/prog_print.c \ shader/prog_statevars.c \ + shader/prog_uniform.c \ shader/programopt.c \ shader/shader_api.c \ diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 81f5caa2706..730798c9084 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -840,8 +840,10 @@ _swrast_DrawPixels( GLcontext *ctx, _swrast_validate_derived( ctx ); pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); - if (!pixels) + if (!pixels) { + RENDER_FINISH(swrast,ctx); return; + } switch (format) { case GL_STENCIL_INDEX: diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 2dfc033d501..ecace9c5025 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -33,18 +33,19 @@ /** - * Fetch a texel. + * Fetch a texel with given lod. + * Called via machine->FetchTexelLod() */ static void -fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, - GLuint unit, GLfloat color[4] ) +fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, + GLuint unit, GLfloat color[4] ) { GLchan rgba[4]; SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); - + /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); @@ -58,6 +59,7 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, /** * Fetch a texel with the given partial derivatives to compute a level * of detail in the mipmap. + * Called via machine->FetchTexelDeriv() */ static void fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], @@ -117,6 +119,8 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine, machine->DerivY = (GLfloat (*)[4]) span->attrStepY; machine->NumDeriv = FRAG_ATTRIB_MAX; + machine->Samplers = program->Base.SamplerUnits; + /* if running a GLSL program (not ARB_fragment_program) */ if (ctx->Shader.CurrentProgram) { /* Store front/back facing value in register FOGC.Y */ @@ -134,7 +138,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine, /* init call stack */ machine->StackDepth = 0; - machine->FetchTexelLod = fetch_texel; + machine->FetchTexelLod = fetch_texel_lod; machine->FetchTexelDeriv = fetch_texel_deriv; } diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 656a90a99a9..4c58f8de876 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1401,7 +1401,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) * Write to renderbuffers */ { - const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; const GLuint numBuffers = fb->_NumColorDrawBuffers; const GLboolean multiFragOutputs = numBuffers > 1; GLuint buf; diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c index 3f49b40d9c1..547d5b9ea0d 100644 --- a/src/mesa/swrast/s_texstore.c +++ b/src/mesa/swrast/s_texstore.c @@ -305,7 +305,7 @@ _swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } } @@ -381,7 +381,7 @@ _swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } } @@ -450,7 +450,7 @@ _swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } } @@ -526,7 +526,7 @@ _swrast_copy_texsubimage2d( GLcontext *ctx, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } } @@ -599,6 +599,6 @@ _swrast_copy_texsubimage3d( GLcontext *ctx, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } } diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index baf283ef0f6..1ac508f0330 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -388,7 +388,7 @@ struct tnl_clipspace struct tnl_cache_item { GLuint hash; void *key; - void *data; + struct gl_vertex_program *prog; struct tnl_cache_item *next; }; diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index a7fd815a260..d79f84f1eb4 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -1464,21 +1464,22 @@ create_new_program( const struct state_key *key, build_tnl_program( &p ); } -static void *search_cache( struct tnl_cache *cache, - GLuint hash, - const void *key, - GLuint keysize) + +static struct gl_vertex_program * +search_cache(struct tnl_cache *cache, GLuint hash, + const void *key, GLuint keysize) { struct tnl_cache_item *c; for (c = cache->items[hash % cache->size]; c; c = c->next) { if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0) - return c->data; + return c->prog; } return NULL; } + static void rehash( struct tnl_cache *cache ) { struct tnl_cache_item **items; @@ -1501,15 +1502,17 @@ static void rehash( struct tnl_cache *cache ) cache->size = size; } -static void cache_item( struct tnl_cache *cache, +static void cache_item( GLcontext *ctx, + struct tnl_cache *cache, GLuint hash, void *key, - void *data ) + struct gl_vertex_program *prog ) { - struct tnl_cache_item *c = (struct tnl_cache_item*) _mesa_malloc(sizeof(*c)); + struct tnl_cache_item *c = CALLOC_STRUCT(tnl_cache_item); c->hash = hash; c->key = key; - c->data = data; + + c->prog = prog; if (++cache->n_items > cache->size * 1.5) rehash(cache); @@ -1540,6 +1543,8 @@ void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) if (!ctx->VertexProgram._Current || ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) { + struct gl_vertex_program *newProg; + /* Grab all the relevent state and put it in a single structure: */ key = make_state_key(ctx); @@ -1547,33 +1552,33 @@ void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) /* Look for an already-prepared program for this state: */ - ctx->VertexProgram._TnlProgram = (struct gl_vertex_program *) - search_cache( tnl->vp_cache, hash, key, sizeof(*key) ); + newProg = search_cache( tnl->vp_cache, hash, key, sizeof(*key)); /* OK, we'll have to build a new one: */ - if (!ctx->VertexProgram._TnlProgram) { + if (!newProg) { + if (0) _mesa_printf("Build new TNL program\n"); - ctx->VertexProgram._TnlProgram = (struct gl_vertex_program *) + newProg = (struct gl_vertex_program *) ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); - create_new_program( key, ctx->VertexProgram._TnlProgram, - ctx->Const.VertexProgram.MaxTemps ); + create_new_program( key, newProg, ctx->Const.VertexProgram.MaxTemps ); if (ctx->Driver.ProgramStringNotify) ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB, - &ctx->VertexProgram._TnlProgram->Base ); + &newProg->Base ); - cache_item(tnl->vp_cache, hash, key, ctx->VertexProgram._TnlProgram ); + /* Our ownership of newProg is transferred to the cache */ + cache_item(ctx, tnl->vp_cache, hash, key, newProg); } else { FREE(key); - if (0) - _mesa_printf("Found existing TNL program for key %x\n", hash); } - ctx->VertexProgram._Current = ctx->VertexProgram._TnlProgram; + + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, newProg); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, newProg); } /* Tell the driver about the change. Could define a new target for @@ -1606,7 +1611,7 @@ void _tnl_ProgramCacheDestroy( GLcontext *ctx ) for (c = tnl->vp_cache->items[i]; c; c = next) { next = c->next; FREE(c->key); - FREE(c->data); + _mesa_reference_vertprog(ctx, &c->prog, NULL); FREE(c); } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 0ef26cdfe36..68ce7ba837d 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -187,7 +187,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) 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); } } } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index ee6df226054..bf5c6d4eefe 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -146,7 +146,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx, assert(arrays[attr].BufferObj->Name); - data += node->attrsz[attr] * sizeof(GLfloat); + data += node->attrsz[src] * sizeof(GLfloat); } } } diff --git a/src/mesa/x86-64/Makefile b/src/mesa/x86-64/Makefile index 252218ca86b..c6b69bafe86 100644 --- a/src/mesa/x86-64/Makefile +++ b/src/mesa/x86-64/Makefile @@ -19,7 +19,7 @@ INCLUDE_DIRS = \ default: matypes.h clean: - rm -f matypes.h + -rm -f matypes.h # need some special rules here, unfortunately diff --git a/src/mesa/x86/Makefile b/src/mesa/x86/Makefile index 3c6a6b11c06..dc8c7f355eb 100644 --- a/src/mesa/x86/Makefile +++ b/src/mesa/x86/Makefile @@ -17,7 +17,7 @@ INCLUDE_DIRS = \ default: gen_matypes matypes.h clean: - rm -f matypes.h gen_matypes + -rm -f matypes.h gen_matypes gen_matypes: gen_matypes.c diff --git a/src/mesa/x86/read_rgba_span_x86.S b/src/mesa/x86/read_rgba_span_x86.S index 2e5c3be83fe..80144b889c7 100644 --- a/src/mesa/x86/read_rgba_span_x86.S +++ b/src/mesa/x86/read_rgba_span_x86.S @@ -434,7 +434,8 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE2: je .L47 movq (%ebx), %xmm0 - + addl $8, %ebx + movdqa %xmm0, %xmm3 movdqa %xmm0, %xmm4 andps %xmm1, %xmm0 @@ -448,6 +449,7 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE2: orps %xmm3, %xmm0 movq %xmm0, (%ecx) + addl $8, %ecx .L47: testl $1, %edx diff --git a/windows/VC8/mesa/gdi/gdi.vcproj b/windows/VC8/mesa/gdi/gdi.vcproj index 0aab8cf9d46..7b3efc4d886 100644 --- a/windows/VC8/mesa/gdi/gdi.vcproj +++ b/windows/VC8/mesa/gdi/gdi.vcproj @@ -245,6 +245,10 @@ >
</File>
<File
+ RelativePath="..\..\..\..\include\GL\wmesa.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\src\mesa\drivers\windows\gdi\wmesadef.h"
>
</File>
diff --git a/windows/VC8/mesa/glu/glu.vcproj b/windows/VC8/mesa/glu/glu.vcproj index 8679aa18cea..016b0b9716b 100644 --- a/windows/VC8/mesa/glu/glu.vcproj +++ b/windows/VC8/mesa/glu/glu.vcproj @@ -47,7 +47,7 @@ Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../../include;../../../../src/glu/sgi/include;../../../../src/glu/sgi/libnurbs/interface;../../../../src/glu/sgi/libnurbs/internals;../../../../src/glu/sgi/libnurbs/nurbtess"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GL32;LIBRARYBUILD"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GL32;LIBRARYBUILD;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
@@ -142,7 +142,7 @@ Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../include;../../../../src/glu/sgi/include;../../../../src/glu/sgi/libnurbs/interface;../../../../src/glu/sgi/libnurbs/internals;../../../../src/glu/sgi/libnurbs/nurbtess"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GL32;LIBRARYBUILD"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GL32;LIBRARYBUILD;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/glu.pch"
@@ -418,11 +418,11 @@ >
</File>
<File
- RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\glimports.h"
+ RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glimports.h"
>
</File>
<File
- RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glimports.h"
+ RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\glimports.h"
>
</File>
<File
@@ -518,19 +518,19 @@ >
</File>
<File
- RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdio.h"
+ RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\mystdio.h"
>
</File>
<File
- RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\mystdio.h"
+ RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdio.h"
>
</File>
<File
- RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdlib.h"
+ RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\mystdlib.h"
>
</File>
<File
- RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\mystdlib.h"
+ RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdlib.h"
>
</File>
<File
diff --git a/windows/VC8/mesa/mesa.sln b/windows/VC8/mesa/mesa.sln index 46d361ae28a..5eff4884300 100644 --- a/windows/VC8/mesa/mesa.sln +++ b/windows/VC8/mesa/mesa.sln @@ -6,6 +6,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdi", "gdi\gdi.vcproj", "{A EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glu", "glu\glu.vcproj", "{2E50FDAF-430B-475B-AE6B-60B68F2875BA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {A1B24907-E196-4826-B6AF-26723629B633} = {A1B24907-E196-4826-B6AF-26723629B633}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mesa", "mesa\mesa.vcproj", "{2120C974-2717-4709-B44F-D6E6D0A56448}"
EndProject
diff --git a/windows/VC8/mesa/mesa/mesa.vcproj b/windows/VC8/mesa/mesa/mesa.vcproj index 58856842a36..acbbf18cb40 100644 --- a/windows/VC8/mesa/mesa/mesa.vcproj +++ b/windows/VC8/mesa/mesa/mesa.vcproj @@ -530,6 +530,10 @@ >
</File>
<File
+ RelativePath="..\..\..\..\src\mesa\shader\prog_uniform.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\src\mesa\shader\program.c"
>
</File>
@@ -1367,6 +1371,10 @@ >
</File>
<File
+ RelativePath="..\..\..\..\src\mesa\shader\prog_uniform.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\src\mesa\shader\program.h"
>
</File>
|