diff options
Diffstat (limited to 'xorg-server/hw/xgl/glxext')
-rw-r--r-- | xorg-server/hw/xgl/glxext/Makefile.am | 21 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/Makefile.in | 773 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/module/Makefile.am | 22 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/module/Makefile.in | 700 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/module/glcoremodule.c | 38 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/module/glxmodule.c | 38 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/xglglxext.c | 5772 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/xglglxext.h | 41 | ||||
-rw-r--r-- | xorg-server/hw/xgl/glxext/xglglxlog.c | 4519 |
9 files changed, 11924 insertions, 0 deletions
diff --git a/xorg-server/hw/xgl/glxext/Makefile.am b/xorg-server/hw/xgl/glxext/Makefile.am new file mode 100644 index 000000000..f79b855e7 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/Makefile.am @@ -0,0 +1,21 @@ +SUBDIRS = module + +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I$(top_srcdir)/hw/xgl \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi + +libxglglxext_libraries = libxglglxext.la +libxglglxext_la_SOURCES = \ + xglglxext.h \ + xglglxext.c \ + xglglxlog.c + +noinst_LTLIBRARIES = $(libxglglxext_libraries) + diff --git a/xorg-server/hw/xgl/glxext/Makefile.in b/xorg-server/hw/xgl/glxext/Makefile.in new file mode 100644 index 000000000..8a034935b --- /dev/null +++ b/xorg-server/hw/xgl/glxext/Makefile.in @@ -0,0 +1,773 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = hw/xgl/glxext +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xgl-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libxglglxext_la_LIBADD = +am_libxglglxext_la_OBJECTS = xglglxext.lo xglglxlog.lo +libxglglxext_la_OBJECTS = $(am_libxglglxext_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libxglglxext_la_SOURCES) +DIST_SOURCES = $(libxglglxext_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPDEFAULTDIR = @APPDEFAULTDIR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD = @LAUNCHD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +MKFONTDIR = @MKFONTDIR@ +MKFONTSCALE = @MKFONTSCALE@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ +XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ +XGLMODULES_LIBS = @XGLMODULES_LIBS@ +XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ +XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ +XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ +XGL_LIBS = @XGL_LIBS@ +XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ +XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ +XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ +XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ +XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ +XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +ft_config = @ft_config@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xglmoduledir = @xglmoduledir@ +xpconfigdir = @xpconfigdir@ +SUBDIRS = module +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I$(top_srcdir)/hw/xgl \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi + +libxglglxext_libraries = libxglglxext.la +libxglglxext_la_SOURCES = \ + xglglxext.h \ + xglglxext.c \ + xglglxlog.c + +noinst_LTLIBRARIES = $(libxglglxext_libraries) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/glxext/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/glxext/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxglglxext.la: $(libxglglxext_la_OBJECTS) $(libxglglxext_la_DEPENDENCIES) + $(LINK) $(libxglglxext_la_OBJECTS) $(libxglglxext_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglxext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglxlog.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/xgl/glxext/module/Makefile.am b/xorg-server/hw/xgl/glxext/module/Makefile.am new file mode 100644 index 000000000..67653cde4 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/Makefile.am @@ -0,0 +1,22 @@ +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/hw/xgl + +libglx_la_LDFLAGS = -avoid-version +libglx_la_SOURCES = glxmodule.c +libglx_la_LIBADD = $(top_builddir)/glx/libglx.la +libglx_modules = libglx.la + +libglcore_la_LDFLAGS = -avoid-version +libglcore_la_SOURCES = glcoremodule.c +libglcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la +libglcore_modules = libglcore.la + +moduledir = @XGL_MODULE_PATH@ + +module_LTLIBRARIES = \ + $(libglcore_modules) \ + $(libglx_modules) diff --git a/xorg-server/hw/xgl/glxext/module/Makefile.in b/xorg-server/hw/xgl/glxext/module/Makefile.in new file mode 100644 index 000000000..733dfebd2 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/Makefile.in @@ -0,0 +1,700 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = hw/xgl/glxext/module +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xgl-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(moduledir)" +moduleLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(module_LTLIBRARIES) +libglcore_la_DEPENDENCIES = $(top_builddir)/GL/mesa/libGLcore.la +am_libglcore_la_OBJECTS = glcoremodule.lo +libglcore_la_OBJECTS = $(am_libglcore_la_OBJECTS) +libglcore_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libglcore_la_LDFLAGS) $(LDFLAGS) -o $@ +libglx_la_DEPENDENCIES = $(top_builddir)/glx/libglx.la +am_libglx_la_OBJECTS = glxmodule.lo +libglx_la_OBJECTS = $(am_libglx_la_OBJECTS) +libglx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libglx_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libglcore_la_SOURCES) $(libglx_la_SOURCES) +DIST_SOURCES = $(libglcore_la_SOURCES) $(libglx_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPDEFAULTDIR = @APPDEFAULTDIR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD = @LAUNCHD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +MKFONTDIR = @MKFONTDIR@ +MKFONTSCALE = @MKFONTSCALE@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ +XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ +XGLMODULES_LIBS = @XGLMODULES_LIBS@ +XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ +XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ +XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ +XGL_LIBS = @XGL_LIBS@ +XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ +XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ +XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ +XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ +XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ +XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +ft_config = @ft_config@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @XGL_MODULE_PATH@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xglmoduledir = @xglmoduledir@ +xpconfigdir = @xpconfigdir@ +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/hw/xgl + +libglx_la_LDFLAGS = -avoid-version +libglx_la_SOURCES = glxmodule.c +libglx_la_LIBADD = $(top_builddir)/glx/libglx.la +libglx_modules = libglx.la +libglcore_la_LDFLAGS = -avoid-version +libglcore_la_SOURCES = glcoremodule.c +libglcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la +libglcore_modules = libglcore.la +module_LTLIBRARIES = \ + $(libglcore_modules) \ + $(libglx_modules) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/glxext/module/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/glxext/module/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-moduleLTLIBRARIES: $(module_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)" + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \ + else :; fi; \ + done + +uninstall-moduleLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \ + done + +clean-moduleLTLIBRARIES: + -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libglcore.la: $(libglcore_la_OBJECTS) $(libglcore_la_DEPENDENCIES) + $(libglcore_la_LINK) -rpath $(moduledir) $(libglcore_la_OBJECTS) $(libglcore_la_LIBADD) $(LIBS) +libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES) + $(libglx_la_LINK) -rpath $(moduledir) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glcoremodule.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxmodule.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(moduledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-moduleLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-moduleLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-moduleLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-moduleLTLIBRARIES install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-moduleLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/xgl/glxext/module/glcoremodule.c b/xorg-server/hw/xgl/glxext/module/glcoremodule.c new file mode 100644 index 000000000..37aa9c658 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/glcoremodule.c @@ -0,0 +1,38 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglmodule.h" + +char * +moduleVersion (void) +{ + return VERSION; +} + +Bool +moduleInit (const char *module) +{ + return TRUE; +} diff --git a/xorg-server/hw/xgl/glxext/module/glxmodule.c b/xorg-server/hw/xgl/glxext/module/glxmodule.c new file mode 100644 index 000000000..37aa9c658 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/glxmodule.c @@ -0,0 +1,38 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglmodule.h" + +char * +moduleVersion (void) +{ + return VERSION; +} + +Bool +moduleInit (const char *module) +{ + return TRUE; +} diff --git a/xorg-server/hw/xgl/glxext/xglglxext.c b/xorg-server/hw/xgl/glxext/xglglxext.c new file mode 100644 index 000000000..c260d8e2d --- /dev/null +++ b/xorg-server/hw/xgl/glxext/xglglxext.c @@ -0,0 +1,5772 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "xglglx.h" +#include "xglglxext.h" + +#include <GL/gl.h> +#include <GL/glext.h> +#include <GL/internal/glcore.h> + +#include "glxserver.h" +#include "glxdrawable.h" +#include "glxscreens.h" +#include "glxutil.h" +#include "unpack.h" +#include "g_disptab.h" +#include "glapitable.h" +#include "glxext.h" +#include "micmap.h" + +#define XGL_MAX_TEXTURE_UNITS 8 +#define XGL_MAX_ATTRIB_STACK_DEPTH 16 + +#define XGL_TEXTURE_1D_BIT (1 << 0) +#define XGL_TEXTURE_2D_BIT (1 << 1) +#define XGL_TEXTURE_3D_BIT (1 << 2) +#define XGL_TEXTURE_RECTANGLE_BIT (1 << 3) +#define XGL_TEXTURE_CUBE_MAP_BIT (1 << 4) + +typedef Bool (*GLXScreenProbeProc) (int screen); +typedef __GLinterface *(*GLXCreateContextProc) (__GLimports *imports, + __GLcontextModes *modes, + __GLinterface *shareGC); +typedef void (*GLXCreateBufferProc) (__GLXdrawablePrivate *glxPriv); +typedef GLboolean (*GLXSwapBuffersProc) (__GLXdrawablePrivate *glxPriv); +typedef int (*GLXBindBuffersProc) (__GLXdrawablePrivate *glxPriv, + int buffer); +typedef int (*GLXReleaseBuffersProc) (__GLXdrawablePrivate *glxPriv, + int buffer); + +typedef struct _xglGLXScreenInfo { + GLXScreenProbeProc screenProbe; + GLXCreateContextProc createContext; + GLXCreateBufferProc createBuffer; +} xglGLXScreenInfoRec, *xglGLXScreenInfoPtr; + +extern __GLXscreenInfo *__xglScreenInfoPtr; + +static xglGLXScreenInfoRec screenInfoPriv; + +//extern __GLXscreenInfo __glDDXScreenInfo; + +typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer *buffer, + GLint x, + GLint y, + GLuint width, + GLuint height, + __GLdrawablePrivate *glPriv, + GLuint bufferMask); +typedef void (*GLFreeBuffersProc) (__GLdrawablePrivate *glPriv); + +typedef struct _xglGLBuffer { + GLXSwapBuffersProc swapBuffers; + GLXBindBuffersProc bindBuffers; + GLXReleaseBuffersProc releaseBuffers; + GLResizeBuffersProc resizeBuffers; + GLFreeBuffersProc freeBuffers; + ScreenPtr pScreen; + DrawablePtr pDrawable; + xglVisualPtr pVisual; + glitz_drawable_t *drawable; + glitz_surface_t *backSurface; + PixmapPtr pPixmap; + GCPtr pGC; + RegionRec damage; + void *private; + int screenX, screenY; + int xOff, yOff; + int yFlip; +} xglGLBufferRec, *xglGLBufferPtr; + +typedef int xglGLXVisualConfigRec, *xglGLXVisualConfigPtr; +typedef struct _xglDisplayList *xglDisplayListPtr; + +#define XGL_LIST_OP_CALLS 0 +#define XGL_LIST_OP_DRAW 1 +#define XGL_LIST_OP_GL 2 +#define XGL_LIST_OP_LIST 3 + +typedef struct _xglGLOp { + void (*glProc) (struct _xglGLOp *pOp); + union { + GLenum enumeration; + GLbitfield bitfield; + GLsizei size; + struct { + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } rect; + struct { + GLenum target; + GLuint texture; + } bind_texture; + struct { + GLenum target; + GLenum pname; + GLfloat params[4]; + } tex_parameter_fv; + struct { + GLint x; + GLint y; + GLsizei width; + GLsizei height; + GLenum type; + } copy_pixels; + struct { + GLenum target; + GLint level; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLint border; + } copy_tex_image_1d; + struct { + GLenum target; + GLint level; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + GLint border; + } copy_tex_image_2d; + struct { + GLenum target; + GLint level; + GLint xoffset; + GLint x; + GLint y; + GLsizei width; + } copy_tex_sub_image_1d; + struct { + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } copy_tex_sub_image_2d; + struct { + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + } copy_color_table; + struct { + GLenum target; + GLsizei start; + GLint x; + GLint y; + GLsizei width; + } copy_color_sub_table; + struct { + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + } copy_convolution_filter_1d; + struct { + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } copy_convolution_filter_2d; + struct { + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint zoffset; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } copy_tex_sub_image_3d; + struct { + GLfloat x; + GLfloat y; + GLfloat z; + } window_pos_3f; + } u; +} xglGLOpRec, *xglGLOpPtr; + +typedef struct _xglListOp { + int type; + union { + GLuint list; + xglGLOpPtr gl; + } u; +} xglListOpRec, *xglListOpPtr; + +typedef struct _xglDisplayList { + xglListOpPtr pOp; + int nOp; + int size; +} xglDisplayListRec; + +typedef struct _xglTexObj { + GLuint key; + GLuint name; + PixmapPtr pPixmap; + glitz_texture_object_t *object; + int refcnt; +} xglTexObjRec, *xglTexObjPtr; + +typedef struct _xglTexUnit { + GLbitfield enabled; + xglTexObjPtr p1D; + xglTexObjPtr p2D; + xglTexObjPtr p3D; + xglTexObjPtr pRect; + xglTexObjPtr pCubeMap; +} xglTexUnitRec, *xglTexUnitPtr; + +typedef struct _xglGLAttributes { + GLbitfield mask; + GLenum drawBuffer; + GLenum readBuffer; + xRectangle viewport; + xRectangle scissor; + GLboolean scissorTest; + xglTexUnitRec texUnits[XGL_MAX_TEXTURE_UNITS]; +} xglGLAttributesRec, *xglGLAttributesPtr; + +typedef struct _xglGLContext { + __GLinterface iface; + __GLinterface *mIface; + int refcnt; + struct _xglGLContext *shared; + glitz_context_t *context; + struct _glapi_table glRenderTable; + PFNGLACTIVETEXTUREARBPROC ActiveTextureARB; + PFNGLWINDOWPOS3FMESAPROC WindowPos3fMESA; + Bool needInit; + xglGLBufferPtr pDrawBuffer; + xglGLBufferPtr pReadBuffer; + int drawXoff, drawYoff; + __GLdrawablePrivate *readPriv; + __GLdrawablePrivate *drawPriv; + char *versionString; + GLenum errorValue; + GLboolean doubleBuffer; + GLint depthBits; + GLint stencilBits; + xglHashTablePtr texObjects; + xglHashTablePtr displayLists; + GLuint list; + GLenum listMode; + GLuint beginCnt; + xglDisplayListPtr pList; + GLuint groupList; + xglGLAttributesRec attrib; + xglGLAttributesRec attribStack[XGL_MAX_ATTRIB_STACK_DEPTH]; + int nAttribStack; + int activeTexUnit; + GLint maxTexUnits; + GLint maxListNesting; + GLint maxAttribStackDepth; +} xglGLContextRec, *xglGLContextPtr; + +static xglGLContextPtr cctx = NULL; + +static void +xglSetCurrentContext (xglGLContextPtr pContext); + +#define XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES(pBox, nBox, pScissorBox) \ + (pBox) = REGION_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \ + (nBox) = REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \ + (pScissorBox)->x1 = cctx->attrib.scissor.x + cctx->pDrawBuffer->xOff; \ + (pScissorBox)->x2 = (pScissorBox)->x1 + cctx->attrib.scissor.width; \ + (pScissorBox)->y2 = cctx->attrib.scissor.y + cctx->pDrawBuffer->yOff; \ + (pScissorBox)->y2 = cctx->pDrawBuffer->yFlip - (pScissorBox)->y2; \ + (pScissorBox)->y1 = (pScissorBox)->y2 - cctx->attrib.scissor.height + +#define XGL_GLX_DRAW_PROLOGUE(pBox, nBox, pScissorBox) \ + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, pScissorBox); \ + xglSetupTextures () + +#define XGL_GLX_DRAW_BOX(pBox1, pBox2) \ + (pBox1)->x1 = cctx->pDrawBuffer->screenX + (pBox2)->x1; \ + (pBox1)->y1 = cctx->pDrawBuffer->screenY + (pBox2)->y1; \ + (pBox1)->x2 = cctx->pDrawBuffer->screenX + (pBox2)->x2; \ + (pBox1)->y2 = cctx->pDrawBuffer->screenY + (pBox2)->y2 + +#define XGL_GLX_INTERSECT_BOX(pBox1, pBox2) \ + { \ + if ((pBox1)->x1 < (pBox2)->x1) \ + (pBox1)->x1 = (pBox2)->x1; \ + if ((pBox1)->y1 < (pBox2)->y1) \ + (pBox1)->y1 = (pBox2)->y1; \ + if ((pBox1)->x2 > (pBox2)->x2) \ + (pBox1)->x2 = (pBox2)->x2; \ + if ((pBox1)->y2 > (pBox2)->y2) \ + (pBox1)->y2 = (pBox2)->y2; \ + } + +#define XGL_GLX_SET_SCISSOR_BOX(pBox) \ + glScissor ((pBox)->x1, \ + cctx->pDrawBuffer->yFlip - (pBox)->y2, \ + (pBox)->x2 - (pBox)->x1, \ + (pBox)->y2 - (pBox)->y1) + +#define XGL_GLX_DRAW_DAMAGE(pBox, pRegion) \ + if (cctx->attrib.drawBuffer != GL_BACK) \ + { \ + (pRegion)->extents.x1 = (pBox)->x1 - cctx->pDrawBuffer->screenX; \ + (pRegion)->extents.y1 = (pBox)->y1 - cctx->pDrawBuffer->screenY; \ + (pRegion)->extents.x2 = (pBox)->x2 - cctx->pDrawBuffer->screenX; \ + (pRegion)->extents.y2 = (pBox)->y2 - cctx->pDrawBuffer->screenY; \ + (pRegion)->data = (RegDataPtr) NULL; \ + REGION_UNION (cctx->pDrawBuffer->pGC->pScreen, \ + &cctx->pDrawBuffer->damage, \ + &cctx->pDrawBuffer->damage, \ + pRegion); \ + xglAddBitDamage (cctx->pDrawBuffer->pDrawable, pRegion); \ + } + +static void +xglRecordError (GLenum error) +{ + if (cctx->errorValue == GL_NO_ERROR) + cctx->errorValue = error; +} + +static xglDisplayListPtr +xglCreateList (void) +{ + xglDisplayListPtr pDisplayList; + + pDisplayList = xalloc (sizeof (xglDisplayListRec)); + if (!pDisplayList) + return NULL; + + pDisplayList->pOp = NULL; + pDisplayList->nOp = 0; + pDisplayList->size = 0; + + return pDisplayList; +} + +static void +xglDestroyList (xglDisplayListPtr pDisplayList) +{ + xglListOpPtr pOp = pDisplayList->pOp; + int nOp = pDisplayList->nOp; + + while (nOp--) + { + switch (pOp->type) { + case XGL_LIST_OP_CALLS: + case XGL_LIST_OP_DRAW: + glDeleteLists (pOp->u.list, 1); + break; + case XGL_LIST_OP_GL: + xfree (pOp->u.gl); + break; + case XGL_LIST_OP_LIST: + break; + } + + pOp++; + } + + if (pDisplayList->pOp) + xfree (pDisplayList->pOp); + + xfree (pDisplayList); +} + +static Bool +xglResizeList (xglDisplayListPtr pDisplayList, + int nOp) +{ + if (pDisplayList->size < nOp) + { + int size = pDisplayList->nOp ? pDisplayList->nOp : 4; + + while (size < nOp) + size <<= 1; + + pDisplayList->pOp = xrealloc (pDisplayList->pOp, + sizeof (xglListOpRec) * size); + if (!pDisplayList->pOp) + return FALSE; + + pDisplayList->size = size; + } + + return TRUE; +} + +static void +xglStartList (int type, + GLenum mode) +{ + if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1)) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + cctx->pList->pOp[cctx->pList->nOp].type = type; + cctx->pList->pOp[cctx->pList->nOp].u.list = glGenLists (1); + + glNewList (cctx->pList->pOp[cctx->pList->nOp].u.list, mode); + + cctx->pList->nOp++; +} + +static void +xglGLOp (xglGLOpPtr pOp) +{ + if (cctx->list) + { + xglGLOpPtr pGLOp; + + pGLOp = xalloc (sizeof (xglGLOpRec)); + if (!pGLOp) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1)) + { + xfree (pGLOp); + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + glEndList (); + + *pGLOp = *pOp; + + cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_GL; + cctx->pList->pOp[cctx->pList->nOp].u.gl = pGLOp; + cctx->pList->nOp++; + + if (cctx->listMode == GL_COMPILE_AND_EXECUTE) + (*pOp->glProc) (pOp); + + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); + } + else + (*pOp->glProc) (pOp); +} + +static void +xglViewportProc (xglGLOpPtr pOp) +{ + cctx->attrib.viewport.x = pOp->u.rect.x; + cctx->attrib.viewport.y = pOp->u.rect.y; + cctx->attrib.viewport.width = pOp->u.rect.width; + cctx->attrib.viewport.height = pOp->u.rect.height; + + glViewport (pOp->u.rect.x + cctx->pDrawBuffer->xOff, + pOp->u.rect.y + cctx->pDrawBuffer->yOff, + pOp->u.rect.width, + pOp->u.rect.height); +} + +static void +xglViewport (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglViewportProc; + + gl.u.rect.x = x; + gl.u.rect.y = y; + gl.u.rect.width = width; + gl.u.rect.height = height; + + xglGLOp (&gl); +} + +static void +xglScissorProc (xglGLOpPtr pOp) +{ + cctx->attrib.scissor.x = pOp->u.rect.x; + cctx->attrib.scissor.y = pOp->u.rect.y; + cctx->attrib.scissor.width = pOp->u.rect.width; + cctx->attrib.scissor.height = pOp->u.rect.height; +} + +static void +xglScissor (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglScissorProc; + + gl.u.rect.x = x; + gl.u.rect.y = y; + gl.u.rect.width = width; + gl.u.rect.height = height; + + xglGLOp (&gl); +} + +static void +xglDrawBufferProc (xglGLOpPtr pOp) +{ + glitz_drawable_buffer_t buffers[2]; + + switch (pOp->u.enumeration) { + case GL_FRONT: + buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR; + glitz_context_draw_buffers (cctx->context, buffers, 1); + break; + case GL_FRONT_AND_BACK: + buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR; + if (cctx->doubleBuffer) + { + buffers[1] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR; + glitz_context_draw_buffers (cctx->context, buffers, 2); + } + else + glitz_context_draw_buffers (cctx->context, buffers, 1); + break; + case GL_BACK: + if (!cctx->doubleBuffer) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + buffers[0] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR; + glitz_context_draw_buffers (cctx->context, buffers, 1); + break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + cctx->attrib.drawBuffer = pOp->u.enumeration; +} + +static void +xglDrawBuffer (GLenum mode) +{ + xglGLOpRec gl; + + gl.glProc = xglDrawBufferProc; + + gl.u.enumeration = mode; + + xglGLOp (&gl); +} + +static void +xglReadBufferProc (xglGLOpPtr pOp) +{ + switch (pOp->u.enumeration) { + case GL_FRONT: + glitz_context_read_buffer (cctx->context, + GLITZ_DRAWABLE_BUFFER_FRONT_COLOR); + break; + case GL_BACK: + if (!cctx->doubleBuffer) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + glitz_context_read_buffer (cctx->context, + GLITZ_DRAWABLE_BUFFER_BACK_COLOR); + break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + cctx->attrib.readBuffer = pOp->u.enumeration; +} + +static void +xglReadBuffer (GLenum mode) +{ + xglGLOpRec gl; + + gl.glProc = xglReadBufferProc; + + gl.u.enumeration = mode; + + xglGLOp (&gl); +} + +static void +xglDisableProc (xglGLOpPtr pOp) +{ + xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit]; + + switch (pOp->u.enumeration) { + case GL_SCISSOR_TEST: + cctx->attrib.scissorTest = GL_FALSE; + return; + case GL_TEXTURE_1D: + pTexUnit->enabled &= ~XGL_TEXTURE_1D_BIT; + break; + case GL_TEXTURE_2D: + pTexUnit->enabled &= ~XGL_TEXTURE_2D_BIT; + break; + case GL_TEXTURE_3D: + pTexUnit->enabled &= ~XGL_TEXTURE_3D_BIT; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexUnit->enabled &= ~XGL_TEXTURE_RECTANGLE_BIT; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + pTexUnit->enabled &= ~XGL_TEXTURE_CUBE_MAP_BIT; + break; + default: + break; + } + + glDisable (pOp->u.enumeration); +} + +static void +xglDisable (GLenum cap) +{ + xglGLOpRec gl; + + gl.glProc = xglDisableProc; + + gl.u.enumeration = cap; + + xglGLOp (&gl); +} + +static void +xglEnableProc (xglGLOpPtr pOp) +{ + xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit]; + + switch (pOp->u.enumeration) { + case GL_SCISSOR_TEST: + cctx->attrib.scissorTest = GL_TRUE; + return; + case GL_DEPTH_TEST: + if (!cctx->depthBits) + return; + case GL_STENCIL_TEST: + if (!cctx->stencilBits) + return; + case GL_TEXTURE_1D: + pTexUnit->enabled |= XGL_TEXTURE_1D_BIT; + break; + case GL_TEXTURE_2D: + pTexUnit->enabled |= XGL_TEXTURE_2D_BIT; + break; + case GL_TEXTURE_3D: + pTexUnit->enabled |= XGL_TEXTURE_3D_BIT; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexUnit->enabled |= XGL_TEXTURE_RECTANGLE_BIT; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + pTexUnit->enabled |= XGL_TEXTURE_CUBE_MAP_BIT; + break; + default: + break; + } + + glEnable (pOp->u.enumeration); +} + +static void +xglEnable (GLenum cap) +{ + xglGLOpRec gl; + + gl.glProc = xglEnableProc; + + gl.u.enumeration = cap; + + xglGLOp (&gl); +} + +static void +xglDeleteTexObj (xglTexObjPtr pTexObj) +{ + if (pTexObj->pPixmap) + { + ScreenPtr pScreen = pTexObj->pPixmap->drawable.pScreen; + + (*pScreen->DestroyPixmap) (pTexObj->pPixmap); + + glitz_texture_object_destroy (pTexObj->object); + } + + if (pTexObj->name) + { + glDeleteTextures (1, &pTexObj->name); + } + + pTexObj->key = 0; + pTexObj->name = 0; + pTexObj->pPixmap = NULL; + pTexObj->object = NULL; +} + +static void +xglRefTexObj (xglTexObjPtr pTexObj) +{ + if (!pTexObj) + return; + + pTexObj->refcnt++; +} + +static void +xglUnrefTexObj (xglTexObjPtr pTexObj) +{ + if (!pTexObj) + return; + + pTexObj->refcnt--; + if (pTexObj->refcnt) + return; + + xglDeleteTexObj (pTexObj); + + xfree (pTexObj); +} + +static void +xglPushAttribProc (xglGLOpPtr pOp) +{ + xglGLAttributesPtr pAttrib; + + if (cctx->nAttribStack == cctx->maxAttribStackDepth) + { + xglRecordError (GL_STACK_OVERFLOW); + return; + } + + pAttrib = &cctx->attribStack[cctx->nAttribStack]; + + *pAttrib = cctx->attrib; + pAttrib->mask = pOp->u.bitfield; + + if (pOp->u.bitfield & GL_TEXTURE_BIT) + { + int i; + + for (i = 0; i < cctx->maxTexUnits; i++) + { + xglRefTexObj (pAttrib->texUnits[i].p1D); + xglRefTexObj (pAttrib->texUnits[i].p2D); + xglRefTexObj (pAttrib->texUnits[i].p3D); + xglRefTexObj (pAttrib->texUnits[i].pRect); + xglRefTexObj (pAttrib->texUnits[i].pCubeMap); + } + } + + cctx->nAttribStack++; + + glPushAttrib (pOp->u.bitfield); +} + +static void +xglPushAttrib (GLbitfield mask) +{ + xglGLOpRec gl; + + gl.glProc = xglPushAttribProc; + + gl.u.bitfield = mask; + + xglGLOp (&gl); +} + +static void +xglPopAttribProc (xglGLOpPtr pOp) +{ + xglGLAttributesPtr pAttrib; + GLbitfield mask; + + if (!cctx->nAttribStack) + { + xglRecordError (GL_STACK_UNDERFLOW); + return; + } + + cctx->nAttribStack--; + + pAttrib = &cctx->attribStack[cctx->nAttribStack]; + mask = pAttrib->mask; + + if (mask & GL_COLOR_BUFFER_BIT) + xglDrawBuffer (pAttrib->drawBuffer); + + if (mask & GL_PIXEL_MODE_BIT) + xglReadBuffer (pAttrib->readBuffer); + + if (mask & GL_SCISSOR_BIT) + { + xglScissor (pAttrib->scissor.x, + pAttrib->scissor.y, + pAttrib->scissor.width, + pAttrib->scissor.height); + + if (pAttrib->scissorTest) + xglEnable (GL_SCISSOR_TEST); + else + xglDisable (GL_SCISSOR_TEST); + } + else if (mask & GL_ENABLE_BIT) + { + if (pAttrib->scissorTest) + xglEnable (GL_SCISSOR_TEST); + else + xglDisable (GL_SCISSOR_TEST); + } + + if (mask & GL_VIEWPORT_BIT) + xglViewport (pAttrib->viewport.x, + pAttrib->viewport.y, + pAttrib->viewport.width, + pAttrib->viewport.height); + + if (mask & GL_TEXTURE_BIT) + { + int i; + + for (i = 0; i < cctx->maxTexUnits; i++) + { + xglUnrefTexObj (cctx->attrib.texUnits[i].p1D); + xglUnrefTexObj (cctx->attrib.texUnits[i].p2D); + xglUnrefTexObj (cctx->attrib.texUnits[i].p3D); + xglUnrefTexObj (cctx->attrib.texUnits[i].pRect); + xglUnrefTexObj (cctx->attrib.texUnits[i].pCubeMap); + + cctx->attrib.texUnits[i] = pAttrib->texUnits[i]; + } + } + else if (mask & GL_ENABLE_BIT) + { + int i; + + for (i = 0; i < cctx->maxTexUnits; i++) + cctx->attrib.texUnits[i].enabled = pAttrib->texUnits[i].enabled; + } + + glPopAttrib (); +} + +static void +xglPopAttrib (void) +{ + xglGLOpRec gl; + + gl.glProc = xglPopAttribProc; + + xglGLOp (&gl); +} + +static GLuint +xglActiveTextureBinding (GLenum target) +{ + xglTexObjPtr pTexObj; + + switch (target) { + case GL_TEXTURE_BINDING_1D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p1D; + break; + case GL_TEXTURE_BINDING_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_BINDING_3D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p3D; + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap; + break; + default: + return 0; + } + + if (pTexObj) + return pTexObj->key; + + return 0; +} + +#define DOUBLE_TO_BOOLEAN(X) ((X) ? GL_TRUE : GL_FALSE) +#define INT_TO_BOOLEAN(I) ((I) ? GL_TRUE : GL_FALSE) +#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE) + +static void +xglGetBooleanv (GLenum pname, + GLboolean *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + { + GLdouble v[4]; + + glGetDoublev (GL_CURRENT_RASTER_POSITION, v); + + params[0] = DOUBLE_TO_BOOLEAN (v[0] - (GLdouble) cctx->drawXoff); + params[1] = DOUBLE_TO_BOOLEAN (v[1] - (GLdouble) cctx->drawYoff); + params[2] = DOUBLE_TO_BOOLEAN (v[2]); + params[3] = DOUBLE_TO_BOOLEAN (v[3]); + } break; + case GL_DOUBLEBUFFER: + params[0] = cctx->doubleBuffer; + break; + case GL_DEPTH_BITS: + params[0] = INT_TO_BOOLEAN (cctx->depthBits); + break; + case GL_STENCIL_BITS: + params[0] = INT_TO_BOOLEAN (cctx->stencilBits); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_BOOLEAN (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_BOOLEAN (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = INT_TO_BOOLEAN (cctx->attrib.scissor.x); + params[1] = INT_TO_BOOLEAN (cctx->attrib.scissor.y); + params[2] = INT_TO_BOOLEAN (cctx->attrib.scissor.width); + params[3] = INT_TO_BOOLEAN (cctx->attrib.scissor.height); + break; + case GL_SCISSOR_TEST: + params[0] = cctx->attrib.scissorTest; + break; + case GL_VIEWPORT: + params[0] = INT_TO_BOOLEAN (cctx->attrib.viewport.x); + params[1] = INT_TO_BOOLEAN (cctx->attrib.viewport.y); + params[2] = INT_TO_BOOLEAN (cctx->attrib.viewport.width); + params[3] = INT_TO_BOOLEAN (cctx->attrib.viewport.height); + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + /* should be safe to fall-through here */ + default: + glGetBooleanv (pname, params); + } +} + +#define INT_TO_DOUBLE(I) ((GLdouble) (I)) +#define ENUM_TO_DOUBLE(E) ((GLdouble) (E)) +#define BOOLEAN_TO_DOUBLE(B) ((B) ? 1.0F : 0.0F) + +static void +xglGetDoublev (GLenum pname, + GLdouble *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + glGetDoublev (GL_CURRENT_RASTER_POSITION, params); + + params[0] -= (GLdouble) cctx->drawXoff; + params[1] -= (GLdouble) cctx->drawYoff; + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_DOUBLE (cctx->doubleBuffer); + break; + case GL_DEPTH_BITS: + params[0] = INT_TO_DOUBLE (cctx->depthBits); + break; + case GL_STENCIL_BITS: + params[0] = INT_TO_DOUBLE (cctx->stencilBits); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_DOUBLE (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_DOUBLE (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = cctx->attrib.scissor.x; + params[1] = cctx->attrib.scissor.y; + params[2] = cctx->attrib.scissor.width; + params[3] = cctx->attrib.scissor.height; + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_DOUBLE (cctx->attrib.scissorTest); + break; + case GL_VIEWPORT: + params[0] = cctx->attrib.viewport.x; + params[1] = cctx->attrib.viewport.y; + params[2] = cctx->attrib.viewport.width; + params[3] = cctx->attrib.viewport.height; + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + params[0] = xglActiveTextureBinding (pname); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + params[0] = cctx->maxTexUnits; + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = cctx->maxAttribStackDepth; + break; + default: + glGetDoublev (pname, params); + } +} + +#define INT_TO_FLOAT(I) ((GLfloat) (I)) +#define ENUM_TO_FLOAT(E) ((GLfloat) (E)) +#define BOOLEAN_TO_FLOAT(B) ((B) ? 1.0F : 0.0F) + +static void +xglGetFloatv (GLenum pname, + GLfloat *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + glGetFloatv (GL_CURRENT_RASTER_POSITION, params); + + params[0] -= (GLfloat) cctx->drawXoff; + params[1] -= (GLfloat) cctx->drawYoff; + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_FLOAT (cctx->doubleBuffer); + break; + case GL_DEPTH_BITS: + params[0] = INT_TO_FLOAT (cctx->depthBits); + break; + case GL_STENCIL_BITS: + params[0] = INT_TO_FLOAT (cctx->stencilBits); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_FLOAT (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_FLOAT (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = cctx->attrib.scissor.x; + params[1] = cctx->attrib.scissor.y; + params[2] = cctx->attrib.scissor.width; + params[3] = cctx->attrib.scissor.height; + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_FLOAT (cctx->attrib.scissorTest); + break; + case GL_VIEWPORT: + params[0] = cctx->attrib.viewport.x; + params[1] = cctx->attrib.viewport.y; + params[2] = cctx->attrib.viewport.width; + params[3] = cctx->attrib.viewport.height; + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + params[0] = xglActiveTextureBinding (pname); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + params[0] = cctx->maxTexUnits; + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = cctx->maxAttribStackDepth; + break; + default: + glGetFloatv (pname, params); + } +} + +#define ENUM_TO_INT(E) ((GLint) (E)) +#define BOOLEAN_TO_INT(B) ((GLint) (B)) + +static void +xglGetIntegerv (GLenum pname, + GLint *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + glGetIntegerv (GL_CURRENT_RASTER_POSITION, params); + + params[0] -= (GLint) cctx->drawXoff; + params[1] -= (GLint) cctx->drawYoff; + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_INT (cctx->doubleBuffer); + break; + case GL_DEPTH_BITS: + params[0] = cctx->depthBits; + break; + case GL_STENCIL_BITS: + params[0] = cctx->stencilBits; + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_INT (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_INT (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = cctx->attrib.scissor.x; + params[1] = cctx->attrib.scissor.y; + params[2] = cctx->attrib.scissor.width; + params[3] = cctx->attrib.scissor.height; + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_INT (cctx->attrib.scissorTest); + break; + case GL_VIEWPORT: + params[0] = cctx->attrib.viewport.x; + params[1] = cctx->attrib.viewport.y; + params[2] = cctx->attrib.viewport.width; + params[3] = cctx->attrib.viewport.height; + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + params[0] = xglActiveTextureBinding (pname); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + params[0] = cctx->maxTexUnits; + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = cctx->maxAttribStackDepth; + break; + default: + glGetIntegerv (pname, params); + } +} + +static GLboolean +xglIsEnabled (GLenum cap) +{ + switch (cap) { + case GL_SCISSOR_TEST: + return cctx->attrib.scissorTest; + default: + return glIsEnabled (cap); + } +} + +static GLenum +xglGetError (void) +{ + GLenum error = cctx->errorValue; + + if (error != GL_NO_ERROR) + { + cctx->errorValue = GL_NO_ERROR; + return error; + } + + return glGetError (); +} + +static const GLubyte * +xglGetString (GLenum name) +{ + switch (name) { + case GL_VERSION: + if (!cctx->versionString) + { + static char *version = "1.2 (%s)"; + char *nativeVersion = (char *) glGetString (GL_VERSION); + + cctx->versionString = xalloc (strlen (version) + + strlen (nativeVersion)); + if (cctx->versionString) + sprintf (cctx->versionString, version, nativeVersion); + } + return (GLubyte *) cctx->versionString; + default: + return glGetString (name); + } +} + +static void +xglGenTextures (GLsizei n, + GLuint *textures) +{ + xglTexObjPtr pTexObj; + GLuint name; + + name = xglHashFindFreeKeyBlock (cctx->shared->texObjects, n); + + glGenTextures (n, textures); + + while (n--) + { + pTexObj = xalloc (sizeof (xglTexObjRec)); + if (pTexObj) + { + pTexObj->key = name; + pTexObj->name = *textures; + pTexObj->pPixmap = NULL; + pTexObj->object = NULL; + pTexObj->refcnt = 1; + + xglHashInsert (cctx->shared->texObjects, name, pTexObj); + } + else + { + xglRecordError (GL_OUT_OF_MEMORY); + } + + *textures++ = name++; + } +} + +static void +xglBindTextureProc (xglGLOpPtr pOp) +{ + xglTexObjPtr *ppTexObj; + + switch (pOp->u.bind_texture.target) { + case GL_TEXTURE_1D: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p1D; + break; + case GL_TEXTURE_2D: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_3D: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p3D; + break; + case GL_TEXTURE_RECTANGLE_NV: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap; + break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + if (pOp->u.bind_texture.texture) + { + if (!*ppTexObj || pOp->u.bind_texture.texture != (*ppTexObj)->key) + { + xglTexObjPtr pTexObj; + + pTexObj = (xglTexObjPtr) + xglHashLookup (cctx->shared->texObjects, + pOp->u.bind_texture.texture); + if (!pTexObj) + { + pTexObj = xalloc (sizeof (xglTexObjRec)); + if (!pTexObj) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + pTexObj->key = pOp->u.bind_texture.texture; + pTexObj->pPixmap = NULL; + pTexObj->object = NULL; + pTexObj->refcnt = 1; + + glGenTextures (1, &pTexObj->name); + + xglHashInsert (cctx->shared->texObjects, + pOp->u.bind_texture.texture, + pTexObj); + } + + xglRefTexObj (pTexObj); + xglUnrefTexObj (*ppTexObj); + *ppTexObj = pTexObj; + + glBindTexture (pOp->u.bind_texture.target, pTexObj->name); + } + } + else + { + xglUnrefTexObj (*ppTexObj); + *ppTexObj = NULL; + + glBindTexture (pOp->u.bind_texture.target, 0); + } +} + +static void +xglBindTexture (GLenum target, + GLuint texture) +{ + xglGLOpRec gl; + + gl.glProc = xglBindTextureProc; + + gl.u.bind_texture.target = target; + gl.u.bind_texture.texture = texture; + + xglGLOp (&gl); +} + +static void +xglSetupTextures (void) +{ + xglGLContextPtr pContext = cctx; + xglTexUnitPtr pTexUnit; + xglTexObjPtr pTexObj[XGL_MAX_TEXTURE_UNITS]; + int i, activeTexUnit; + + for (i = 0; i < pContext->maxTexUnits; i++) + { + pTexObj[i] = NULL; + + pTexUnit = &pContext->attrib.texUnits[i]; + if (pTexUnit->enabled) + { + if (pTexUnit->enabled & XGL_TEXTURE_RECTANGLE_BIT) + pTexObj[i] = pTexUnit->pRect; + else if (pTexUnit->enabled & XGL_TEXTURE_2D_BIT) + pTexObj[i] = pTexUnit->p2D; + + if (pTexObj[i] && pTexObj[i]->pPixmap) + { + if (!xglSyncSurface (&pTexObj[i]->pPixmap->drawable)) + pTexObj[i] = NULL; + } + else + pTexObj[i] = NULL; + } + } + + if (pContext != cctx) + { + XGL_SCREEN_PRIV (pContext->pDrawBuffer->pGC->pScreen); + + glitz_drawable_finish (pScreenPriv->drawable); + + xglSetCurrentContext (pContext); + } + + activeTexUnit = cctx->activeTexUnit; + for (i = 0; i < pContext->maxTexUnits; i++) + { + if (pTexObj[i]) + { + if (i != activeTexUnit) + { + cctx->ActiveTextureARB (GL_TEXTURE0_ARB + i); + activeTexUnit = i; + } + glitz_context_bind_texture (cctx->context, pTexObj[i]->object); + } + } + + if (activeTexUnit != cctx->activeTexUnit) + cctx->ActiveTextureARB (cctx->activeTexUnit); +} + +static GLboolean +xglAreTexturesResident (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + GLboolean allResident = GL_TRUE; + int i, j; + + if (n < 0) + { + xglRecordError (GL_INVALID_VALUE); + return GL_FALSE; + } + + if (!textures || !residences) + return GL_FALSE; + + for (i = 0; i < n; i++) + { + xglTexObjPtr pTexObj; + GLboolean resident; + + if (!textures[i]) + { + xglRecordError (GL_INVALID_VALUE); + return GL_FALSE; + } + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, + textures[i]); + if (!pTexObj) + { + xglRecordError (GL_INVALID_VALUE); + return GL_FALSE; + } + + if (pTexObj->name == 0 || + glAreTexturesResident (1, &pTexObj->name, &resident)) + { + if (!allResident) + residences[i] = GL_TRUE; + } + else + { + if (allResident) + { + allResident = GL_FALSE; + + for (j = 0; j < i; j++) + residences[j] = GL_TRUE; + } + residences[i] = GL_FALSE; + } + } + + return allResident; +} + +static void +xglDeleteTextures (GLsizei n, + const GLuint *textures) +{ + xglTexObjPtr pTexObj; + + while (n--) + { + if (!*textures) + continue; + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, + *textures); + if (pTexObj) + { + xglDeleteTexObj (pTexObj); + xglUnrefTexObj (pTexObj); + xglHashRemove (cctx->shared->texObjects, *textures); + } + textures++; + } +} + +static GLboolean +xglIsTexture (GLuint texture) +{ + xglTexObjPtr pTexObj; + + if (!texture) + return GL_FALSE; + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, texture); + if (pTexObj) + return GL_TRUE; + + return GL_FALSE; +} + +static void +xglPrioritizeTextures (GLsizei n, + const GLuint *textures, + const GLclampf *priorities) +{ + xglTexObjPtr pTexObj; + int i; + + if (n < 0) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + if (!priorities) + return; + + for (i = 0; i < n; i++) + { + if (!textures[i]) + continue; + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, + textures[i]); + if (pTexObj && pTexObj->name) + glPrioritizeTextures (1, &pTexObj->name, &priorities[i]); + } +} + +static glitz_texture_filter_t +xglTextureFilter (GLenum param) +{ + switch (param) { + case GL_LINEAR: + return GLITZ_TEXTURE_FILTER_LINEAR; + case GL_NEAREST: + default: + return GLITZ_TEXTURE_FILTER_NEAREST; + } +} + +static glitz_texture_wrap_t +xglTextureWrap (GLenum param) +{ + switch (param) { + case GL_CLAMP_TO_EDGE: + return GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE; + case GL_CLAMP_TO_BORDER: + return GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER; + case GL_REPEAT: + return GLITZ_TEXTURE_WRAP_REPEAT; + case GL_MIRRORED_REPEAT: + return GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT; + case GL_CLAMP: + default: + return GLITZ_TEXTURE_WRAP_CLAMP; + } +} + +static void +xglTexParameterfvProc (xglGLOpPtr pOp) +{ + xglTexObjPtr pTexObj; + + glTexParameterfv (pOp->u.tex_parameter_fv.target, + pOp->u.tex_parameter_fv.pname, + pOp->u.tex_parameter_fv.params); + + switch (pOp->u.tex_parameter_fv.target) { + case GL_TEXTURE_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + default: + pTexObj = NULL; + break; + } + + if (pTexObj && pTexObj->pPixmap) + { + GLfloat *params = pOp->u.tex_parameter_fv.params; + + switch (pOp->u.tex_parameter_fv.pname) { + case GL_TEXTURE_MIN_FILTER: + glitz_texture_object_set_filter (pTexObj->object, + GLITZ_TEXTURE_FILTER_TYPE_MIN, + xglTextureFilter (params[0])); + break; + case GL_TEXTURE_MAG_FILTER: + glitz_texture_object_set_filter (pTexObj->object, + GLITZ_TEXTURE_FILTER_TYPE_MAG, + xglTextureFilter (params[0])); + break; + case GL_TEXTURE_WRAP_S: + glitz_texture_object_set_wrap (pTexObj->object, + GLITZ_TEXTURE_WRAP_TYPE_S, + xglTextureWrap (params[0])); + break; + case GL_TEXTURE_WRAP_T: + glitz_texture_object_set_wrap (pTexObj->object, + GLITZ_TEXTURE_WRAP_TYPE_T, + xglTextureWrap (params[0])); + break; + case GL_TEXTURE_BORDER_COLOR: { + glitz_color_t color; + + color.red = params[0] * 0xffff; + color.green = params[1] * 0xffff; + color.blue = params[2] * 0xffff; + color.alpha = params[3] * 0xffff; + + glitz_texture_object_set_border_color (pTexObj->object, &color); + } + default: + break; + } + } +} + +static void +xglTexParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + xglGLOpRec gl; + + gl.glProc = xglTexParameterfvProc; + + gl.u.tex_parameter_fv.target = target; + gl.u.tex_parameter_fv.pname = pname; + + switch (pname) { + case GL_TEXTURE_BORDER_COLOR: + gl.u.tex_parameter_fv.params[3] = params[3]; + gl.u.tex_parameter_fv.params[2] = params[2]; + gl.u.tex_parameter_fv.params[1] = params[1]; + /* fall-through */ + default: + gl.u.tex_parameter_fv.params[0] = params[0]; + break; + } + + xglGLOp (&gl); +} + +static void +xglTexParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + xglGLOpRec gl; + + gl.glProc = xglTexParameterfvProc; + + gl.u.tex_parameter_fv.target = target; + gl.u.tex_parameter_fv.pname = pname; + + switch (pname) { + case GL_TEXTURE_BORDER_COLOR: + gl.u.tex_parameter_fv.params[3] = (GLfloat) params[3] / INT_MAX; + gl.u.tex_parameter_fv.params[2] = (GLfloat) params[2] / INT_MAX; + gl.u.tex_parameter_fv.params[1] = (GLfloat) params[1] / INT_MAX; + gl.u.tex_parameter_fv.params[0] = (GLfloat) params[0] / INT_MAX; + break; + default: + gl.u.tex_parameter_fv.params[0] = params[0]; + break; + } + + xglGLOp (&gl); +} + +static void +xglTexParameterf (GLenum target, + GLenum pname, + GLfloat param) +{ + xglTexParameterfv (target, pname, (const GLfloat *) ¶m); +} + +static void +xglTexParameteri (GLenum target, + GLenum pname, + GLint param) +{ + xglTexParameteriv (target, pname, (const GLint *) ¶m); +} + +static void +xglGetTexLevelParameterfv (GLenum target, + GLint level, + GLenum pname, + GLfloat *params) +{ + xglTexObjPtr pTexObj; + + switch (target) { + case GL_TEXTURE_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + default: + pTexObj = NULL; + break; + } + + if (pTexObj && pTexObj->pPixmap) + { + glitz_context_bind_texture (cctx->context, pTexObj->object); + + glGetTexLevelParameterfv (target, level, pname, params); + glBindTexture (target, pTexObj->name); + } + else + glGetTexLevelParameterfv (target, level, pname, params); +} + +static void +xglGetTexLevelParameteriv (GLenum target, + GLint level, + GLenum pname, + GLint *params) +{ + xglTexObjPtr pTexObj; + + switch (target) { + case GL_TEXTURE_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + default: + pTexObj = NULL; + break; + } + + if (pTexObj && pTexObj->pPixmap) + { + glitz_context_bind_texture (cctx->context, pTexObj->object); + + glGetTexLevelParameteriv (target, level, pname, params); + glBindTexture (target, pTexObj->name); + } + else + glGetTexLevelParameteriv (target, level, pname, params); +} + +static GLuint +xglGenLists (GLsizei range) +{ + xglDisplayListPtr pDisplayList; + GLuint first, name; + + first = xglHashFindFreeKeyBlock (cctx->shared->displayLists, range); + + name = first; + for (name = first; range--; name++) + { + pDisplayList = xglCreateList (); + if (pDisplayList) + { + xglHashInsert (cctx->shared->displayLists, name, pDisplayList); + } + else + { + xglRecordError (GL_OUT_OF_MEMORY); + } + } + + return first; +} + +static void +xglNewList (GLuint list, + GLenum mode) +{ + if (!list) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + if (cctx->list) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + cctx->pList = xglCreateList (); + if (!cctx->pList) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + cctx->list = list; + cctx->listMode = mode; + + xglStartList (XGL_LIST_OP_CALLS, mode); +} + +static void +xglEndList (void) +{ + xglDisplayListPtr pDisplayList; + + if (!cctx->list) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + glEndList (); + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, cctx->list); + if (pDisplayList) + { + xglHashRemove (cctx->shared->displayLists, cctx->list); + xglDestroyList (pDisplayList); + } + + xglHashInsert (cctx->shared->displayLists, cctx->list, cctx->pList); + + cctx->list = 0; +} + +static void +xglDrawList (GLuint list) +{ + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glCallList (list); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } +} + +static void +xglCallDisplayList (GLuint list, + int nesting) +{ + if (nesting > cctx->maxListNesting) + return; + + if (!list) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + if (cctx->list) + { + if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1)) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_LIST; + cctx->pList->pOp[cctx->pList->nOp].u.list = list; + cctx->pList->nOp++; + } + else + { + xglDisplayListPtr pDisplayList; + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, list); + if (pDisplayList) + { + xglListOpPtr pOp = pDisplayList->pOp; + int nOp = pDisplayList->nOp; + + while (nOp--) + { + switch (pOp->type) { + case XGL_LIST_OP_CALLS: + glCallList (pOp->u.list); + break; + case XGL_LIST_OP_DRAW: + xglDrawList (pOp->u.list); + break; + case XGL_LIST_OP_GL: + (*pOp->u.gl->glProc) (pOp->u.gl); + break; + case XGL_LIST_OP_LIST: + xglCallDisplayList (pOp->u.list, nesting + 1); + break; + } + + pOp++; + } + } + } +} + +static void +xglCallList (GLuint list) +{ + xglCallDisplayList (list, 1); +} + +static void +xglCallLists (GLsizei n, + GLenum type, + const GLvoid *lists) +{ + GLuint list; + GLint base, i; + + glGetIntegerv (GL_LIST_BASE, &base); + + for (i = 0; i < n; i++) + { + switch (type) { + case GL_BYTE: + list = (GLuint) *(((GLbyte *) lists) + n); + break; + case GL_UNSIGNED_BYTE: + list = (GLuint) *(((GLubyte *) lists) + n); + break; + case GL_SHORT: + list = (GLuint) *(((GLshort *) lists) + n); + break; + case GL_UNSIGNED_SHORT: + list = (GLuint) *(((GLushort *) lists) + n); + break; + case GL_INT: + list = (GLuint) *(((GLint *) lists) + n); + break; + case GL_UNSIGNED_INT: + list = (GLuint) *(((GLuint *) lists) + n); + break; + case GL_FLOAT: + list = (GLuint) *(((GLfloat *) lists) + n); + break; + case GL_2_BYTES: + { + GLubyte *ubptr = ((GLubyte *) lists) + 2 * n; + list = (GLuint) *ubptr * 256 + (GLuint) *(ubptr + 1); + } break; + case GL_3_BYTES: + { + GLubyte *ubptr = ((GLubyte *) lists) + 3 * n; + list = (GLuint) * ubptr * 65536 + + (GLuint) * (ubptr + 1) * 256 + + (GLuint) * (ubptr + 2); + } break; + case GL_4_BYTES: + { + GLubyte *ubptr = ((GLubyte *) lists) + 4 * n; + list = (GLuint) * ubptr * 16777216 + + (GLuint) * (ubptr + 1) * 65536 + + (GLuint) * (ubptr + 2) * 256 + + (GLuint) * (ubptr + 3); + } break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + xglCallDisplayList (base + list, 1); + } +} + +static void +xglDeleteLists (GLuint list, + GLsizei range) +{ + xglDisplayListPtr pDisplayList; + GLint i; + + if (range < 0) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + for (i = list; i < list + range; i++) + { + if (!i) + continue; + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, i); + if (pDisplayList) + { + xglHashRemove (cctx->shared->displayLists, i); + xglDestroyList (pDisplayList); + } + } +} + +static GLboolean +xglIsList (GLuint list) +{ + xglDisplayListPtr pDisplayList; + + if (!list) + return GL_FALSE; + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, list); + if (pDisplayList) + return GL_TRUE; + + return GL_FALSE; +} + +static void +xglFlush (void) +{ + glFlush (); + + if (cctx && cctx->pDrawBuffer->pDrawable) + { + xglGLBufferPtr pBuffer = cctx->pDrawBuffer; + + if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage)) + { + XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable); + + DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage); + REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage); + + pPixmapPriv->damageBox = miEmptyBox; + } + } +} + +static void +xglFinish (void) +{ + glFinish (); + + if (cctx && cctx->pDrawBuffer->pDrawable) + { + xglGLBufferPtr pBuffer = cctx->pDrawBuffer; + + if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage)) + { + XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable); + + DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage); + REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage); + + pPixmapPriv->damageBox = miEmptyBox; + } + } +} + +static void +xglClear (GLbitfield mask) +{ + GLenum mode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glClear (mask); + glEndList (); + + mode = cctx->listMode; + } + else + mode = GL_COMPILE_AND_EXECUTE; + + if (mode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glClear (mask); + + if (mask & GL_COLOR_BUFFER_BIT) + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglAccum (GLenum op, + GLfloat value) +{ + if (op == GL_RETURN) + { + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glAccum (GL_RETURN, value); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glAccum (GL_RETURN, value); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); + } + else + glAccum (op, value); +} + +static void +xglDrawArrays (GLenum mode, + GLint first, + GLsizei count) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glDrawArrays (mode, first, count); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glDrawArrays (mode, first, count); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglDrawElements (GLenum mode, + GLsizei count, + GLenum type, + const GLvoid *indices) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glDrawElements (mode, count, type, indices); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glDrawElements (mode, count, type, indices); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglDrawPixels (GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *pixels) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glDrawPixels (width, height, format, type, pixels); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glDrawPixels (width, height, format, type, pixels); + + if (format != GL_STENCIL_INDEX) + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglBitmap (GLsizei width, + GLsizei height, + GLfloat xorig, + GLfloat yorig, + GLfloat xmove, + GLfloat ymove, + const GLubyte *bitmap) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glBitmap (width, height, xorig, yorig, 0, 0, bitmap); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE && width && height) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glBitmap (width, height, xorig, yorig, 0, 0, bitmap); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); + + glBitmap (0, 0, 0, 0, xmove, ymove, NULL); +} + +static void +xglRectdv (const GLdouble *v1, + const GLdouble *v2) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glRectdv (v1, v2); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glRectdv (v1, v2); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglRectfv (const GLfloat *v1, + const GLfloat *v2) +{ + GLdouble dv1[2]; + GLdouble dv2[2]; + + dv1[0] = (GLdouble) v1[0]; + dv1[1] = (GLdouble) v1[1]; + dv2[0] = (GLdouble) v2[0]; + dv2[1] = (GLdouble) v2[1]; + + xglRectdv (dv1, dv2); +} + +static void +xglRectiv (const GLint *v1, + const GLint *v2) +{ + GLdouble dv1[2]; + GLdouble dv2[2]; + + dv1[0] = (GLdouble) v1[0]; + dv1[1] = (GLdouble) v1[1]; + dv2[0] = (GLdouble) v2[0]; + dv2[1] = (GLdouble) v2[1]; + + xglRectdv (dv1, dv2); +} + +static void +xglRectsv (const GLshort *v1, + const GLshort *v2) +{ + GLdouble dv1[2]; + GLdouble dv2[2]; + + dv1[0] = (GLdouble) v1[0]; + dv1[1] = (GLdouble) v1[1]; + dv2[0] = (GLdouble) v2[0]; + dv2[1] = (GLdouble) v2[1]; + + xglRectdv (dv1, dv2); +} + +static void +xglBegin (GLenum mode) +{ + if (mode > GL_POLYGON) + { + xglRecordError (GL_INVALID_ENUM); + return; + } + + if (cctx->beginCnt) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + cctx->beginCnt++; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + } + else + { + if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1) + { + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + XGL_GLX_DRAW_BOX (&box, pBox); + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + XGL_GLX_SET_SCISSOR_BOX (&box); + } + else + { + if (!cctx->groupList) + cctx->groupList = glGenLists (1); + + glNewList (cctx->groupList, GL_COMPILE); + } + } + + glBegin (mode); +} + +static void +xglEnd (void) +{ + if (!cctx->beginCnt) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + cctx->beginCnt--; + + glEnd (); + + if (!cctx->list || cctx->listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + GLuint list = 0; + + if (cctx->list) + { + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + list = cctx->pList->pOp[cctx->pList->nOp - 1].u.list; + } + else + { + if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1) + { + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor); + } + else + { + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + list = cctx->groupList; + } + } + + if (list) + glEndList (); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + if (list) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glCallList (list); + } + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + else + { + glEndList (); + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglCopyPixelsProc (xglGLOpPtr pOp) +{ + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glCopyPixels (pOp->u.copy_pixels.x + cctx->pReadBuffer->xOff, + pOp->u.copy_pixels.y + cctx->pReadBuffer->yOff, + pOp->u.copy_pixels.width, + pOp->u.copy_pixels.height, + pOp->u.copy_pixels.type); + + if (pOp->u.copy_pixels.type == GL_COLOR) + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } +} + +static void +xglCopyPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum type) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyPixelsProc; + + gl.u.copy_pixels.x = x; + gl.u.copy_pixels.y = y; + gl.u.copy_pixels.width = width; + gl.u.copy_pixels.height = height; + gl.u.copy_pixels.type = type; + + xglGLOp (&gl); +} + +static void +xglReadPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLvoid *pixels) +{ + glReadPixels (x + cctx->pReadBuffer->xOff, + y + cctx->pReadBuffer->yOff, + width, height, format, type, pixels); +} + +static void +xglCopyTexImage1DProc (xglGLOpPtr pOp) +{ + glCopyTexImage1D (pOp->u.copy_tex_image_1d.target, + pOp->u.copy_tex_image_1d.level, + pOp->u.copy_tex_image_1d.internalformat, + pOp->u.copy_tex_image_1d.x + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_image_1d.y + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_image_1d.width, + pOp->u.copy_tex_image_1d.border); +} + +static void +xglCopyTexImage1D (GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLint border) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexImage1DProc; + + gl.u.copy_tex_image_1d.target = target; + gl.u.copy_tex_image_1d.level = level; + gl.u.copy_tex_image_1d.internalformat = internalformat; + gl.u.copy_tex_image_1d.x = x; + gl.u.copy_tex_image_1d.y = y; + gl.u.copy_tex_image_1d.width = width; + gl.u.copy_tex_image_1d.border = border; + + xglGLOp (&gl); +} + +static void +xglCopyTexImage2DProc (xglGLOpPtr pOp) +{ + glCopyTexImage2D (pOp->u.copy_tex_image_2d.target, + pOp->u.copy_tex_image_2d.level, + pOp->u.copy_tex_image_2d.internalformat, + pOp->u.copy_tex_image_2d.x + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_image_2d.y + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_image_2d.width, + pOp->u.copy_tex_image_2d.height, + pOp->u.copy_tex_image_2d.border); +} + +static void +xglCopyTexImage2D (GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexImage2DProc; + + gl.u.copy_tex_image_2d.target = target; + gl.u.copy_tex_image_2d.level = level; + gl.u.copy_tex_image_2d.internalformat = internalformat; + gl.u.copy_tex_image_2d.x = x; + gl.u.copy_tex_image_2d.y = y; + gl.u.copy_tex_image_2d.width = width; + gl.u.copy_tex_image_2d.height = height; + gl.u.copy_tex_image_2d.border = border; + + xglGLOp (&gl); +} + +static void +xglCopyTexSubImage1DProc (xglGLOpPtr pOp) +{ + glCopyTexSubImage1D (pOp->u.copy_tex_sub_image_1d.target, + pOp->u.copy_tex_sub_image_1d.level, + pOp->u.copy_tex_sub_image_1d.xoffset, + pOp->u.copy_tex_sub_image_1d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_sub_image_1d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_sub_image_1d.width); +} + +static void +xglCopyTexSubImage1D (GLenum target, + GLint level, + GLint xoffset, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexSubImage1DProc; + + gl.u.copy_tex_sub_image_1d.target = target; + gl.u.copy_tex_sub_image_1d.level = level; + gl.u.copy_tex_sub_image_1d.xoffset = xoffset; + gl.u.copy_tex_sub_image_1d.x = x; + gl.u.copy_tex_sub_image_1d.y = y; + gl.u.copy_tex_sub_image_1d.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyTexSubImage2DProc (xglGLOpPtr pOp) +{ + glCopyTexSubImage2D (pOp->u.copy_tex_sub_image_2d.target, + pOp->u.copy_tex_sub_image_2d.level, + pOp->u.copy_tex_sub_image_2d.xoffset, + pOp->u.copy_tex_sub_image_2d.yoffset, + pOp->u.copy_tex_sub_image_2d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_sub_image_2d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_sub_image_2d.width, + pOp->u.copy_tex_sub_image_2d.height); +} + +static void +xglCopyTexSubImage2D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexSubImage2DProc; + + gl.u.copy_tex_sub_image_2d.target = target; + gl.u.copy_tex_sub_image_2d.level = level; + gl.u.copy_tex_sub_image_2d.xoffset = xoffset; + gl.u.copy_tex_sub_image_2d.yoffset = yoffset; + gl.u.copy_tex_sub_image_2d.x = x; + gl.u.copy_tex_sub_image_2d.y = y; + gl.u.copy_tex_sub_image_2d.width = width; + gl.u.copy_tex_sub_image_2d.height = height; + + xglGLOp (&gl); +} + +static void +xglCopyColorTableProc (xglGLOpPtr pOp) +{ + glCopyColorTable (pOp->u.copy_color_table.target, + pOp->u.copy_color_table.internalformat, + pOp->u.copy_color_table.x + cctx->pReadBuffer->xOff, + pOp->u.copy_color_table.y + cctx->pReadBuffer->yOff, + pOp->u.copy_color_table.width); +} + +static void +xglCopyColorTable (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyColorTableProc; + + gl.u.copy_color_table.target = target; + gl.u.copy_color_table.internalformat = internalformat; + gl.u.copy_color_table.x = x; + gl.u.copy_color_table.y = y; + gl.u.copy_color_table.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyColorSubTableProc (xglGLOpPtr pOp) +{ + glCopyColorTable (pOp->u.copy_color_sub_table.target, + pOp->u.copy_color_sub_table.start, + pOp->u.copy_color_sub_table.x + cctx->pReadBuffer->xOff, + pOp->u.copy_color_sub_table.y + cctx->pReadBuffer->yOff, + pOp->u.copy_color_sub_table.width); +} + +static void +xglCopyColorSubTable (GLenum target, + GLsizei start, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyColorSubTableProc; + + gl.u.copy_color_sub_table.target = target; + gl.u.copy_color_sub_table.start = start; + gl.u.copy_color_sub_table.x = x; + gl.u.copy_color_sub_table.y = y; + gl.u.copy_color_sub_table.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyConvolutionFilter1DProc (xglGLOpPtr pOp) +{ + GLenum internalformat = pOp->u.copy_convolution_filter_1d.internalformat; + + glCopyConvolutionFilter1D (pOp->u.copy_convolution_filter_1d.target, + internalformat, + pOp->u.copy_convolution_filter_1d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_convolution_filter_1d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_convolution_filter_1d.width); +} + +static void +xglCopyConvolutionFilter1D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyConvolutionFilter1DProc; + + gl.u.copy_convolution_filter_1d.target = target; + gl.u.copy_convolution_filter_1d.internalformat = internalformat; + gl.u.copy_convolution_filter_1d.x = x; + gl.u.copy_convolution_filter_1d.y = y; + gl.u.copy_convolution_filter_1d.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyConvolutionFilter2DProc (xglGLOpPtr pOp) +{ + GLenum internalformat = pOp->u.copy_convolution_filter_2d.internalformat; + + glCopyConvolutionFilter2D (pOp->u.copy_convolution_filter_2d.target, + internalformat, + pOp->u.copy_convolution_filter_2d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_convolution_filter_2d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_convolution_filter_2d.width, + pOp->u.copy_convolution_filter_2d.height); +} + +static void +xglCopyConvolutionFilter2D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyConvolutionFilter2DProc; + + gl.u.copy_convolution_filter_2d.target = target; + gl.u.copy_convolution_filter_2d.internalformat = internalformat; + gl.u.copy_convolution_filter_2d.x = x; + gl.u.copy_convolution_filter_2d.y = y; + gl.u.copy_convolution_filter_2d.width = width; + gl.u.copy_convolution_filter_2d.height = height; + + xglGLOp (&gl); +} + +static void +xglCopyTexSubImage3DProc (xglGLOpPtr pOp) +{ + glCopyTexSubImage3D (pOp->u.copy_tex_sub_image_3d.target, + pOp->u.copy_tex_sub_image_3d.level, + pOp->u.copy_tex_sub_image_3d.xoffset, + pOp->u.copy_tex_sub_image_3d.yoffset, + pOp->u.copy_tex_sub_image_3d.zoffset, + pOp->u.copy_tex_sub_image_3d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_sub_image_3d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_sub_image_3d.width, + pOp->u.copy_tex_sub_image_3d.height); +} + +static void +xglCopyTexSubImage3D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexSubImage3DProc; + + gl.u.copy_tex_sub_image_3d.target = target; + gl.u.copy_tex_sub_image_3d.level = level; + gl.u.copy_tex_sub_image_3d.xoffset = xoffset; + gl.u.copy_tex_sub_image_3d.yoffset = yoffset; + gl.u.copy_tex_sub_image_3d.zoffset = zoffset; + gl.u.copy_tex_sub_image_3d.x = x; + gl.u.copy_tex_sub_image_3d.y = y; + gl.u.copy_tex_sub_image_3d.width = width; + gl.u.copy_tex_sub_image_3d.height = height; + + xglGLOp (&gl); +} + +/* GL_ARB_multitexture */ +static void +xglNoOpActiveTextureARB (GLenum texture) {} +static void +xglActiveTextureARBProc (xglGLOpPtr pOp) +{ + GLenum texUnit; + + texUnit = pOp->u.enumeration - GL_TEXTURE0; + if (texUnit < 0 || texUnit >= cctx->maxTexUnits) + { + xglRecordError (GL_INVALID_ENUM); + } + else + { + cctx->activeTexUnit = texUnit; + (*cctx->ActiveTextureARB) (pOp->u.enumeration); + } +} +static void +xglActiveTextureARB (GLenum texture) +{ + xglGLOpRec gl; + + gl.glProc = xglActiveTextureARBProc; + + gl.u.enumeration = texture; + + xglGLOp (&gl); +} +static void +xglNoOpClientActiveTextureARB (GLenum texture) {} +static void +xglNoOpMultiTexCoord1dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord1fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord1ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord1svARB (GLenum target, const GLshort *v) {} +static void +xglNoOpMultiTexCoord2dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord2fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord2ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord2svARB (GLenum target, const GLshort *v) {} +static void +xglNoOpMultiTexCoord3dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord3fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord3ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord3svARB (GLenum target, const GLshort *v) {} +static void +xglNoOpMultiTexCoord4dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord4fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord4ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord4svARB (GLenum target, const GLshort *v) {} + +/* GL_ARB_multisample */ +static void +xglNoOpSampleCoverageARB (GLclampf value, GLboolean invert) {} + +/* GL_EXT_texture_object */ +static GLboolean +xglNoOpAreTexturesResidentEXT (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + return GL_FALSE; +} +static void +xglNoOpGenTexturesEXT (GLsizei n, GLuint *textures) {} +static GLboolean +xglNoOpIsTextureEXT (GLuint texture) +{ + return GL_FALSE; +} + +/* GL_SGIS_multisample */ +static void +xglNoOpSampleMaskSGIS (GLclampf value, GLboolean invert) {} +static void +xglNoOpSamplePatternSGIS (GLenum pattern) {} + +/* GL_EXT_point_parameters */ +static void +xglNoOpPointParameterfEXT (GLenum pname, GLfloat param) {} +static void +xglNoOpPointParameterfvEXT (GLenum pname, const GLfloat *params) {} + +/* GL_MESA_window_pos */ +static void +xglNoOpWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) {} +static void +xglWindowPos3fMESAProc (xglGLOpPtr pOp) +{ + (*cctx->WindowPos3fMESA) (pOp->u.window_pos_3f.x + cctx->pDrawBuffer->xOff, + pOp->u.window_pos_3f.y + cctx->pDrawBuffer->yOff, + pOp->u.window_pos_3f.z); +} +static void +xglWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) +{ + xglGLOpRec gl; + + gl.glProc = xglWindowPos3fMESAProc; + + gl.u.window_pos_3f.x = x; + gl.u.window_pos_3f.y = y; + gl.u.window_pos_3f.z = z; + + xglGLOp (&gl); +} + +/* GL_EXT_blend_func_separate */ +static void +xglNoOpBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorAlpha, GLenum dfactorAlpha) {} + +/* GL_EXT_fog_coord */ +static void +xglNoOpFogCoordfvEXT (const GLfloat *coord) {} +static void +xglNoOpFogCoorddvEXT (const GLdouble *coord) {} +static void +xglNoOpFogCoordPointerEXT (GLenum type, GLsizei stride, + const GLvoid *pointer) {} + +/* GL_EXT_secondary_color */ +static void +xglNoOpSecondaryColor3bvEXT (const GLbyte *v) {} +static void +xglNoOpSecondaryColor3dvEXT (const GLdouble *v) {} +static void +xglNoOpSecondaryColor3fvEXT (const GLfloat *v) {} +static void +xglNoOpSecondaryColor3ivEXT (const GLint *v) {} +static void +xglNoOpSecondaryColor3svEXT (const GLshort *v) {} +static void +xglNoOpSecondaryColor3ubvEXT (const GLubyte *v) {} +static void +xglNoOpSecondaryColor3uivEXT (const GLuint *v) {} +static void +xglNoOpSecondaryColor3usvEXT (const GLushort *v) {} +static void +xglNoOpSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer) {} + +/* GL_NV_point_sprite */ +static void +xglNoOpPointParameteriNV (GLenum pname, GLint params) {} +static void +xglNoOpPointParameterivNV (GLenum pname, const GLint *params) {} + +/* GL_EXT_stencil_two_side */ +static void +xglNoOpActiveStencilFaceEXT (GLenum face) {} + +/* GL_EXT_framebuffer_object */ +static GLboolean +xglNoOpIsRenderbufferEXT (GLuint renderbuffer) +{ + return FALSE; +} +static void +xglNoOpBindRenderbufferEXT (GLenum target, GLuint renderbuffer) {} +static void +xglNoOpDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers) {} +static void +xglNoOpGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers) {} +static void +xglNoOpRenderbufferStorageEXT (GLenum target, GLenum internalformat, + GLsizei width, GLsizei height) {} +static void +xglNoOpGetRenderbufferParameterivEXT (GLenum target, GLenum pname, + GLint *params) {} +static GLboolean +xglNoOpIsFramebufferEXT (GLuint framebuffer) +{ + return FALSE; +} +static void +xglNoOpBindFramebufferEXT (GLenum target, GLuint framebuffer) {} +static void +xglNoOpDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers) {} +static void +xglNoOpGenFramebuffersEXT (GLsizei n, GLuint *framebuffers) {} +static GLenum +xglNoOpCheckFramebufferStatusEXT (GLenum target) +{ + return GL_FRAMEBUFFER_UNSUPPORTED_EXT; +} +static void +xglNoOpFramebufferTexture1DEXT (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level) {} +static void +xglNoOpFramebufferTexture2DEXT (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level) {} +static void +xglNoOpFramebufferTexture3DEXT (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level, GLint zoffset) {} +static void +xglNoOpFramebufferRenderbufferEXT (GLenum target, GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) {} +static void +xglNoOpGetFramebufferAttachmentParameterivEXT (GLenum target, + GLenum attachment, + GLenum pname, + GLint *params) {} +static void +xglNoOpGenerateMipmapEXT (GLenum target) {} + +static struct _glapi_table __glNativeRenderTable = { + xglNewList, + xglEndList, + xglCallList, + xglCallLists, + xglDeleteLists, + xglGenLists, + glListBase, + xglBegin, + xglBitmap, + 0, /* glColor3b */ + glColor3bv, + 0, /* glColor3d */ + glColor3dv, + 0, /* glColor3f */ + glColor3fv, + 0, /* glColor3i */ + glColor3iv, + 0, /* glColor3s */ + glColor3sv, + 0, /* glColor3ub */ + glColor3ubv, + 0, /* glColor3ui */ + glColor3uiv, + 0, /* glColor3us */ + glColor3usv, + 0, /* glColor4b */ + glColor4bv, + 0, /* glColor4d */ + glColor4dv, + 0, /* glColor4f */ + glColor4fv, + 0, /* glColor4i */ + glColor4iv, + 0, /* glColor4s */ + glColor4sv, + 0, /* glColor4ub */ + glColor4ubv, + 0, /* glColor4ui */ + glColor4uiv, + 0, /* glColor4us */ + glColor4usv, + 0, /* glEdgeFlag */ + glEdgeFlagv, + xglEnd, + 0, /* glIndexd */ + glIndexdv, + 0, /* glIndexf */ + glIndexfv, + 0, /* glIndexi */ + glIndexiv, + 0, /* glIndexs */ + glIndexsv, + 0, /* glNormal3b */ + glNormal3bv, + 0, /* glNormal3d */ + glNormal3dv, + 0, /* glNormal3f */ + glNormal3fv, + 0, /* glNormal3i */ + glNormal3iv, + 0, /* glNormal3s */ + glNormal3sv, + 0, /* glRasterPos2d */ + glRasterPos2dv, + 0, /* glRasterPos2f */ + glRasterPos2fv, + 0, /* glRasterPos2i */ + glRasterPos2iv, + 0, /* glRasterPos2s */ + glRasterPos2sv, + 0, /* glRasterPos3d */ + glRasterPos3dv, + 0, /* glRasterPos3f */ + glRasterPos3fv, + 0, /* glRasterPos3i */ + glRasterPos3iv, + 0, /* glRasterPos3s */ + glRasterPos3sv, + 0, /* glRasterPos4d */ + glRasterPos4dv, + 0, /* glRasterPos4f */ + glRasterPos4fv, + 0, /* glRasterPos4i */ + glRasterPos4iv, + 0, /* glRasterPos4s */ + glRasterPos4sv, + 0, /* glRectd */ + xglRectdv, + 0, /* glRectf */ + xglRectfv, + 0, /* glRecti */ + xglRectiv, + 0, /* glRects */ + xglRectsv, + 0, /* glTexCoord1d */ + glTexCoord1dv, + 0, /* glTexCoord1f */ + glTexCoord1fv, + 0, /* glTexCoord1i */ + glTexCoord1iv, + 0, /* glTexCoord1s */ + glTexCoord1sv, + 0, /* glTexCoord2d */ + glTexCoord2dv, + 0, /* glTexCoord2f */ + glTexCoord2fv, + 0, /* glTexCoord2i */ + glTexCoord2iv, + 0, /* glTexCoord2s */ + glTexCoord2sv, + 0, /* glTexCoord3d */ + glTexCoord3dv, + 0, /* glTexCoord3f */ + glTexCoord3fv, + 0, /* glTexCoord3i */ + glTexCoord3iv, + 0, /* glTexCoord3s */ + glTexCoord3sv, + 0, /* glTexCoord4d */ + glTexCoord4dv, + 0, /* glTexCoord4f */ + glTexCoord4fv, + 0, /* glTexCoord4i */ + glTexCoord4iv, + 0, /* glTexCoord4s */ + glTexCoord4sv, + 0, /* glVertex2d */ + glVertex2dv, + 0, /* glVertex2f */ + glVertex2fv, + 0, /* glVertex2i */ + glVertex2iv, + 0, /* glVertex2s */ + glVertex2sv, + 0, /* glVertex3d */ + glVertex3dv, + 0, /* glVertex3f */ + glVertex3fv, + 0, /* glVertex3i */ + glVertex3iv, + 0, /* glVertex3s */ + glVertex3sv, + 0, /* glVertex4d */ + glVertex4dv, + 0, /* glVertex4f */ + glVertex4fv, + 0, /* glVertex4i */ + glVertex4iv, + 0, /* glVertex4s */ + glVertex4sv, + glClipPlane, + glColorMaterial, + glCullFace, + glFogf, + glFogfv, + glFogi, + glFogiv, + glFrontFace, + glHint, + glLightf, + glLightfv, + glLighti, + glLightiv, + glLightModelf, + glLightModelfv, + glLightModeli, + glLightModeliv, + glLineStipple, + glLineWidth, + glMaterialf, + glMaterialfv, + glMateriali, + glMaterialiv, + glPointSize, + glPolygonMode, + glPolygonStipple, + xglScissor, + glShadeModel, + xglTexParameterf, + xglTexParameterfv, + xglTexParameteri, + xglTexParameteriv, + glTexImage1D, + glTexImage2D, + glTexEnvf, + glTexEnvfv, + glTexEnvi, + glTexEnviv, + glTexGend, + glTexGendv, + glTexGenf, + glTexGenfv, + glTexGeni, + glTexGeniv, + glFeedbackBuffer, + glSelectBuffer, + glRenderMode, + glInitNames, + glLoadName, + glPassThrough, + glPopName, + glPushName, + xglDrawBuffer, + xglClear, + glClearAccum, + glClearIndex, + glClearColor, + glClearStencil, + glClearDepth, + glStencilMask, + glColorMask, + glDepthMask, + glIndexMask, + xglAccum, + xglDisable, + xglEnable, + xglFinish, + xglFlush, + xglPopAttrib, + xglPushAttrib, + glMap1d, + glMap1f, + glMap2d, + glMap2f, + glMapGrid1d, + glMapGrid1f, + glMapGrid2d, + glMapGrid2f, + 0, /* glEvalCoord1d */ + glEvalCoord1dv, + 0, /* glEvalCoord1f */ + glEvalCoord1fv, + 0, /* glEvalCoord2d */ + glEvalCoord2dv, + 0, /* glEvalCoord2f */ + glEvalCoord2fv, + glEvalMesh1, + glEvalPoint1, + glEvalMesh2, + glEvalPoint2, + glAlphaFunc, + glBlendFunc, + glLogicOp, + glStencilFunc, + glStencilOp, + glDepthFunc, + glPixelZoom, + glPixelTransferf, + glPixelTransferi, + glPixelStoref, + glPixelStorei, + glPixelMapfv, + glPixelMapuiv, + glPixelMapusv, + xglReadBuffer, + xglCopyPixels, + xglReadPixels, + xglDrawPixels, + xglGetBooleanv, + glGetClipPlane, + xglGetDoublev, + xglGetError, + xglGetFloatv, + xglGetIntegerv, + glGetLightfv, + glGetLightiv, + glGetMapdv, + glGetMapfv, + glGetMapiv, + glGetMaterialfv, + glGetMaterialiv, + glGetPixelMapfv, + glGetPixelMapuiv, + glGetPixelMapusv, + glGetPolygonStipple, + xglGetString, + glGetTexEnvfv, + glGetTexEnviv, + glGetTexGendv, + glGetTexGenfv, + glGetTexGeniv, + glGetTexImage, + glGetTexParameterfv, + glGetTexParameteriv, + xglGetTexLevelParameterfv, + xglGetTexLevelParameteriv, + xglIsEnabled, + xglIsList, + glDepthRange, + glFrustum, + glLoadIdentity, + glLoadMatrixf, + glLoadMatrixd, + glMatrixMode, + glMultMatrixf, + glMultMatrixd, + glOrtho, + glPopMatrix, + glPushMatrix, + glRotated, + glRotatef, + glScaled, + glScalef, + glTranslated, + glTranslatef, + xglViewport, + glArrayElement, + xglBindTexture, + glColorPointer, + glDisableClientState, + xglDrawArrays, + xglDrawElements, + glEdgeFlagPointer, + glEnableClientState, + glIndexPointer, + 0, /* glIndexub */ + glIndexubv, + glInterleavedArrays, + glNormalPointer, + glPolygonOffset, + glTexCoordPointer, + glVertexPointer, + xglAreTexturesResident, + xglCopyTexImage1D, + xglCopyTexImage2D, + xglCopyTexSubImage1D, + xglCopyTexSubImage2D, + xglDeleteTextures, + xglGenTextures, + glGetPointerv, + xglIsTexture, + xglPrioritizeTextures, + glTexSubImage1D, + glTexSubImage2D, + glPopClientAttrib, + glPushClientAttrib, + glBlendColor, + glBlendEquation, + 0, /* glDrawRangeElements */ + glColorTable, + glColorTableParameterfv, + glColorTableParameteriv, + xglCopyColorTable, + glGetColorTable, + glGetColorTableParameterfv, + glGetColorTableParameteriv, + glColorSubTable, + xglCopyColorSubTable, + glConvolutionFilter1D, + glConvolutionFilter2D, + glConvolutionParameterf, + glConvolutionParameterfv, + glConvolutionParameteri, + glConvolutionParameteriv, + xglCopyConvolutionFilter1D, + xglCopyConvolutionFilter2D, + glGetConvolutionFilter, + glGetConvolutionParameterfv, + glGetConvolutionParameteriv, + glGetSeparableFilter, + glSeparableFilter2D, + glGetHistogram, + glGetHistogramParameterfv, + glGetHistogramParameteriv, + glGetMinmax, + glGetMinmaxParameterfv, + glGetMinmaxParameteriv, + glHistogram, + glMinmax, + glResetHistogram, + glResetMinmax, + glTexImage3D, + glTexSubImage3D, + xglCopyTexSubImage3D, + xglNoOpActiveTextureARB, + xglNoOpClientActiveTextureARB, + 0, /* glMultiTexCoord1dARB */ + xglNoOpMultiTexCoord1dvARB, + 0, /* glMultiTexCoord1fARB */ + xglNoOpMultiTexCoord1fvARB, + 0, /* glMultiTexCoord1iARB */ + xglNoOpMultiTexCoord1ivARB, + 0, /* glMultiTexCoord1sARB */ + xglNoOpMultiTexCoord1svARB, + 0, /* glMultiTexCoord2dARB */ + xglNoOpMultiTexCoord2dvARB, + 0, /* glMultiTexCoord2fARB */ + xglNoOpMultiTexCoord2fvARB, + 0, /* glMultiTexCoord2iARB */ + xglNoOpMultiTexCoord2ivARB, + 0, /* glMultiTexCoord2sARB */ + xglNoOpMultiTexCoord2svARB, + 0, /* glMultiTexCoord3dARB */ + xglNoOpMultiTexCoord3dvARB, + 0, /* glMultiTexCoord3fARB */ + xglNoOpMultiTexCoord3fvARB, + 0, /* glMultiTexCoord3iARB */ + xglNoOpMultiTexCoord3ivARB, + 0, /* glMultiTexCoord3sARB */ + xglNoOpMultiTexCoord3svARB, + 0, /* glMultiTexCoord4dARB */ + xglNoOpMultiTexCoord4dvARB, + 0, /* glMultiTexCoord4fARB */ + xglNoOpMultiTexCoord4fvARB, + 0, /* glMultiTexCoord4iARB */ + xglNoOpMultiTexCoord4ivARB, + 0, /* glMultiTexCoord4sARB */ + xglNoOpMultiTexCoord4svARB, + 0, /* glLoadTransposeMatrixfARB */ + 0, /* glLoadTransposeMatrixdARB */ + 0, /* glMultTransposeMatrixfARB */ + 0, /* glMultTransposeMatrixdARB */ + xglNoOpSampleCoverageARB, + 0, /* glDrawBuffersARB */ + 0, /* glPolygonOffsetEXT */ + 0, /* glGetTexFilterFuncSGIS */ + 0, /* glTexFilterFuncSGIS */ + 0, /* glGetHistogramEXT */ + 0, /* glGetHistogramParameterfvEXT */ + 0, /* glGetHistogramParameterivEXT */ + 0, /* glGetMinmaxEXT */ + 0, /* glGetMinmaxParameterfvEXT */ + 0, /* glGetMinmaxParameterivEXT */ + 0, /* glGetConvolutionFilterEXT */ + 0, /* glGetConvolutionParameterfvEXT */ + 0, /* glGetConvolutionParameterivEXT */ + 0, /* glGetSeparableFilterEXT */ + 0, /* glGetColorTableSGI */ + 0, /* glGetColorTableParameterfvSGI */ + 0, /* glGetColorTableParameterivSGI */ + 0, /* glPixelTexGenSGIX */ + 0, /* glPixelTexGenParameteriSGIS */ + 0, /* glPixelTexGenParameterivSGIS */ + 0, /* glPixelTexGenParameterfSGIS */ + 0, /* glPixelTexGenParameterfvSGIS */ + 0, /* glGetPixelTexGenParameterivSGIS */ + 0, /* glGetPixelTexGenParameterfvSGIS */ + 0, /* glTexImage4DSGIS */ + 0, /* glTexSubImage4DSGIS */ + xglNoOpAreTexturesResidentEXT, + xglNoOpGenTexturesEXT, + xglNoOpIsTextureEXT, + 0, /* glDetailTexFuncSGIS */ + 0, /* glGetDetailTexFuncSGIS */ + 0, /* glSharpenTexFuncSGIS */ + 0, /* glGetSharpenTexFuncSGIS */ + xglNoOpSampleMaskSGIS, + xglNoOpSamplePatternSGIS, + 0, /* glColorPointerEXT */ + 0, /* glEdgeFlagPointerEXT */ + 0, /* glIndexPointerEXT */ + 0, /* glNormalPointerEXT */ + 0, /* glTexCoordPointerEXT */ + 0, /* glVertexPointerEXT */ + 0, /* glSpriteParameterfSGIX */ + 0, /* glSpriteParameterfvSGIX */ + 0, /* glSpriteParameteriSGIX */ + 0, /* glSpriteParameterivSGIX */ + xglNoOpPointParameterfEXT, + xglNoOpPointParameterfvEXT, + 0, /* glGetInstrumentsSGIX */ + 0, /* glInstrumentsBufferSGIX */ + 0, /* glPollInstrumentsSGIX */ + 0, /* glReadInstrumentsSGIX */ + 0, /* glStartInstrumentsSGIX */ + 0, /* glStopInstrumentsSGIX */ + 0, /* glFrameZoomSGIX */ + 0, /* glTagSampleBufferSGIX */ + 0, /* glReferencePlaneSGIX */ + 0, /* glFlushRasterSGIX */ + 0, /* glGetListParameterfvSGIX */ + 0, /* glGetListParameterivSGIX */ + 0, /* glListParameterfSGIX */ + 0, /* glListParameterfvSGIX */ + 0, /* glListParameteriSGIX */ + 0, /* glListParameterivSGIX */ + 0, /* glFragmentColorMaterialSGIX */ + 0, /* glFragmentLightfSGIX */ + 0, /* glFragmentLightfvSGIX */ + 0, /* glFragmentLightiSGIX */ + 0, /* glFragmentLightivSGIX */ + 0, /* glFragmentLightModelfSGIX */ + 0, /* glFragmentLightModelfvSGIX */ + 0, /* glFragmentLightModeliSGIX */ + 0, /* glFragmentLightModelivSGIX */ + 0, /* glFragmentMaterialfSGIX */ + 0, /* glFragmentMaterialfvSGIX */ + 0, /* glFragmentMaterialiSGIX */ + 0, /* glFragmentMaterialivSGIX */ + 0, /* glGetFragmentLightfvSGIX */ + 0, /* glGetFragmentLightivSGIX */ + 0, /* glGetFragmentMaterialfvSGIX */ + 0, /* glGetFragmentMaterialivSGIX */ + 0, /* glLightEnviSGIX */ + 0, /* glVertexWeightfEXT */ + 0, /* glVertexWeightfvEXT */ + 0, /* glVertexWeightPointerEXT */ + 0, /* glFlushVertexArrayRangeNV */ + 0, /* glVertexArrayRangeNV */ + 0, /* glCombinerParameterfvNV */ + 0, /* glCombinerParameterfNV */ + 0, /* glCombinerParameterivNV */ + 0, /* glCombinerParameteriNV */ + 0, /* glCombinerInputNV */ + 0, /* glCombinerOutputNV */ + 0, /* glFinalCombinerInputNV */ + 0, /* glGetCombinerInputParameterfvNV */ + 0, /* glGetCombinerInputParameterivNV */ + 0, /* glGetCombinerOutputParameterfvNV */ + 0, /* glGetCombinerOutputParameterivNV */ + 0, /* glGetFinalCombinerInputParameterfvNV */ + 0, /* glGetFinalCombinerInputParameterivNV */ + 0, /* glResizeBuffersMESA */ + 0, /* glWindowPos2dMESA */ + 0, /* glWindowPos2dvMESA */ + 0, /* glWindowPos2fMESA */ + 0, /* glWindowPos2fvMESA */ + 0, /* glWindowPos2iMESA */ + 0, /* glWindowPos2ivMESA */ + 0, /* glWindowPos2sMESA */ + 0, /* glWindowPos2svMESA */ + 0, /* glWindowPos3dMESA */ + 0, /* glWindowPos3dvMESA */ + xglNoOpWindowPos3fMESA, + 0, /* glWindowPos3fvMESA */ + 0, /* glWindowPos3iMESA */ + 0, /* glWindowPos3ivMESA */ + 0, /* glWindowPos3sMESA */ + 0, /* glWindowPos3svMESA */ + 0, /* glWindowPos4dMESA */ + 0, /* glWindowPos4dvMESA */ + 0, /* glWindowPos4fMESA */ + 0, /* glWindowPos4fvMESA */ + 0, /* glWindowPos4iMESA */ + 0, /* glWindowPos4ivMESA */ + 0, /* glWindowPos4sMESA */ + 0, /* glWindowPos4svMESA */ + xglNoOpBlendFuncSeparateEXT, + 0, /* glIndexMaterialEXT */ + 0, /* glIndexFuncEXT */ + 0, /* glLockArraysEXT */ + 0, /* glUnlockArraysEXT */ + 0, /* glCullParameterdvEXT */ + 0, /* glCullParameterfvEXT */ + 0, /* glHintPGI */ + 0, /* glFogCoordfEXT */ + xglNoOpFogCoordfvEXT, + 0, /* glFogCoorddEXT */ + xglNoOpFogCoorddvEXT, + xglNoOpFogCoordPointerEXT, + 0, /* glGetColorTableEXT */ + 0, /* glGetColorTableParameterivEXT */ + 0, /* glGetColorTableParameterfvEXT */ + 0, /* glTbufferMask3DFX */ + 0, /* glCompressedTexImage3DARB */ + 0, /* glCompressedTexImage2DARB */ + 0, /* glCompressedTexImage1DARB */ + 0, /* glCompressedTexSubImage3DARB */ + 0, /* glCompressedTexSubImage2DARB */ + 0, /* glCompressedTexSubImage1DARB */ + 0, /* glGetCompressedTexImageARB */ + 0, /* glSecondaryColor3bEXT */ + xglNoOpSecondaryColor3bvEXT, + 0, /* glSecondaryColor3dEXT */ + xglNoOpSecondaryColor3dvEXT, + 0, /* glSecondaryColor3fEXT */ + xglNoOpSecondaryColor3fvEXT, + 0, /* glSecondaryColor3iEXT */ + xglNoOpSecondaryColor3ivEXT, + 0, /* glSecondaryColor3sEXT */ + xglNoOpSecondaryColor3svEXT, + 0, /* glSecondaryColor3ubEXT */ + xglNoOpSecondaryColor3ubvEXT, + 0, /* glSecondaryColor3uiEXT */ + xglNoOpSecondaryColor3uivEXT, + 0, /* glSecondaryColor3usEXT */ + xglNoOpSecondaryColor3usvEXT, + xglNoOpSecondaryColorPointerEXT, + 0, /* glAreProgramsResidentNV */ + 0, /* glBindProgramNV */ + 0, /* glDeleteProgramsNV */ + 0, /* glExecuteProgramNV */ + 0, /* glGenProgramsNV */ + 0, /* glGetProgramParameterdvNV */ + 0, /* glGetProgramParameterfvNV */ + 0, /* glGetProgramivNV */ + 0, /* glGetProgramStringNV */ + 0, /* glGetTrackMatrixivNV */ + 0, /* glGetVertexAttribdvARB */ + 0, /* glGetVertexAttribfvARB */ + 0, /* glGetVertexAttribivARB */ + 0, /* glGetVertexAttribPointervNV */ + 0, /* glIsProgramNV */ + 0, /* glLoadProgramNV */ + 0, /* glProgramParameter4dNV */ + 0, /* glProgramParameter4dvNV */ + 0, /* glProgramParameter4fNV */ + 0, /* glProgramParameter4fvNV */ + 0, /* glProgramParameters4dvNV */ + 0, /* glProgramParameters4fvNV */ + 0, /* glRequestResidentProgramsNV */ + 0, /* glTrackMatrixNV */ + 0, /* glVertexAttribPointerNV */ + 0, /* glVertexAttrib1dARB */ + 0, /* glVertexAttrib1dvARB */ + 0, /* glVertexAttrib1fARB */ + 0, /* glVertexAttrib1fvARB */ + 0, /* glVertexAttrib1sARB */ + 0, /* glVertexAttrib1svARB */ + 0, /* glVertexAttrib2dARB */ + 0, /* glVertexAttrib2dvARB */ + 0, /* glVertexAttrib2fARB */ + 0, /* glVertexAttrib2fvARB */ + 0, /* glVertexAttrib2sARB */ + 0, /* glVertexAttrib2svARB */ + 0, /* glVertexAttrib3dARB */ + 0, /* glVertexAttrib3dvARB */ + 0, /* glVertexAttrib3fARB */ + 0, /* glVertexAttrib3fvARB */ + 0, /* glVertexAttrib3sARB */ + 0, /* glVertexAttrib3svARB */ + 0, /* glVertexAttrib4dARB */ + 0, /* glVertexAttrib4dvARB */ + 0, /* glVertexAttrib4fARB */ + 0, /* glVertexAttrib4fvARB */ + 0, /* glVertexAttrib4sARB */ + 0, /* glVertexAttrib4svARB */ + 0, /* glVertexAttrib4NubARB */ + 0, /* glVertexAttrib4NubvARB */ + 0, /* glVertexAttribs1dvNV */ + 0, /* glVertexAttribs1fvNV */ + 0, /* glVertexAttribs1svNV */ + 0, /* glVertexAttribs2dvNV */ + 0, /* glVertexAttribs2fvNV */ + 0, /* glVertexAttribs2svNV */ + 0, /* glVertexAttribs3dvNV */ + 0, /* glVertexAttribs3fvNV */ + 0, /* glVertexAttribs3svNV */ + 0, /* glVertexAttribs4dvNV */ + 0, /* glVertexAttribs4fvNV */ + 0, /* glVertexAttribs4svNV */ + 0, /* glVertexAttribs4ubvNV */ + xglNoOpPointParameteriNV, + xglNoOpPointParameterivNV, + 0, /* glMultiDrawArraysEXT */ + 0, /* glMultiDrawElementsEXT */ + xglNoOpActiveStencilFaceEXT, + 0, /* glDeleteFencesNV */ + 0, /* glGenFencesNV */ + 0, /* glIsFenceNV */ + 0, /* glTestFenceNV */ + 0, /* glGetFenceivNV */ + 0, /* glFinishFenceNV */ + 0, /* glSetFenceNV */ + 0, /* glVertexAttrib4bvARB */ + 0, /* glVertexAttrib4ivARB */ + 0, /* glVertexAttrib4ubvARB */ + 0, /* glVertexAttrib4usvARB */ + 0, /* glVertexAttrib4uivARB */ + 0, /* glVertexAttrib4NbvARB */ + 0, /* glVertexAttrib4NsvARB */ + 0, /* glVertexAttrib4NivARB */ + 0, /* glVertexAttrib4NusvARB */ + 0, /* glVertexAttrib4NuivARB */ + 0, /* glVertexAttribPointerARB */ + 0, /* glEnableVertexAttribArrayARB */ + 0, /* glDisableVertexAttribArrayARB */ + 0, /* glProgramStringARB */ + 0, /* glProgramEnvParameter4dARB */ + 0, /* glProgramEnvParameter4dvARB */ + 0, /* glProgramEnvParameter4fARB */ + 0, /* glProgramEnvParameter4fvARB */ + 0, /* glProgramLocalParameter4dARB */ + 0, /* glProgramLocalParameter4dvARB */ + 0, /* glProgramLocalParameter4fARB */ + 0, /* glProgramLocalParameter4fvARB */ + 0, /* glGetProgramEnvParameterdvARB */ + 0, /* glGetProgramEnvParameterfvARB */ + 0, /* glGetProgramLocalParameterdvARB */ + 0, /* glGetProgramLocalParameterfvARB */ + 0, /* glGetProgramivARB */ + 0, /* glGetProgramStringARB */ + 0, /* glProgramNamedParameter4fNV */ + 0, /* glProgramNamedParameter4dNV */ + 0, /* glProgramNamedParameter4fvNV */ + 0, /* glProgramNamedParameter4dvNV */ + 0, /* glGetProgramNamedParameterfvNV */ + 0, /* glGetProgramNamedParameterdvNV */ + 0, /* glBindBufferARB */ + 0, /* glBufferDataARB */ + 0, /* glBufferSubDataARB */ + 0, /* glDeleteBuffersARB */ + 0, /* glGenBuffersARB */ + 0, /* glGetBufferParameterivARB */ + 0, /* glGetBufferPointervARB */ + 0, /* glGetBufferSubDataARB */ + 0, /* glIsBufferARB */ + 0, /* glMapBufferARB */ + 0, /* glUnmapBufferARB */ + 0, /* glDepthBoundsEXT */ + 0, /* glGenQueriesARB */ + 0, /* glDeleteQueriesARB */ + 0, /* glIsQueryARB */ + 0, /* glBeginQueryARB */ + 0, /* glEndQueryARB */ + 0, /* glGetQueryivARB */ + 0, /* glGetQueryObjectivARB */ + 0, /* glGetQueryObjectuivARB */ + 0, /* glMultiModeDrawArraysIBM */ + 0, /* glMultiModeDrawElementsIBM */ + 0, /* glBlendEquationSeparateEXT */ + 0, /* glDeleteObjectARB */ + 0, /* glGetHandleARB */ + 0, /* glDetachObjectARB */ + 0, /* glCreateShaderObjectARB */ + 0, /* glShaderSourceARB */ + 0, /* glCompileShaderARB */ + 0, /* glCreateProgramObjectARB */ + 0, /* glAttachObjectARB */ + 0, /* glLinkProgramARB */ + 0, /* glUseProgramObjectARB */ + 0, /* glValidateProgramARB */ + 0, /* glUniform1fARB */ + 0, /* glUniform2fARB */ + 0, /* glUniform3fARB */ + 0, /* glUniform4fARB */ + 0, /* glUniform1iARB */ + 0, /* glUniform2iARB */ + 0, /* glUniform3iARB */ + 0, /* glUniform4iARB */ + 0, /* glUniform1fvARB */ + 0, /* glUniform2fvARB */ + 0, /* glUniform3fvARB */ + 0, /* glUniform4fvARB */ + 0, /* glUniform1ivARB */ + 0, /* glUniform2ivARB */ + 0, /* glUniform3ivARB */ + 0, /* glUniform4ivARB */ + 0, /* glUniformMatrix2fvARB */ + 0, /* glUniformMatrix3fvARB */ + 0, /* glUniformMatrix4fvARB */ + 0, /* glGetObjectParameterfvARB */ + 0, /* glGetObjectParameterivARB */ + 0, /* glGetInfoLogARB */ + 0, /* glGetAttachedObjectsARB */ + 0, /* glGetUniformLocationARB */ + 0, /* glGetActiveUniformARB */ + 0, /* glGetUniformfvARB */ + 0, /* glGetUniformivARB */ + 0, /* glGetShaderSourceARB */ + 0, /* glBindAttribLocationARB */ + 0, /* glGetActiveAttribARB */ + 0, /* glGetAttribLocationARB */ + 0, /* glGetVertexAttribdvNV */ + 0, /* glGetVertexAttribfvNV */ + 0, /* glGetVertexAttribivNV */ + 0, /* glVertexAttrib1dNV */ + 0, /* glVertexAttrib1dvNV */ + 0, /* glVertexAttrib1fNV */ + 0, /* glVertexAttrib1fvNV */ + 0, /* glVertexAttrib1sNV */ + 0, /* glVertexAttrib1svNV */ + 0, /* glVertexAttrib2dNV */ + 0, /* glVertexAttrib2dvNV */ + 0, /* glVertexAttrib2fNV */ + 0, /* glVertexAttrib2fvNV */ + 0, /* glVertexAttrib2sNV */ + 0, /* glVertexAttrib2svNV */ + 0, /* glVertexAttrib3dNV */ + 0, /* glVertexAttrib3dvNV */ + 0, /* glVertexAttrib3fNV */ + 0, /* glVertexAttrib3fvNV */ + 0, /* glVertexAttrib3sNV */ + 0, /* glVertexAttrib3svNV */ + 0, /* glVertexAttrib4dNV */ + 0, /* glVertexAttrib4dvNV */ + 0, /* glVertexAttrib4fNV */ + 0, /* glVertexAttrib4fvNV */ + 0, /* glVertexAttrib4sNV */ + 0, /* glVertexAttrib4svNV */ + 0, /* glVertexAttrib4ubNV */ + 0, /* glVertexAttrib4ubvNV */ + 0, /* glGenFragmentShadersATI */ + 0, /* glBindFragmentShaderATI */ + 0, /* glDeleteFragmentShaderATI */ + 0, /* glBeginFragmentShaderATI */ + 0, /* glEndFragmentShaderATI */ + 0, /* glPassTexCoordATI */ + 0, /* glSampleMapATI */ + 0, /* glColorFragmentOp1ATI */ + 0, /* glColorFragmentOp2ATI */ + 0, /* glColorFragmentOp3ATI */ + 0, /* glAlphaFragmentOp1ATI */ + 0, /* glAlphaFragmentOp2ATI */ + 0, /* glAlphaFragmentOp3ATI */ + 0, /* glSetFragmentShaderConstantATI */ + xglNoOpIsRenderbufferEXT, + xglNoOpBindRenderbufferEXT, + xglNoOpDeleteRenderbuffersEXT, + xglNoOpGenRenderbuffersEXT, + xglNoOpRenderbufferStorageEXT, + xglNoOpGetRenderbufferParameterivEXT, + xglNoOpIsFramebufferEXT, + xglNoOpBindFramebufferEXT, + xglNoOpDeleteFramebuffersEXT, + xglNoOpGenFramebuffersEXT, + xglNoOpCheckFramebufferStatusEXT, + xglNoOpFramebufferTexture1DEXT, + xglNoOpFramebufferTexture2DEXT, + xglNoOpFramebufferTexture3DEXT, + xglNoOpFramebufferRenderbufferEXT, + xglNoOpGetFramebufferAttachmentParameterivEXT, + xglNoOpGenerateMipmapEXT, + 0, /* glStencilFuncSeparate */ + 0, /* glStencilOpSeparate */ + 0, /* glStencilMaskSeparate */ + 0, /* glGetQueryObjecti64vEXT */ + 0 /* glGetQueryObjectui64vEXT */ +}; + +static void +xglInitExtensions (xglGLContextPtr pContext) +{ + const char *extensions; + + extensions = (const char *) glGetString (GL_EXTENSIONS); + + if (strstr (extensions, "GL_ARB_multitexture")) + { + pContext->ActiveTextureARB = + (PFNGLACTIVETEXTUREARBPROC) + glitz_context_get_proc_address (pContext->context, + "glActiveTextureARB"); + pContext->glRenderTable.ClientActiveTextureARB = + (PFNGLCLIENTACTIVETEXTUREARBPROC) + glitz_context_get_proc_address (pContext->context, + "glClientActiveTextureARB"); + pContext->glRenderTable.MultiTexCoord1dvARB = + (PFNGLMULTITEXCOORD1DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1dvARB"); + pContext->glRenderTable.MultiTexCoord1fvARB = + (PFNGLMULTITEXCOORD1FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1fvARB"); + pContext->glRenderTable.MultiTexCoord1ivARB = + (PFNGLMULTITEXCOORD1IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1ivARB"); + pContext->glRenderTable.MultiTexCoord1svARB = + (PFNGLMULTITEXCOORD1SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1svARB"); + pContext->glRenderTable.MultiTexCoord2dvARB = + (PFNGLMULTITEXCOORD2DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2dvARB"); + pContext->glRenderTable.MultiTexCoord2fvARB = + (PFNGLMULTITEXCOORD2FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2fvARB"); + pContext->glRenderTable.MultiTexCoord2ivARB = + (PFNGLMULTITEXCOORD2IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2ivARB"); + pContext->glRenderTable.MultiTexCoord2svARB = + (PFNGLMULTITEXCOORD2SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2svARB"); + pContext->glRenderTable.MultiTexCoord3dvARB = + (PFNGLMULTITEXCOORD3DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3dvARB"); + pContext->glRenderTable.MultiTexCoord3fvARB = + (PFNGLMULTITEXCOORD3FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3fvARB"); + pContext->glRenderTable.MultiTexCoord3ivARB = + (PFNGLMULTITEXCOORD3IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3ivARB"); + pContext->glRenderTable.MultiTexCoord3svARB = + (PFNGLMULTITEXCOORD3SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3svARB"); + pContext->glRenderTable.MultiTexCoord4dvARB = + (PFNGLMULTITEXCOORD4DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4dvARB"); + pContext->glRenderTable.MultiTexCoord4fvARB = + (PFNGLMULTITEXCOORD4FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4fvARB"); + pContext->glRenderTable.MultiTexCoord4ivARB = + (PFNGLMULTITEXCOORD4IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4ivARB"); + pContext->glRenderTable.MultiTexCoord4svARB = + (PFNGLMULTITEXCOORD4SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4svARB"); + + glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &pContext->maxTexUnits); + if (pContext->maxTexUnits > XGL_MAX_TEXTURE_UNITS) + pContext->maxTexUnits = XGL_MAX_TEXTURE_UNITS; + + pContext->glRenderTable.ActiveTextureARB = xglActiveTextureARB; + } + else + pContext->maxTexUnits = 1; + + if (strstr (extensions, "GL_ARB_multisample")) + { + pContext->glRenderTable.SampleCoverageARB = + (PFNGLSAMPLECOVERAGEARBPROC) + glitz_context_get_proc_address (pContext->context, + "glSampleCoverageARB"); + } + + if (strstr (extensions, "GL_EXT_texture_object")) + { + pContext->glRenderTable.AreTexturesResidentEXT = + xglAreTexturesResident; + pContext->glRenderTable.GenTexturesEXT = xglGenTextures; + pContext->glRenderTable.IsTextureEXT = xglIsTexture; + } + + if (strstr (extensions, "GL_SGIS_multisample")) + { + pContext->glRenderTable.SampleMaskSGIS = + (PFNGLSAMPLEMASKSGISPROC) + glitz_context_get_proc_address (pContext->context, + "glSampleMaskSGIS"); + pContext->glRenderTable.SamplePatternSGIS = + (PFNGLSAMPLEPATTERNSGISPROC) + glitz_context_get_proc_address (pContext->context, + "glSamplePatternSGIS"); + } + + if (strstr (extensions, "GL_EXT_point_parameters")) + { + pContext->glRenderTable.PointParameterfEXT = + (PFNGLPOINTPARAMETERFEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameterfEXT"); + pContext->glRenderTable.PointParameterfvEXT = + (PFNGLPOINTPARAMETERFVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameterfvEXT"); + } + + if (strstr (extensions, "GL_MESA_window_pos")) + { + pContext->WindowPos3fMESA = + (PFNGLWINDOWPOS3FMESAPROC) + glitz_context_get_proc_address (pContext->context, + "glWindowPos3fMESA"); + + pContext->glRenderTable.WindowPos3fMESA = xglWindowPos3fMESA; + } + + if (strstr (extensions, "GL_EXT_blend_func_separate")) + { + pContext->glRenderTable.BlendFuncSeparateEXT = + (PFNGLBLENDFUNCSEPARATEEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glBlendFuncSeparateEXT"); + } + + if (strstr (extensions, "GL_EXT_fog_coord")) + { + pContext->glRenderTable.FogCoordfvEXT = + (PFNGLFOGCOORDFVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFogCoordfvEXT"); + pContext->glRenderTable.FogCoorddvEXT = + (PFNGLFOGCOORDDVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFogCoorddvEXT"); + pContext->glRenderTable.FogCoordPointerEXT = + (PFNGLFOGCOORDPOINTEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFogCoordPointerEXT"); + } + + if (strstr (extensions, "GL_EXT_secondary_color")) + { + pContext->glRenderTable.SecondaryColor3bvEXT = + (PFNGLSECONDARYCOLOR3BVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3bvEXT"); + pContext->glRenderTable.SecondaryColor3dvEXT = + (PFNGLSECONDARYCOLOR3DVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3dvEXT"); + pContext->glRenderTable.SecondaryColor3fvEXT = + (PFNGLSECONDARYCOLOR3FVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3fvEXT"); + pContext->glRenderTable.SecondaryColor3ivEXT = + (PFNGLSECONDARYCOLOR3IVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3ivEXT"); + pContext->glRenderTable.SecondaryColor3svEXT = + (PFNGLSECONDARYCOLOR3SVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3svEXT"); + pContext->glRenderTable.SecondaryColor3ubvEXT = + (PFNGLSECONDARYCOLOR3UBVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3ubvEXT"); + pContext->glRenderTable.SecondaryColor3uivEXT = + (PFNGLSECONDARYCOLOR3UIVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3uivEXT"); + pContext->glRenderTable.SecondaryColor3usvEXT = + (PFNGLSECONDARYCOLOR3USVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3usvEXT"); + pContext->glRenderTable.SecondaryColorPointerEXT = + (PFNGLSECONDARYCOLORPOINTEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColorPointerEXT"); + } + + if (strstr (extensions, "GL_NV_point_sprite")) + { + pContext->glRenderTable.PointParameteriNV = + (PFNGLPOINTPARAMETERINVPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameteriNV"); + pContext->glRenderTable.PointParameterivNV = + (PFNGLPOINTPARAMETERIVNVPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameterivNV"); + } + + if (strstr (extensions, "GL_EXT_stencil_two_side")) + { + pContext->glRenderTable.ActiveStencilFaceEXT = + (PFNGLACTIVESTENCILFACEEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glActiveStencilFaceEXT"); + } + + if (strstr (extensions, "GL_EXT_framebuffer_object")) + { + pContext->glRenderTable.IsRenderbufferEXT = + (PFNGLISRENDERBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glIsRenderbufferEXT"); + pContext->glRenderTable.BindRenderbufferEXT = + (PFNGLBINDRENDERBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glBindRenderbufferEXT"); + pContext->glRenderTable.DeleteRenderbuffersEXT = + (PFNGLDELETERENDERBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glDeleteRenderbuffersEXT"); + pContext->glRenderTable.GenRenderbuffersEXT = + (PFNGLGENRENDERBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGenRenderbuffersEXT"); + pContext->glRenderTable.RenderbufferStorageEXT = + (PFNGLRENDERBUFFERSTORAGEEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glRenderbufferStorageEXT"); + pContext->glRenderTable.GetRenderbufferParameterivEXT = + (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGetRenderbufferParameterivEXT"); + pContext->glRenderTable.IsFramebufferEXT = + (PFNGLISFRAMEBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glIsFramebufferEXT"); + pContext->glRenderTable.BindFramebufferEXT = + (PFNGLBINDFRAMEBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glBindFramebufferEXT"); + pContext->glRenderTable.DeleteFramebuffersEXT = + (PFNGLDELETEFRAMEBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glDeleteFramebuffersEXT"); + pContext->glRenderTable.GenFramebuffersEXT = + (PFNGLGENFRAMEBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGenFramebuffersEXT"); + pContext->glRenderTable.CheckFramebufferStatusEXT = + (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glCheckFramebufferStatusEXT"); + pContext->glRenderTable.FramebufferTexture1DEXT = + (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferTexture1DEXT"); + pContext->glRenderTable.FramebufferTexture2DEXT = + (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferTexture2DEXT"); + pContext->glRenderTable.FramebufferTexture3DEXT = + (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferTexture3DEXT"); + pContext->glRenderTable.FramebufferRenderbufferEXT = + (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferRenderbufferEXT"); + pContext->glRenderTable.GetFramebufferAttachmentParameterivEXT = + (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGetFramebufferAttachment" + "ParameterivEXT"); + pContext->glRenderTable.GenerateMipmapEXT = + (PFNGLGENERATEMIPMAPEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGenerateMipmapEXT"); + } +} + +static void +xglSetCurrentContext (xglGLContextPtr pContext) +{ + cctx = pContext; + + glitz_context_make_current (cctx->context, cctx->pDrawBuffer->drawable); + + GlxSetRenderTables (&cctx->glRenderTable); +} + +static void +xglFreeContext (xglGLContextPtr pContext) +{ + int i; + + pContext->refcnt--; + if (pContext->shared == pContext) + pContext->refcnt--; + + if (pContext->refcnt) + return; + + if (pContext->shared != pContext) + xglFreeContext (pContext->shared); + + if (pContext->texObjects) + { + xglTexObjPtr pTexObj; + GLuint key; + + do { + key = xglHashFirstEntry (pContext->texObjects); + if (key) + { + pTexObj = (xglTexObjPtr) xglHashLookup (pContext->texObjects, + key); + if (pTexObj) + xglUnrefTexObj (pTexObj); + + xglHashRemove (pContext->texObjects, key); + } + } while (key); + + xglDeleteHashTable (pContext->texObjects); + } + + if (pContext->displayLists) + { + xglDisplayListPtr pDisplayList; + GLuint key; + + do { + key = xglHashFirstEntry (pContext->displayLists); + if (key) + { + pDisplayList = (xglDisplayListPtr) + xglHashLookup (pContext->displayLists, key); + if (pDisplayList) + xglDestroyList (pDisplayList); + + xglHashRemove (pContext->displayLists, key); + } + } while (key); + + xglDeleteHashTable (pContext->displayLists); + } + + for (i = 0; i < pContext->maxTexUnits; i++) + { + xglUnrefTexObj (pContext->attrib.texUnits[i].p1D); + xglUnrefTexObj (pContext->attrib.texUnits[i].p2D); + xglUnrefTexObj (pContext->attrib.texUnits[i].p3D); + xglUnrefTexObj (pContext->attrib.texUnits[i].pRect); + xglUnrefTexObj (pContext->attrib.texUnits[i].pCubeMap); + } + + if (pContext->groupList) + glDeleteLists (pContext->groupList, 1); + + if (pContext->context) + glitz_context_destroy (pContext->context); + + if (pContext->versionString) + xfree (pContext->versionString); + + xfree (pContext); +} + +static GLboolean +xglDestroyContext (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + xglFreeContext (pContext); + + if (!iface) + return GL_TRUE; + + return (*iface->exports.destroyContext) ((__GLcontext *) iface); +} + +static GLboolean +xglLoseCurrent (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + GlxFlushContextCache (); + GlxSetRenderTables (0); + + if (!iface) + return GL_TRUE; + + return (*iface->exports.loseCurrent) ((__GLcontext *) iface); +} + +static GLboolean +xglMakeCurrent (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = &pContext->iface; + __GLinterface *mIface = pContext->mIface; + __GLdrawablePrivate *drawPriv = iface->imports.getDrawablePrivate (gc); + __GLdrawablePrivate *readPriv = iface->imports.getReadablePrivate (gc); + xglGLBufferPtr pDrawBufferPriv = drawPriv->private; + xglGLBufferPtr pReadBufferPriv = readPriv->private; + GLboolean status = GL_TRUE; + + if (pReadBufferPriv->pDrawable && pDrawBufferPriv->pDrawable) + { + XID values[2] = { ClipByChildren, 0 }; + int status; + +#ifdef COMPOSITE + /* XXX: temporary hack for root window drawing using + IncludeInferiors */ + if (pDrawBufferPriv->pDrawable->type == DRAWABLE_WINDOW && + (!((WindowPtr) (pDrawBufferPriv->pDrawable))->parent)) + values[0] = IncludeInferiors; +#endif + + /* this happens if client previously used this context with a buffer + not supported by the native GL stack */ + if (!pContext->context) + return GL_FALSE; + + /* XXX: GLX_SGI_make_current_read disabled for now */ + if (pDrawBufferPriv != pReadBufferPriv) + return GL_FALSE; + + if (!pReadBufferPriv->pGC) + pReadBufferPriv->pGC = + CreateGC (pReadBufferPriv->pDrawable, + GCSubwindowMode | GCGraphicsExposures, values, + &status); + + ValidateGC (pReadBufferPriv->pDrawable, pReadBufferPriv->pGC); + + if (!pDrawBufferPriv->pGC) + pDrawBufferPriv->pGC = + CreateGC (pDrawBufferPriv->pDrawable, + GCSubwindowMode | GCGraphicsExposures, values, + &status); + + ValidateGC (pDrawBufferPriv->pDrawable, pDrawBufferPriv->pGC); + + pReadBufferPriv->pPixmap = (PixmapPtr) 0; + pDrawBufferPriv->pPixmap = (PixmapPtr) 0; + + pContext->pReadBuffer = pReadBufferPriv; + pContext->pDrawBuffer = pDrawBufferPriv; + + pContext->readPriv = readPriv; + pContext->drawPriv = drawPriv; + + /* from now on this context can only be used with native GL stack */ + if (mIface) + { + (*mIface->exports.destroyContext) ((__GLcontext *) mIface); + pContext->mIface = NULL; + } + } + else + { + /* this happens if client previously used this context with a buffer + supported by the native GL stack */ + if (!mIface) + return GL_FALSE; + + drawPriv->private = pDrawBufferPriv->private; + readPriv->private = pReadBufferPriv->private; + + status = (*mIface->exports.makeCurrent) ((__GLcontext *) mIface); + + drawPriv->private = pDrawBufferPriv; + readPriv->private = pReadBufferPriv; + + /* from now on this context can not be used with native GL stack */ + if (status == GL_TRUE && pContext->context) + { + glitz_context_destroy (pContext->context); + pContext->context = NULL; + } + } + + return status; +} + +static GLboolean +xglShareContext (__GLcontext *gc, + __GLcontext *gcShare) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + xglGLContextPtr pContextShare = (xglGLContextPtr) gcShare; + __GLinterface *iface = pContext->mIface; + __GLinterface *ifaceShare = pContextShare->mIface; + + if (!iface || !ifaceShare) + return GL_TRUE; + + return (*iface->exports.shareContext) ((__GLcontext *) iface, + (__GLcontext *) ifaceShare); +} + +static GLboolean +xglCopyContext (__GLcontext *dst, + const __GLcontext *src, + GLuint mask) +{ + xglGLContextPtr pDst = (xglGLContextPtr) dst; + xglGLContextPtr pSrc = (xglGLContextPtr) src; + const __GLcontext *srcCtx = (const __GLcontext *) pSrc->mIface; + __GLinterface *dstIface = (__GLinterface *) pDst->mIface; + GLboolean status = GL_TRUE; + + if (pSrc->context && pDst->context) + glitz_context_copy (pSrc->context, pDst->context, mask); + else + status = GL_FALSE; + + if (dstIface && srcCtx) + status = (*dstIface->exports.copyContext) ((__GLcontext *) dstIface, + srcCtx, + mask); + + return status; +} + +static Bool +xglResizeBuffer (__GLdrawablePrivate *glPriv, + int x, + int y, + unsigned int width, + unsigned int height) +{ + xglGLBufferPtr pBufferPriv = glPriv->private; + DrawablePtr pDrawable = pBufferPriv->pDrawable; + + XGL_SCREEN_PRIV (pDrawable->pScreen); + XGL_DRAWABLE_PIXMAP (pBufferPriv->pDrawable); + + if (pPixmap != pScreenPriv->pScreenPixmap) + { + if (!xglCreatePixmapSurface (pPixmap)) + return FALSE; + + if (pBufferPriv->drawable == pScreenPriv->drawable) + { + if (pBufferPriv->backSurface) + glitz_surface_destroy (pBufferPriv->backSurface); + + glitz_drawable_destroy (pBufferPriv->drawable); + + pBufferPriv->drawable = NULL; + pBufferPriv->backSurface = NULL; + } + + if (pBufferPriv->drawable) + { + glitz_drawable_update_size (pBufferPriv->drawable, + pPixmap->drawable.width, + pPixmap->drawable.height); + } + else + { + glitz_drawable_format_t *format; + + format = pBufferPriv->pVisual->format.drawable; + if (pBufferPriv->pVisual->pbuffer) + { + pBufferPriv->drawable = + glitz_create_pbuffer_drawable (pScreenPriv->drawable, + format, + pPixmap->drawable.width, + pPixmap->drawable.height); + } + else + { + pBufferPriv->drawable = + glitz_create_drawable (pScreenPriv->drawable, format, + pPixmap->drawable.width, + pPixmap->drawable.height); + + if (!pBufferPriv->drawable) + return FALSE; + + if (format->doublebuffer) + { + glitz_format_t *backFormat; + + backFormat = pBufferPriv->pVisual->format.surface; + + pBufferPriv->backSurface = + glitz_surface_create (pScreenPriv->drawable, backFormat, + pPixmap->drawable.width, + pPixmap->drawable.height, + 0, NULL); + if (pBufferPriv->backSurface) + glitz_surface_attach (pBufferPriv->backSurface, + pBufferPriv->drawable, + GLITZ_DRAWABLE_BUFFER_BACK_COLOR); + } + } + } + } + else + { + glitz_drawable_reference (pScreenPriv->drawable); + + if (pBufferPriv->backSurface) + glitz_surface_destroy (pBufferPriv->backSurface); + + if (pBufferPriv->drawable) + glitz_drawable_destroy (pBufferPriv->drawable); + + pBufferPriv->drawable = pScreenPriv->drawable; + pBufferPriv->backSurface = NULL; + } + + ValidateGC (pDrawable, pBufferPriv->pGC); + + return TRUE; +} + +static GLboolean +xglForceCurrent (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + GLboolean status = GL_TRUE; + + if (pContext && pContext->context) + { + __GLdrawablePrivate *readPriv, *drawPriv; + + readPriv = pContext->readPriv; + drawPriv = pContext->drawPriv; + + drawPriv->lockDP (drawPriv, gc); + if (readPriv != drawPriv) + readPriv->lockDP (readPriv, gc); + + cctx = pContext; + + if (cctx->pReadBuffer->pDrawable && cctx->pDrawBuffer->pDrawable) + { + DrawablePtr pDrawable = cctx->pReadBuffer->pDrawable; + PixmapPtr pReadPixmap, pDrawPixmap; + + XGL_SCREEN_PRIV (pDrawable->pScreen); + + if (pDrawable->type != DRAWABLE_PIXMAP) + { + pReadPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable); + cctx->pReadBuffer->screenX = __XGL_OFF_X_WIN (pReadPixmap); + cctx->pReadBuffer->screenY = __XGL_OFF_Y_WIN (pReadPixmap); + cctx->pReadBuffer->xOff = pDrawable->x + + __XGL_OFF_X_WIN (pReadPixmap); + cctx->pReadBuffer->yOff = pReadPixmap->drawable.height - + ((pDrawable->y + __XGL_OFF_Y_WIN (pReadPixmap)) + + pDrawable->height); + cctx->pReadBuffer->yFlip = pReadPixmap->drawable.height; + } + else + { + pReadPixmap = (PixmapPtr) pDrawable; + cctx->pReadBuffer->screenX = cctx->pReadBuffer->screenY = 0; + cctx->pReadBuffer->xOff = cctx->pReadBuffer->yOff = 0; + cctx->pReadBuffer->yFlip = pDrawable->height; + } + + pDrawable = cctx->pDrawBuffer->pDrawable; + if (pDrawable->type != DRAWABLE_PIXMAP) + { + pDrawPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable); + cctx->pDrawBuffer->screenX = __XGL_OFF_X_WIN (pDrawPixmap); + cctx->pDrawBuffer->screenY = __XGL_OFF_Y_WIN (pDrawPixmap); + cctx->pDrawBuffer->xOff = pDrawable->x + + __XGL_OFF_X_WIN (pDrawPixmap); + cctx->pDrawBuffer->yOff = pDrawPixmap->drawable.height - + ((pDrawable->y + __XGL_OFF_Y_WIN (pDrawPixmap)) + + pDrawable->height); + cctx->pDrawBuffer->yFlip = pDrawPixmap->drawable.height; + } + else + { + pDrawPixmap = (PixmapPtr) pDrawable; + cctx->pDrawBuffer->screenX = cctx->pDrawBuffer->screenY = 0; + cctx->pDrawBuffer->xOff = cctx->pDrawBuffer->yOff = 0; + cctx->pDrawBuffer->yFlip = pDrawable->height; + } + + /* buffer changed */ + if (cctx->pDrawBuffer->pPixmap != pDrawPixmap || + cctx->pReadBuffer->pPixmap != pReadPixmap) + { + if (!xglResizeBuffer (drawPriv, + pDrawable->x, + pDrawable->y, + pDrawable->width, + pDrawable->height)) + { + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + + return FALSE; + } + + if (!xglResizeBuffer (readPriv, + cctx->pReadBuffer->pDrawable->x, + cctx->pReadBuffer->pDrawable->y, + cctx->pReadBuffer->pDrawable->width, + cctx->pReadBuffer->pDrawable->height)) + { + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + + return FALSE; + } + + cctx->pReadBuffer->pPixmap = pReadPixmap; + cctx->pDrawBuffer->pPixmap = pDrawPixmap; + } + + if (!xglSyncSurface (pContext->pDrawBuffer->pDrawable)) + { + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + + return FALSE; + } + + if (pDrawPixmap != pScreenPriv->pScreenPixmap) + { + XGL_PIXMAP_PRIV (pDrawPixmap); + + glitz_surface_attach (pPixmapPriv->surface, + pContext->pDrawBuffer->drawable, + GLITZ_DRAWABLE_BUFFER_FRONT_COLOR); + + if (pPixmapPriv->target) + pPixmapPriv->target = xglPixmapTargetOut; + } + + xglSetCurrentContext (pContext); + + if (cctx->needInit) + { + int i; + + xglInitExtensions (cctx); + + glGetIntegerv (GL_MAX_LIST_NESTING, &cctx->maxListNesting); + glGetIntegerv (GL_MAX_ATTRIB_STACK_DEPTH, + &cctx->maxAttribStackDepth); + if (cctx->maxAttribStackDepth > XGL_MAX_ATTRIB_STACK_DEPTH) + cctx->maxAttribStackDepth = XGL_MAX_ATTRIB_STACK_DEPTH; + + cctx->attrib.scissorTest = GL_FALSE; + cctx->attrib.scissor.x = cctx->attrib.scissor.y = 0; + cctx->attrib.scissor.width = + cctx->pDrawBuffer->pDrawable->width; + cctx->attrib.scissor.height = + cctx->pDrawBuffer->pDrawable->height; + cctx->attrib.viewport = cctx->attrib.scissor; + + cctx->activeTexUnit = 0; + + for (i = 0; i < cctx->maxTexUnits; i++) + { + cctx->attrib.texUnits[i].enabled = 0; + + cctx->attrib.texUnits[i].p1D = NULL; + cctx->attrib.texUnits[i].p2D = NULL; + cctx->attrib.texUnits[i].p3D = NULL; + cctx->attrib.texUnits[i].pRect = NULL; + cctx->attrib.texUnits[i].pCubeMap = NULL; + } + + glEnable (GL_SCISSOR_TEST); + + cctx->needInit = FALSE; + } + + /* update viewport and raster position */ + if (cctx->pDrawBuffer->xOff != cctx->drawXoff || + cctx->pDrawBuffer->yOff != cctx->drawYoff) + { + glViewport (cctx->attrib.viewport.x + cctx->pDrawBuffer->xOff, + cctx->attrib.viewport.y + cctx->pDrawBuffer->yOff, + cctx->attrib.viewport.width, + cctx->attrib.viewport.height); + + glBitmap (0, 0, 0, 0, + cctx->pDrawBuffer->xOff - cctx->drawXoff, + cctx->pDrawBuffer->yOff - cctx->drawYoff, + NULL); + + cctx->drawXoff = cctx->pDrawBuffer->xOff; + cctx->drawYoff = cctx->pDrawBuffer->yOff; + } + + xglDrawBuffer (cctx->attrib.drawBuffer); + xglReadBuffer (cctx->attrib.readBuffer); + } + else + { + xglSetCurrentContext (pContext); + } + + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + } + else + { + cctx = NULL; + status = (*iface->exports.forceCurrent) ((__GLcontext *) iface); + } + + return status; +} + +static GLboolean +xglNotifyResize (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (!iface) + return GL_TRUE; + + return (*iface->exports.notifyResize) ((__GLcontext *) iface); +} + +static void +xglNotifyDestroy (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + pContext->pReadBuffer->pDrawable = 0; + pContext->pDrawBuffer->pDrawable = 0; + + if (iface) + (*iface->exports.notifyDestroy) ((__GLcontext *) iface); +} + +static void +xglNotifySwapBuffers (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (iface) + (*iface->exports.notifySwapBuffers) ((__GLcontext *) iface); +} + +static struct __GLdispatchStateRec * +xglDispatchExec (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (!iface) + return NULL; + + return (*iface->exports.dispatchExec) ((__GLcontext *) iface); +} + +static void +xglBeginDispatchOverride (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (iface) + (*iface->exports.beginDispatchOverride) ((__GLcontext *) iface); +} + +static void +xglEndDispatchOverride (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (iface) + (*iface->exports.endDispatchOverride) ((__GLcontext *) iface); +} + +static void +xglLoseCurrentContext (void *closure) +{ + if (closure == cctx) + { + cctx = NULL; + + GlxFlushContextCache (); + GlxSetRenderTables (0); + } +} + +static __GLinterface * +xglCreateContext (__GLimports *imports, + __GLcontextModes *modes, + __GLinterface *shareGC) +{ + glitz_drawable_format_t *format; + xglGLContextPtr pShareContext = (xglGLContextPtr) shareGC; + xglGLContextPtr pContext; + __GLinterface *shareIface = NULL; + __GLinterface *iface; + __GLXcontext *glxCtx = (__GLXcontext *) imports->other; + + XGL_SCREEN_PRIV (glxCtx->pScreen); + + pContext = xalloc (sizeof (xglGLContextRec)); + if (!pContext) + return NULL; + + format = glitz_drawable_get_format (pScreenPriv->drawable); + pContext->context = glitz_context_create (pScreenPriv->drawable, format); + glitz_context_set_user_data (pContext->context, pContext, + xglLoseCurrentContext); + + pContext->glRenderTable = __glNativeRenderTable; + pContext->needInit = TRUE; + pContext->versionString = NULL; + pContext->errorValue = GL_NO_ERROR; + pContext->shared = NULL; + pContext->list = 0; + pContext->groupList = 0; + pContext->beginCnt = 0; + pContext->nAttribStack = 0; + pContext->refcnt = 1; + pContext->doubleBuffer = glxCtx->modes->doubleBufferMode; + pContext->depthBits = glxCtx->modes->depthBits; + pContext->stencilBits = glxCtx->modes->stencilBits; + pContext->drawXoff = 0; + pContext->drawYoff = 0; + pContext->maxTexUnits = 0; + + if (pContext->doubleBuffer) + { + pContext->attrib.drawBuffer = GL_BACK; + pContext->attrib.readBuffer = GL_BACK; + } + else + { + pContext->attrib.drawBuffer = GL_FRONT; + pContext->attrib.readBuffer = GL_FRONT; + } + + pContext->attrib.scissorTest = GL_FALSE; + + if (shareGC) + { + pContext->texObjects = NULL; + pContext->displayLists = NULL; + + pContext->shared = pShareContext->shared; + shareIface = pShareContext->mIface; + } + else + { + pContext->texObjects = xglNewHashTable (); + if (!pContext->texObjects) + { + xglFreeContext (pContext); + return NULL; + } + + pContext->displayLists = xglNewHashTable (); + if (!pContext->displayLists) + { + xglFreeContext (pContext); + return NULL; + } + + pContext->shared = pContext; + } + + pContext->shared->refcnt++; + + iface = (*screenInfoPriv.createContext) (imports, modes, shareIface); + if (!iface) + { + xglFreeContext (pContext); + return NULL; + } + + pContext->mIface = iface; + pContext->iface.imports = *imports; + + pContext->iface.exports.destroyContext = xglDestroyContext; + pContext->iface.exports.loseCurrent = xglLoseCurrent; + pContext->iface.exports.makeCurrent = xglMakeCurrent; + pContext->iface.exports.shareContext = xglShareContext; + pContext->iface.exports.copyContext = xglCopyContext; + pContext->iface.exports.forceCurrent = xglForceCurrent; + pContext->iface.exports.notifyResize = xglNotifyResize; + pContext->iface.exports.notifyDestroy = xglNotifyDestroy; + pContext->iface.exports.notifySwapBuffers = xglNotifySwapBuffers; + pContext->iface.exports.dispatchExec = xglDispatchExec; + pContext->iface.exports.beginDispatchOverride = xglBeginDispatchOverride; + pContext->iface.exports.endDispatchOverride = xglEndDispatchOverride; + + return (__GLinterface *) pContext; +} + +static GLboolean +xglSwapBuffers (__GLXdrawablePrivate *glxPriv) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + xglGLBufferPtr pBufferPriv = glPriv->private; + DrawablePtr pDrawable = pBufferPriv->pDrawable; + GLboolean status = GL_TRUE; + + if (pDrawable) + { + if (glPriv->modes->doubleBufferMode) + { + glitz_surface_t *surface; + int xOff, yOff; + GCPtr pGC = pBufferPriv->pGC; + BoxPtr pBox = REGION_RECTS (pGC->pCompositeClip); + int nBox = REGION_NUM_RECTS (pGC->pCompositeClip); + + XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff); + + glitz_drawable_swap_buffer_region (pBufferPriv->drawable, + xOff, yOff, + (glitz_box_t *) pBox, nBox); + + xglAddBitDamage (pDrawable, pGC->pCompositeClip); + DamageDamageRegion (pDrawable, pGC->pCompositeClip); + REGION_EMPTY (pGC->pScreen, &pBufferPriv->damage); + } + } + else if (pBufferPriv->private) + { + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->swapBuffers) (glxPriv); + glPriv->private = pBufferPriv; + } + + return status; +} + +static GLboolean +xglResizeBuffers (__GLdrawableBuffer *buffer, + GLint x, + GLint y, + GLuint width, + GLuint height, + __GLdrawablePrivate *glPriv, + GLuint bufferMask) +{ + xglGLBufferPtr pBufferPriv = glPriv->private; + DrawablePtr pDrawable = pBufferPriv->pDrawable; + GLboolean status = GL_TRUE; + + if (pDrawable) + { + if (!xglResizeBuffer (glPriv, x, y, width, height)) + return GL_FALSE; + } + else if (pBufferPriv->private) + { + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->resizeBuffers) (buffer, + x, y, width, height, + glPriv, + bufferMask); + glPriv->private = pBufferPriv; + } + + return status; +} + +static int +xglBindBuffers (__GLXdrawablePrivate *glxPriv, + int buffer) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + xglGLBufferPtr pBufferPriv = glPriv->private; + + if (cctx) + { + xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit]; + xglTexObjPtr pTexObj = NULL; + DrawablePtr pDrawable; + + /* XXX: front left buffer is only supported so far */ + if (buffer != GLX_FRONT_LEFT_EXT) + return BadMatch; + + /* Must be a GLXpixmap */ + if (!glxPriv->pGlxPixmap) + return BadDrawable; + + pDrawable = glxPriv->pGlxPixmap->pDraw; + + switch (glxPriv->texTarget) { + case GLX_TEXTURE_RECTANGLE_EXT: + pTexObj = pTexUnit->pRect; + break; + case GLX_TEXTURE_2D_EXT: + pTexObj = pTexUnit->p2D; + break; + default: + break; + } + + if (pTexObj) + { + glitz_texture_object_t *object; + + XGL_SCREEN_PRIV (pDrawable->pScreen); + XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); + + if (pPixmap == pScreenPriv->pScreenPixmap) + return BadDrawable; + + object = glitz_texture_object_create (pPixmapPriv->surface); + if (object) + { + pPixmap->refcnt++; + + if (pTexObj->pPixmap) + (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap); + + if (pTexObj->object) + glitz_texture_object_destroy (pTexObj->object); + + pTexObj->pPixmap = pPixmap; + pTexObj->object = object; + + return Success; + } + } + } + else if (pBufferPriv->private) + { + int status; + + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->bindBuffers) (glxPriv, buffer); + glPriv->private = pBufferPriv; + + return status; + } + + return BadDrawable; +} + +static int +xglReleaseBuffers (__GLXdrawablePrivate *glxPriv, + int buffer) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + xglGLBufferPtr pBufferPriv = glPriv->private; + + if (cctx) + { + xglTexObjPtr pTexObj; + + /* XXX: front left buffer is only supported so far */ + if (buffer != GLX_FRONT_LEFT_EXT) + return BadMatch; + + /* Must be a GLXpixmap */ + if (glxPriv->pGlxPixmap) + { + DrawablePtr pDrawable = glxPriv->pGlxPixmap->pDraw; + + XGL_DRAWABLE_PIXMAP (pDrawable); + + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + if (pTexObj && pTexObj->pPixmap == pPixmap) + { + (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap); + pTexObj->pPixmap = NULL; + glitz_texture_object_destroy (pTexObj->object); + pTexObj->object = NULL; + + return Success; + } + else + { + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + if (pTexObj && pTexObj->pPixmap == pPixmap) + { + (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap); + pTexObj->pPixmap = NULL; + glitz_texture_object_destroy (pTexObj->object); + pTexObj->object = NULL; + + return Success; + } + } + } + } + else if (pBufferPriv->private) + { + int status; + + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->releaseBuffers) (glxPriv, buffer); + glPriv->private = pBufferPriv; + + return status; + } + + return BadDrawable; +} +static void +xglFreeBuffers (__GLdrawablePrivate *glPriv) +{ + xglGLBufferPtr pBufferPriv = glPriv->private; + + glPriv->private = pBufferPriv->private; + + if (pBufferPriv->freeBuffers) + (*pBufferPriv->freeBuffers) (glPriv); + + if (pBufferPriv->pGC) + FreeGC (pBufferPriv->pGC, (GContext) 0); + + if (pBufferPriv->backSurface) + glitz_surface_destroy (pBufferPriv->backSurface); + + if (pBufferPriv->drawable) + glitz_drawable_destroy (pBufferPriv->drawable); + + xfree (pBufferPriv); +} + +static void +xglCreateBuffer (__GLXdrawablePrivate *glxPriv) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + DrawablePtr pDrawable = glxPriv->pDraw; + ScreenPtr pScreen = pDrawable->pScreen; + xglGLBufferPtr pBufferPriv; + xglVisualPtr v; + + XGL_SCREEN_PRIV (pScreen); + XGL_DRAWABLE_PIXMAP (pDrawable); + + pBufferPriv = xalloc (sizeof (xglGLBufferRec)); + if (!pBufferPriv) + FatalError ("xglCreateBuffer: No memory\n"); + + pBufferPriv->pScreen = pScreen; + pBufferPriv->pDrawable = NULL; + pBufferPriv->pPixmap = NULL; + pBufferPriv->pGC = NULL; + + pBufferPriv->swapBuffers = NULL; + + pBufferPriv->bindBuffers = NULL; + pBufferPriv->releaseBuffers = NULL; + + pBufferPriv->resizeBuffers = NULL; + pBufferPriv->private = NULL; + pBufferPriv->freeBuffers = NULL; + + pBufferPriv->drawable = NULL; + pBufferPriv->backSurface = NULL; + + REGION_INIT (pScreen, &pBufferPriv->damage, NullBox, 0); + + pBufferPriv->pVisual = 0; + + /* glx acceleration */ + if (pScreenPriv->accel.glx.enabled && + xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.glx.size)) + { + for (v = pScreenPriv->pGlxVisual; v; v = v->next) + { + glitz_drawable_format_t *format; + + if (pScreenPriv->accel.glx.pbuffer != v->pbuffer) + continue; + + format = v->format.drawable; + if (!format) + continue; + + if (format->color.red_size != glxPriv->modes->redBits || + format->color.green_size != glxPriv->modes->greenBits || + format->color.blue_size != glxPriv->modes->blueBits) + continue; + + if (format->color.alpha_size < glxPriv->modes->alphaBits || + format->depth_size < glxPriv->modes->depthBits || + format->stencil_size < glxPriv->modes->stencilBits || + format->doublebuffer < glxPriv->modes->doubleBufferMode) + continue; + + /* this is good enought for pbuffers */ + if (v->pbuffer) + break; + + /* we want an exact match for non-pbuffer formats */ + if (format->color.alpha_size == glxPriv->modes->alphaBits && + format->depth_size == glxPriv->modes->depthBits && + format->stencil_size == glxPriv->modes->stencilBits && + format->doublebuffer == glxPriv->modes->doubleBufferMode) + break; + } + + pBufferPriv->pVisual = v; + } + + if ((pDrawable->type == DRAWABLE_WINDOW) + +#ifdef COMPOSITE + && (pBufferPriv->pVisual + + /* this is a root window, can't be redirected */ + || (!((WindowPtr) pDrawable)->parent)) +#endif + + ) + { + pBufferPriv->pDrawable = pDrawable; + } + else + { + (*screenInfoPriv.createBuffer) (glxPriv); + + /* Wrap the swap buffers routine */ + pBufferPriv->swapBuffers = glxPriv->swapBuffers; + + /* Wrap the render texture routines */ + pBufferPriv->bindBuffers = glxPriv->bindBuffers; + pBufferPriv->releaseBuffers = glxPriv->releaseBuffers; + + /* Wrap the front buffer's resize routine */ + pBufferPriv->resizeBuffers = glPriv->frontBuffer.resize; + + /* Save Xgl's private buffer structure */ + pBufferPriv->freeBuffers = glPriv->freePrivate; + pBufferPriv->private = glPriv->private; + } + + glxPriv->texTarget = GLX_NO_TEXTURE_EXT; + + /* We enable render texture for all GLXPixmaps right now. Eventually, this + should only be enabled when fbconfig attribute GLX_RENDER_TEXTURE_RGB or + GLX_RENDER_TEXTURE_RGBA is set to TRUE. */ + if (pDrawable->type != DRAWABLE_WINDOW) + { + XGL_DRAWABLE_PIXMAP (pDrawable); + + if (xglCreatePixmapSurface (pPixmap)) + { + glitz_texture_object_t *texture; + + XGL_PIXMAP_PRIV (pPixmap); + + texture = glitz_texture_object_create (pPixmapPriv->surface); + if (texture) + { + switch (glitz_texture_object_get_target (texture)) { + case GLITZ_TEXTURE_TARGET_2D: + glxPriv->texTarget = GLX_TEXTURE_2D_EXT; + break; + case GLITZ_TEXTURE_TARGET_RECT: + glxPriv->texTarget = GLX_TEXTURE_RECTANGLE_EXT; + break; + } + + glitz_texture_object_destroy (texture); + } + } + } + + glxPriv->swapBuffers = xglSwapBuffers; + + glxPriv->bindBuffers = xglBindBuffers; + glxPriv->releaseBuffers = xglReleaseBuffers; + glPriv->frontBuffer.resize = xglResizeBuffers; + + glPriv->private = (void *) pBufferPriv; + glPriv->freePrivate = xglFreeBuffers; +} + +static Bool +xglScreenProbe (int screen) +{ + ScreenPtr pScreen = screenInfo.screens[screen]; + xglVisualPtr pVisual; + Bool status; + int i; + + XGL_SCREEN_PRIV (pScreen); + + status = (*screenInfoPriv.screenProbe) (screen); + + /* Create Xgl GLX visuals */ + for (i = 0; i < __xglScreenInfoPtr->numVisuals; i++) + { + pVisual = xglFindVisualWithId (pScreen, pScreen->visuals[i].vid); + if (pVisual) + { + glitz_drawable_format_t templ, *format, *screenFormat; + unsigned long mask; + + templ.color = pVisual->format.surface->color; + templ.depth_size = __xglScreenInfoPtr->modes[i].depthBits; + templ.stencil_size = __xglScreenInfoPtr->modes[i].stencilBits; + templ.doublebuffer = __xglScreenInfoPtr->modes[i].doubleBufferMode; + templ.samples = 1; + + mask = + GLITZ_FORMAT_FOURCC_MASK | + GLITZ_FORMAT_RED_SIZE_MASK | + GLITZ_FORMAT_GREEN_SIZE_MASK | + GLITZ_FORMAT_BLUE_SIZE_MASK | + GLITZ_FORMAT_ALPHA_SIZE_MASK | + GLITZ_FORMAT_DEPTH_SIZE_MASK | + GLITZ_FORMAT_STENCIL_SIZE_MASK | + GLITZ_FORMAT_DOUBLEBUFFER_MASK | + GLITZ_FORMAT_SAMPLES_MASK; + + format = glitz_find_drawable_format (pScreenPriv->drawable, + mask, &templ, 0); + if (format) + { + xglVisualPtr v, new, *prev; + + new = xalloc (sizeof (xglVisualRec)); + if (new) + { + new->next = 0; + new->vid = pVisual->vid; + new->pPixel = pVisual->pPixel; + new->pbuffer = FALSE; + + new->format.surface = pVisual->format.surface; + new->format.drawable = format; + + prev = &pScreenPriv->pGlxVisual; + while ((v = *prev)) + prev = &v->next; + + *prev = new; + } + } + + /* use same drawable format as screen for pbuffers */ + screenFormat = glitz_drawable_get_format (pScreenPriv->drawable); + templ.id = screenFormat->id; + + mask = + GLITZ_FORMAT_ID_MASK | + GLITZ_FORMAT_FOURCC_MASK | + GLITZ_FORMAT_RED_SIZE_MASK | + GLITZ_FORMAT_GREEN_SIZE_MASK | + GLITZ_FORMAT_BLUE_SIZE_MASK | + GLITZ_FORMAT_SAMPLES_MASK; + + format = glitz_find_pbuffer_format (pScreenPriv->drawable, + mask, &templ, 0); + if (format) + { + xglVisualPtr v, new, *prev; + + new = xalloc (sizeof (xglVisualRec)); + if (new) + { + new->next = 0; + new->vid = pVisual->vid; + new->pPixel = pVisual->pPixel; + new->pbuffer = TRUE; + + new->format.surface = pVisual->format.surface; + new->format.drawable = format; + + prev = &pScreenPriv->pGlxVisual; + while ((v = *prev)) + prev = &v->next; + + *prev = new; + } + } + } + } + + /* Wrap createBuffer */ + if (__xglScreenInfoPtr->createBuffer != xglCreateBuffer) + { + screenInfoPriv.createBuffer = __xglScreenInfoPtr->createBuffer; + __xglScreenInfoPtr->createBuffer = xglCreateBuffer; + } + + /* Wrap createContext */ + if (__xglScreenInfoPtr->createContext != xglCreateContext) + { + screenInfoPriv.createContext = __xglScreenInfoPtr->createContext; + __xglScreenInfoPtr->createContext = xglCreateContext; + } + + return status; +} + +Bool +xglInitVisualConfigs (ScreenPtr pScreen) +{ + miInitVisualsProcPtr initVisualsProc = NULL; + VisualPtr visuals; + int nvisuals; + DepthPtr depths; + int ndepths; + int rootDepth; + VisualID defaultVis; + glitz_drawable_format_t *format; + xglVisualPtr pVisual; + __GLXvisualConfig *pConfig; + xglGLXVisualConfigPtr pConfigPriv, *ppConfigPriv; + XID *installedCmaps; + ColormapPtr installedCmap; + int numInstalledCmaps; + int numConfig = 1; + int bpp, i; + + XGL_SCREEN_PRIV (pScreen); + + if (xglScreenInfo.depth != 16 && xglScreenInfo.depth != 24) + return FALSE; + + for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next) + { + if (pVisual->pPixel->depth == xglScreenInfo.depth) + break; + } + + if (!pVisual) + return FALSE; + + bpp = pVisual->pPixel->masks.bpp; + + format = glitz_drawable_get_format (pScreenPriv->drawable); + if (format->doublebuffer) + numConfig *= 2; + + pConfig = xcalloc (sizeof (__GLXvisualConfig), numConfig); + if (!pConfig) + return FALSE; + + pConfigPriv = xcalloc (sizeof (xglGLXVisualConfigRec), numConfig); + if (!pConfigPriv) + { + xfree (pConfig); + return FALSE; + } + + ppConfigPriv = xcalloc (sizeof (xglGLXVisualConfigPtr), numConfig); + if (!ppConfigPriv) + { + xfree (pConfigPriv); + xfree (pConfig); + return FALSE; + } + + installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID)); + if (!installedCmaps) + { + xfree (ppConfigPriv); + xfree (pConfigPriv); + xfree (pConfig); + return FALSE; + } + + for (i = 0; i < numConfig; i++) + { + ppConfigPriv[i] = &pConfigPriv[i]; + + pConfig[i].vid = (VisualID) (-1); + pConfig[i].class = -1; + pConfig[i].rgba = TRUE; + + pConfig[i].redSize = format->color.red_size; + pConfig[i].greenSize = format->color.green_size; + pConfig[i].blueSize = format->color.blue_size; + pConfig[i].alphaSize = format->color.alpha_size; + + pConfig[i].redMask = pVisual->pPixel->masks.red_mask; + pConfig[i].greenMask = pVisual->pPixel->masks.green_mask; + pConfig[i].blueMask = pVisual->pPixel->masks.blue_mask; + pConfig[i].alphaMask = pVisual->pPixel->masks.alpha_mask; + + if (i == 1) + { + pConfig[i].doubleBuffer = FALSE; + pConfig[i].depthSize = 0; + pConfig[i].stencilSize = 0; + } + else + { + pConfig[i].doubleBuffer = TRUE; + pConfig[i].depthSize = format->depth_size; + pConfig[i].stencilSize = format->stencil_size; + } + + pConfig[i].stereo = FALSE; + + if (pScreen->rootDepth == 16) + pConfig[i].bufferSize = 16; + else + pConfig[i].bufferSize = 32; + + pConfig[i].auxBuffers = 0; + pConfig[i].level = 0; + + pConfig[i].visualRating = GLX_NONE; + + pConfig[i].transparentPixel = GLX_NONE; + pConfig[i].transparentRed = 0; + pConfig[i].transparentGreen = 0; + pConfig[i].transparentBlue = 0; + pConfig[i].transparentAlpha = 0; + pConfig[i].transparentIndex = 0; + } + + GlxSetVisualConfigs (numConfig, pConfig, (void **) ppConfigPriv); + + /* Wrap screenProbe */ + if (__xglScreenInfoPtr->screenProbe != xglScreenProbe) + { + screenInfoPriv.screenProbe = __xglScreenInfoPtr->screenProbe; + __xglScreenInfoPtr->screenProbe = xglScreenProbe; + } + + visuals = pScreen->visuals; + nvisuals = pScreen->numVisuals; + depths = pScreen->allowedDepths; + ndepths = pScreen->numDepths; + rootDepth = pScreen->rootDepth; + defaultVis = pScreen->rootVisual; + + /* Find installed colormaps */ + numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen, + installedCmaps); + + GlxWrapInitVisuals (&initVisualsProc); + GlxInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootDepth, + &defaultVis, ((unsigned long) 1 << (bpp - 1)), 8, -1); + + /* Fix up any existing installed colormaps. */ + for (i = 0; i < numInstalledCmaps; i++) + { + int j; + + installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP); + if (!installedCmap) + continue; + + j = installedCmap->pVisual - pScreen->visuals; + installedCmap->pVisual = &visuals[j]; + } + + pScreen->visuals = visuals; + pScreen->numVisuals = nvisuals; + pScreen->allowedDepths = depths; + pScreen->numDepths = ndepths; + pScreen->rootDepth = rootDepth; + pScreen->rootVisual = defaultVis; + +#ifndef NGLXLOG + xglInitGlxLog (); +#endif + + xfree (installedCmaps); + xfree (pConfigPriv); + xfree (pConfig); + + return TRUE; +} diff --git a/xorg-server/hw/xgl/glxext/xglglxext.h b/xorg-server/hw/xgl/glxext/xglglxext.h new file mode 100644 index 000000000..c353783af --- /dev/null +++ b/xorg-server/hw/xgl/glxext/xglglxext.h @@ -0,0 +1,41 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#ifndef _XGL_GLXEXT_H_ +#define _XGL_GLXEXT_H_ + +#include "scrnintstr.h" + +Bool +xglInitVisualConfigs (ScreenPtr pScreen); + +#ifndef NGLXEXTLOG + +void +xglInitGlxLog (void); + +#endif + +#endif /* _XGL_GLXEXT_H_ */ diff --git a/xorg-server/hw/xgl/glxext/xglglxlog.c b/xorg-server/hw/xgl/glxext/xglglxlog.c new file mode 100644 index 000000000..0f194c9ed --- /dev/null +++ b/xorg-server/hw/xgl/glxext/xglglxlog.c @@ -0,0 +1,4519 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglglx.h" +#include "xglglxext.h" +#include "glapitable.h" + +#ifndef NGLXEXTLOG + +static struct _glapi_table *nativeRenderTable = 0; + +static FILE *logFp = 0; + +static Bool logVertexAttribs = FALSE; + +static struct VertexAttribCount { + int n; + char *name; +} vCnt[] = { + { 0, "glArrayElement" }, + { 0, "glCallList" }, + { 0, "glCallLists" }, + { 0, "glColor3bv" }, + { 0, "glColor3dv" }, + { 0, "glColor3fv" }, + { 0, "glColor3iv" }, + { 0, "glColor3sv" }, + { 0, "glColor3ubv" }, + { 0, "glColor3uiv" }, + { 0, "glColor3usv" }, + { 0, "glColor4bv" }, + { 0, "glColor4dv" }, + { 0, "glColor4fv" }, + { 0, "glColor4iv" }, + { 0, "glColor4sv" }, + { 0, "glColor4ubv" }, + { 0, "glColor4uiv" }, + { 0, "glColor4usv" }, + { 0, "glEdgeFlagv" }, + { 0, "glEvalCoord1dv" }, + { 0, "glEvalCoord1fv" }, + { 0, "glEvalCoord2dv" }, + { 0, "glEvalCoord2fv" }, + { 0, "glEvalPoint1" }, + { 0, "glEvalPoint2" }, + { 0, "glIndexdv" }, + { 0, "glIndexfv" }, + { 0, "glIndexiv" }, + { 0, "glIndexsv" }, + { 0, "glIndexubv" }, + { 0, "glMaterialf" }, + { 0, "glMaterialfv" }, + { 0, "glMateriali" }, + { 0, "glMaterialiv" }, + { 0, "glNormal3bv" }, + { 0, "glNormal3dv" }, + { 0, "glNormal3fv" }, + { 0, "glNormal3iv" }, + { 0, "glNormal3sv" }, + { 0, "glTexCoord1dv" }, + { 0, "glTexCoord1fv" }, + { 0, "glTexCoord1iv" }, + { 0, "glTexCoord1sv" }, + { 0, "glTexCoord2dv" }, + { 0, "glTexCoord2fv" }, + { 0, "glTexCoord2iv" }, + { 0, "glTexCoord2sv" }, + { 0, "glTexCoord3dv" }, + { 0, "glTexCoord3fv" }, + { 0, "glTexCoord3iv" }, + { 0, "glTexCoord3sv" }, + { 0, "glTexCoord4dv" }, + { 0, "glTexCoord4fv" }, + { 0, "glTexCoord4iv" }, + { 0, "glTexCoord4sv" }, + { 0, "glVertex2dv" }, + { 0, "glVertex2fv" }, + { 0, "glVertex2iv" }, + { 0, "glVertex2sv" }, + { 0, "glVertex3dv" }, + { 0, "glVertex3fv" }, + { 0, "glVertex3iv" }, + { 0, "glVertex3sv" }, + { 0, "glVertex4dv" }, + { 0, "glVertex4fv" }, + { 0, "glVertex4iv" }, + { 0, "glVertex4sv" }, + { 0, "glMultiTexCoord1dv" }, + { 0, "glMultiTexCoord1fv" }, + { 0, "glMultiTexCoord1iv" }, + { 0, "glMultiTexCoord1sv" }, + { 0, "glMultiTexCoord2dv" }, + { 0, "glMultiTexCoord2fv" }, + { 0, "glMultiTexCoord2iv" }, + { 0, "glMultiTexCoord2sv" }, + { 0, "glMultiTexCoord3dv" }, + { 0, "glMultiTexCoord3fv" }, + { 0, "glMultiTexCoord3iv" }, + { 0, "glMultiTexCoord3sv" }, + { 0, "glMultiTexCoord4dv" }, + { 0, "glMultiTexCoord4fv" }, + { 0, "glMultiTexCoord4iv" }, + { 0, "glMultiTexCoord4sv" }, + { 0, "glFogCoordfv" }, + { 0, "glFogCoorddv" }, + { 0, "glSecondaryColor3bv" }, + { 0, "glSecondaryColor3dv" }, + { 0, "glSecondaryColor3fv" }, + { 0, "glSecondaryColor3iv" }, + { 0, "glSecondaryColor3sv" }, + { 0, "glSecondaryColor3ubv" }, + { 0, "glSecondaryColor3uiv" }, + { 0, "glSecondaryColor3usv" } +}; + +#define arrayElementIndex 0 +#define callListIndex 1 +#define callListsIndex 2 +#define color3bvIndex 3 +#define color3dvIndex 4 +#define color3fvIndex 5 +#define color3ivIndex 6 +#define color3svIndex 7 +#define color3ubvIndex 8 +#define color3uivIndex 9 +#define color3usvIndex 10 +#define color4bvIndex 11 +#define color4dvIndex 12 +#define color4fvIndex 13 +#define color4ivIndex 14 +#define color4svIndex 15 +#define color4ubvIndex 16 +#define color4uivIndex 17 +#define color4usvIndex 18 +#define edgeFlagvIndex 19 +#define evalCoord1dvIndex 20 +#define evalCoord1fvIndex 21 +#define evalCoord2dvIndex 22 +#define evalCoord2fvIndex 23 +#define evalPoint1Index 24 +#define evalPoint2Index 25 +#define indexdvIndex 26 +#define indexfvIndex 27 +#define indexivIndex 28 +#define indexsvIndex 29 +#define indexubvIndex 30 +#define materialfIndex 31 +#define materialfvIndex 32 +#define materialiIndex 33 +#define materialivIndex 34 +#define normal3bvIndex 35 +#define normal3dvIndex 36 +#define normal3fvIndex 37 +#define normal3ivIndex 38 +#define normal3svIndex 39 +#define texCoord1dvIndex 40 +#define texCoord1fvIndex 41 +#define texCoord1ivIndex 42 +#define texCoord1svIndex 43 +#define texCoord2dvIndex 44 +#define texCoord2fvIndex 45 +#define texCoord2ivIndex 46 +#define texCoord2svIndex 47 +#define texCoord3dvIndex 48 +#define texCoord3fvIndex 49 +#define texCoord3ivIndex 50 +#define texCoord3svIndex 51 +#define texCoord4dvIndex 52 +#define texCoord4fvIndex 53 +#define texCoord4ivIndex 54 +#define texCoord4svIndex 55 +#define vertex2dvIndex 56 +#define vertex2fvIndex 57 +#define vertex2ivIndex 58 +#define vertex2svIndex 59 +#define vertex3dvIndex 60 +#define vertex3fvIndex 61 +#define vertex3ivIndex 62 +#define vertex3svIndex 63 +#define vertex4dvIndex 64 +#define vertex4fvIndex 65 +#define vertex4ivIndex 66 +#define vertex4svIndex 67 +#define multiTexCoord1dvIndex 68 +#define multiTexCoord1fvIndex 69 +#define multiTexCoord1ivIndex 70 +#define multiTexCoord1svIndex 71 +#define multiTexCoord2dvIndex 72 +#define multiTexCoord2fvIndex 73 +#define multiTexCoord2ivIndex 74 +#define multiTexCoord2svIndex 75 +#define multiTexCoord3dvIndex 76 +#define multiTexCoord3fvIndex 77 +#define multiTexCoord3ivIndex 78 +#define multiTexCoord3svIndex 79 +#define multiTexCoord4dvIndex 80 +#define multiTexCoord4fvIndex 81 +#define multiTexCoord4ivIndex 82 +#define multiTexCoord4svIndex 83 +#define fogCoordfvIndex 84 +#define fogCoorddvIndex 85 +#define secondaryColor3bvIndex 86 +#define secondaryColor3dvIndex 87 +#define secondaryColor3fvIndex 88 +#define secondaryColor3ivIndex 89 +#define secondaryColor3svIndex 90 +#define secondaryColor3ubvIndex 91 +#define secondaryColor3uivIndex 92 +#define secondaryColor3usvIndex 93 + +static void +logAccum (GLenum op, + GLfloat value) +{ + fprintf (logFp, "glAccum (0x%x, %f)\n", op, value); + (*nativeRenderTable->Accum) (op, value); +} + +static void +logAlphaFunc (GLenum func, + GLclampf ref) +{ + fprintf (logFp, "glAlphaFunc (0x%x, %f)\n", func, ref); + (*nativeRenderTable->AlphaFunc) (func, ref); +} + +static GLboolean +logAreTexturesResident (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + fprintf (logFp, "glAreTexturesResident (%d, %p, %p)\n", n, textures, + residences); + return (*nativeRenderTable->AreTexturesResident) (n, textures, + residences); +} + +static void +logArrayElement (GLint i) +{ + vCnt[arrayElementIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glArrayElement (%d)\n", i); + (*nativeRenderTable->ArrayElement) (i); +} + +static void +logBegin (GLenum mode) +{ + fprintf (logFp, "glBegin (0x%x)\n", mode); + (*nativeRenderTable->Begin) (mode); +} + +static void +logBindTexture (GLenum target, + GLuint texture) +{ + fprintf (logFp, "glBindTexture (0x%x, %u)\n", target, texture); + (*nativeRenderTable->BindTexture) (target, texture); +} + +static void +logBitmap (GLsizei width, + GLsizei height, + GLfloat xorig, + GLfloat yorig, + GLfloat xmove, + GLfloat ymove, + const GLubyte *bitmap) +{ + fprintf (logFp, "glBitmap (%d, %d, %f, %f, %f, %f, %p)\n", + width, height, xorig, yorig, xmove, ymove, bitmap); + (*nativeRenderTable->Bitmap) (width, height, xorig, yorig, + xmove, ymove, bitmap); +} + +static void +logBlendFunc (GLenum sfactor, + GLenum dfactor) +{ + fprintf (logFp, "glBlendFunc (0x%x, 0x%x)\n", sfactor, dfactor); + (*nativeRenderTable->BlendFunc) (sfactor, dfactor); +} + +static void +logCallList (GLuint list) +{ + vCnt[callListIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glCallList (%u)\n", list); + (*nativeRenderTable->CallList) (list); +} + +static void +logCallLists (GLsizei n, + GLenum type, + const void *lists) +{ + vCnt[callListsIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glCallLists (%d, 0x%x, %p)\n", n, type, lists); + (*nativeRenderTable->CallLists) (n, type, lists); +} + +static void +logClear (GLbitfield mask) +{ + fprintf (logFp, "glClear (0x%x)\n", mask); + (*nativeRenderTable->Clear) (mask); +} + +static void +logClearAccum (GLfloat red, + GLfloat green, + GLfloat blue, + GLfloat alpha) +{ + fprintf (logFp, "glClearAccum (%f, %f, %f, %f)\n", + red, green, blue, alpha); + (*nativeRenderTable->ClearAccum) (red, green, blue, alpha); +} + +static void +logClearColor (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) +{ + fprintf (logFp, "glClearColor (%f, %f, %f, %f)\n", + red, green, blue, alpha); + (*nativeRenderTable->ClearColor) (red, green, blue, alpha); +} + +static void +logClearDepth (GLclampd depth) +{ + fprintf (logFp, "glClearDepth (%f)\n", depth); + (*nativeRenderTable->ClearDepth) (depth); +} + +static void +logClearIndex (GLfloat c) +{ + fprintf (logFp, "glClearIndex (%f)\n", c); + (*nativeRenderTable->ClearIndex) (c); +} + +static void +logClearStencil (GLint s) +{ + fprintf (logFp, "glClearStencil (%d)\n", s); + (*nativeRenderTable->ClearStencil) (s); +} + +static void +logClipPlane (GLenum plane, + const GLdouble *equation) +{ + fprintf (logFp, "glClipPlane (0x%x, %p)\n", plane, equation); + (*nativeRenderTable->ClipPlane) (plane, equation); +} + +static void +logColor3bv (const GLbyte *v) +{ + vCnt[color3bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3bv (%p)\n", v); + (*nativeRenderTable->Color3bv) (v); +} + +static void +logColor3dv (const GLdouble *v) +{ + vCnt[color3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3dv (%p)\n", v); + (*nativeRenderTable->Color3dv) (v); +} + +static void +logColor3fv (const GLfloat *v) +{ + vCnt[color3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3fv (%p)\n", v); + (*nativeRenderTable->Color3fv) (v); +} + +static void +logColor3iv (const GLint *v) +{ + vCnt[color3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3iv (%p)\n", v); + (*nativeRenderTable->Color3iv) (v); +} + +static void +logColor3sv (const GLshort *v) +{ + vCnt[color3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3sv (%p)\n", v); + (*nativeRenderTable->Color3sv) (v); +} + +static void +logColor3ubv (const GLubyte *v) +{ + vCnt[color3ubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3ubv (%p)\n", v); + (*nativeRenderTable->Color3ubv) (v); +} + +static void +logColor3uiv (const GLuint *v) +{ + vCnt[color3uivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3uiv (%p)\n", v); + (*nativeRenderTable->Color3uiv) (v); +} + +static void +logColor3usv (const GLushort *v) +{ + vCnt[color3usvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3usv (%p)\n", v); + (*nativeRenderTable->Color3usv) (v); +} + +static void +logColor4bv (const GLbyte *v) +{ + vCnt[color4bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4bv (%p)\n", v); + (*nativeRenderTable->Color4bv) (v); +} + +static void +logColor4dv (const GLdouble *v) +{ + vCnt[color4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4dv (%p)\n", v); + (*nativeRenderTable->Color4dv) (v); +} + +static void +logColor4fv (const GLfloat *v) +{ + vCnt[color4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4fv (%p)\n", v); + (*nativeRenderTable->Color4fv) (v); +} + +static void +logColor4iv (const GLint *v) +{ + vCnt[color4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4iv (%p)\n", v); + (*nativeRenderTable->Color4iv) (v); +} + +static void +logColor4sv (const GLshort *v) +{ + vCnt[color4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4sv (%p)\n", v); + (*nativeRenderTable->Color4sv) (v); +} + +static void +logColor4ubv (const GLubyte *v) +{ + vCnt[color4ubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4ubv (%p)\n", v); + (*nativeRenderTable->Color4ubv) (v); +} + +static void +logColor4uiv(const GLuint *v) +{ + vCnt[color4uivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4uiv (%p)\n", v); + (*nativeRenderTable->Color4uiv) (v); +} + +static void +logColor4usv (const GLushort *v) +{ + vCnt[color4usvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4usv (%p)\n", v); + (*nativeRenderTable->Color4usv) (v); +} + +static void +logColorMask (GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) +{ + fprintf (logFp, "glColorMask (%d, %d, %d, %d)\n", red, green, blue, alpha); + (*nativeRenderTable->ColorMask) (red, green, blue, alpha); +} + +static void +logColorMaterial (GLenum face, + GLenum mode) +{ + fprintf (logFp, "glColorMaterial (0x%x, 0x%x)\n", face, mode); + (*nativeRenderTable->ColorMaterial) (face, mode); +} + +static void +logColorPointer (GLint size, + GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glColorPointer (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->ColorPointer) (size, type, stride, pointer); +} + +static void +logCopyPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum type) +{ + fprintf (logFp, "glCopyPixels (%d, %d, %d, %d, 0x%x)\n", + x, y, width, height, type); + (*nativeRenderTable->CopyPixels) (x, y, width, height, type); +} + +static void +logCopyTexImage1D (GLenum target, + GLint level, + GLenum internalFormat, + GLint x, + GLint y, + GLsizei width, + GLint border) +{ + fprintf (logFp, "glCopyTexImage1D (0x%x, %d, 0x%x, %d, %d, %d, %d)\n", + target, level, internalFormat, x, y, width, border); + (*nativeRenderTable->CopyTexImage1D) (target, level, internalFormat, + x, y, width, border); +} + +static void +logCopyTexImage2D (GLenum target, + GLint level, + GLenum internalFormat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) +{ + fprintf (logFp, "glCopyTexImage2D (0x%x, %d, 0x%x, %d, %d, %d, %d, %d)\n", + target, level, internalFormat, x, y, width, height, border); + (*nativeRenderTable->CopyTexImage2D) (target, level, internalFormat, + x, y, width, height, border); +} + +static void +logCopyTexSubImage1D (GLenum target, + GLint level, + GLint xoffset, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyTexSubImage1D (0x%x, %d, %d, %d, %d, %d)\n", + target, level, xoffset, x, y, width); + (*nativeRenderTable->CopyTexSubImage1D) (target, level, xoffset, x, y, + width); +} + +static void +logCopyTexSubImage2D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glCopyTexSubImage2D (0x%x, %d, %d, %d, %d, %d, %d, %d)\n", + target, level, xoffset, yoffset, x, y, width, height); + (*nativeRenderTable->CopyTexSubImage2D) (target, level, + xoffset, yoffset, x, y, + width, height); +} + +static void +logCullFace (GLenum mode) +{ + fprintf (logFp, "glCullFace (0x%x)\n", mode); + (*nativeRenderTable->CullFace) (mode); +} + +static void +logDeleteLists (GLuint list, + GLsizei range) +{ + fprintf (logFp, "glDeleteLists (%d, %d)\n", list, range); + (*nativeRenderTable->DeleteLists) (list, range); +} + +static void +logDeleteTextures (GLsizei n, const GLuint *textures) +{ + fprintf (logFp, "glDeleteTextures (%d, %p)\n", n, textures); + (*nativeRenderTable->DeleteTextures) (n, textures); +} + +static void +logDepthFunc (GLenum func) +{ + fprintf (logFp, "glDepthFunc (0x%x)\n", func); + (*nativeRenderTable->DepthFunc) (func); +} + +static void +logDepthMask (GLboolean flag) +{ + fprintf (logFp, "glDepthMask (%d)\n", flag); + (*nativeRenderTable->DepthMask) (flag); +} + +static void +logDepthRange (GLclampd zNear, + GLclampd zFar) +{ + fprintf (logFp, "glDepthRange (%f, %f)\n", zNear, zFar); + (*nativeRenderTable->DepthRange) (zNear, zFar); +} + +static void +logDisable (GLenum cap) +{ + fprintf (logFp, "glDisable (0x%x)\n", cap); + (*nativeRenderTable->Disable) (cap); +} + +static void +logDisableClientState (GLenum array) +{ + fprintf (logFp, "glDisableClientState (0x%x)\n", array); + (*nativeRenderTable->DisableClientState) (array); +} + +static void +logDrawArrays (GLenum mode, + GLint first, + GLsizei count) +{ + fprintf (logFp, "glDrawArrays (0x%x, %d, %d)\n", mode, first, count); + (*nativeRenderTable->DrawArrays) (mode, first, count); +} + +static void +logDrawBuffer (GLenum mode) +{ + fprintf (logFp, "glDrawBuffer (0x%x)\n", mode); + (*nativeRenderTable->DrawBuffer) (mode); +} + +static void +logDrawElements (GLenum mode, + GLsizei count, + GLenum type, + const void *indices) +{ + fprintf (logFp, "glDrawElements (0x%x, %d, 0x%x, %p)\n", + mode, count, type, indices); + (*nativeRenderTable->DrawElements) (mode, count, type, indices); +} + +static void +logDrawPixels (GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glDrawPixels (%d, %d, 0x%x, 0x%x, %p)\n", + width, height, format, type, pixels); + (*nativeRenderTable->DrawPixels) (width, height, format, type, pixels); +} + +static void +logEdgeFlagPointer (GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glEdgeFlagPointer (%d, %p)", stride, pointer); + (*nativeRenderTable->EdgeFlagPointer) (stride, pointer); +} + +static void +logEdgeFlagv (const GLboolean *flag) +{ + vCnt[edgeFlagvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEdgeFlagv (%p)\n", flag); + (*nativeRenderTable->EdgeFlagv) (flag); +} + +static void +logEnable (GLenum cap) +{ + fprintf (logFp, "glEnable (0x%x)\n", cap); + (*nativeRenderTable->Enable) (cap); +} + +static void +logEnableClientState (GLenum array) +{ + fprintf (logFp, "glEnableClientState (0x%x)\n", array); + (*nativeRenderTable->EnableClientState) (array); +} + +static void +logEnd (void) +{ + int i; + + for (i = 0; i < sizeof (vCnt) / sizeof (vCnt[0]); i++) + { + if (vCnt[i].n) + { + fprintf (logFp, " %s: %d\n", vCnt[i].name, vCnt[i].n); + vCnt[i].n = 0; + } + } + + fprintf (logFp, "glEnd ()\n" ); + (*nativeRenderTable->End) (); +} + +static void +logEndList (void) +{ + fprintf (logFp, "glEndList ()\n" ); + (*nativeRenderTable->EndList) (); +} + +static void +logEvalCoord1dv (const GLdouble *u) +{ + vCnt[evalCoord1dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord1dv (%p)\n", u); + (*nativeRenderTable->EvalCoord1dv) (u); +} + +static void +logEvalCoord1fv (const GLfloat *u) +{ + vCnt[evalCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord1fv (%p)\n", u); + (*nativeRenderTable->EvalCoord1fv) (u); +} + +static void +logEvalCoord2dv (const GLdouble *u) +{ + vCnt[evalCoord2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord2dv (%p)\n", u); + (*nativeRenderTable->EvalCoord2dv) (u); +} + +static void +logEvalCoord2fv (const GLfloat *u) +{ + vCnt[evalCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord2fv (%p)\n", u); + (*nativeRenderTable->EvalCoord2fv) (u); +} + +static void +logEvalMesh1 (GLenum mode, + GLint i1, + GLint i2) +{ + fprintf (logFp, "glEvalMesh1 (0x%x, %d, %d)\n", mode, i1, i2); + (*nativeRenderTable->EvalMesh1) (mode, i1, i2 ); +} + +static void +logEvalMesh2 (GLenum mode, + GLint i1, + GLint i2, + GLint j1, + GLint j2) +{ + fprintf (logFp, "glEvalMesh2 (0x%x, %d, %d, %d, %d)\n", + mode, i1, i2, j1, j2); + (*nativeRenderTable->EvalMesh2) (mode, i1, i2, j1, j2); +} + +static void +logEvalPoint1 (GLint i) +{ + vCnt[evalPoint1Index].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalPoint1 (%d)\n", i); + (*nativeRenderTable->EvalPoint1) (i); +} + +static void +logEvalPoint2 (GLint i, GLint j) +{ + vCnt[evalPoint2Index].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalPoint2 (%d, %d)\n", i, j); + (*nativeRenderTable->EvalPoint2) (i, j); +} + +static void +logFeedbackBuffer (GLsizei size, + GLenum type, + GLfloat *buffer) +{ + fprintf (logFp, "glFeedbackBuffer (%d, 0x%x, %p)\n", size, type, buffer); + (*nativeRenderTable->FeedbackBuffer) (size, type, buffer); +} + +static void +logFinish (void) +{ + fprintf (logFp, "glFinish ()\n"); + (*nativeRenderTable->Finish) (); +} + +static void +logFlush (void) +{ + fprintf (logFp, "glFlush ()\n"); + (*nativeRenderTable->Flush) (); +} + +static void +logFogf (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glFogf (0x%x, %f)\n", pname, param); + (*nativeRenderTable->Fogf) (pname, param); +} + +static void +logFogfv (GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glFogfv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->Fogfv) (pname, params); +} + +static void +logFogi (GLenum pname, + GLint param) +{ + fprintf (logFp, "glFogi (0x%x, %d)\n", pname, param); + (*nativeRenderTable->Fogi) (pname, param); +} + +static void +logFogiv (GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glFogiv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->Fogiv) (pname, params); +} + +static void +logFrontFace (GLenum mode) +{ + fprintf (logFp, "glFrontFace (0x%x)\n", mode); + (*nativeRenderTable->FrontFace) (mode); +} + +static void +logFrustum (GLdouble left, + GLdouble right, + GLdouble bottom, + GLdouble top, + GLdouble zNear, + GLdouble zFar) +{ + fprintf (logFp, "glFrustum (%f, %f, %f, %f, %f, %f)\n", + left, right, bottom, top, zNear, zFar); + (*nativeRenderTable->Frustum) (left, right, bottom, top, zNear, zFar); +} + +static GLuint +logGenLists (GLsizei range) +{ + fprintf (logFp, "glGenLists (%d)\n", range); + return (*nativeRenderTable->GenLists) (range); +} + +static void +logGenTextures (GLsizei n, + GLuint *textures) +{ + fprintf (logFp, "glGenTextures (%d, %p)\n", n, textures); + (*nativeRenderTable->GenTextures) (n, textures); +} +static void +logGetBooleanv (GLenum pname, + GLboolean *params) +{ + fprintf (logFp, "glGetBooleanv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetBooleanv) (pname, params); +} + +static void +logGetClipPlane (GLenum plane, + GLdouble *equation) +{ + fprintf (logFp, "glGetClipPlane (0x%x, %p)\n", plane, equation); + (*nativeRenderTable->GetClipPlane) (plane, equation); +} + +static void +logGetDoublev (GLenum pname, + GLdouble *params) +{ + fprintf (logFp, "glGetDoublev (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetDoublev) (pname, params); +} + +static GLenum +logGetError (void) +{ + fprintf (logFp, "glGetError ()\n"); + return (*nativeRenderTable->GetError) (); +} + +static void +logGetFloatv (GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetFloatv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetFloatv) (pname, params); +} + +static void +logGetIntegerv (GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetIntegerv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetIntegerv) (pname, params); +} + +static void +logGetLightfv (GLenum light, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetLightfv (0x%x, 0x%x, %p)\n", light, pname, params); + (*nativeRenderTable->GetLightfv) (light, pname, params); +} + +static void +logGetLightiv (GLenum light, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetLightiv (0x%x, 0x%x, %p)\n", + light, pname, params); + (*nativeRenderTable->GetLightiv) (light, pname, params); +} + +static void +logGetMapdv (GLenum target, + GLenum query, + GLdouble *v) +{ + fprintf (logFp, "glGetMapdv (0x%x, 0x%x, %p)\n", target, query, v); + (*nativeRenderTable->GetMapdv) (target, query, v); +} + +static void +logGetMapfv (GLenum target, + GLenum query, + GLfloat *v) +{ + fprintf (logFp, "glGetMapfv (0x%x, 0x%x, %p)\n", target, query, v); + (*nativeRenderTable->GetMapfv) (target, query, v); +} + +static void +logGetMapiv (GLenum target, + GLenum query, + GLint *v) +{ + fprintf (logFp, "glGetMapiv (0x%x, 0x%x, %p)\n", target, query, v); + (*nativeRenderTable->GetMapiv) (target, query, v); +} + +static void +logGetMaterialfv (GLenum face, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetMaterialfv (0x%x, 0x%x, %p)\n", face, pname, params); + (*nativeRenderTable->GetMaterialfv) (face, pname, params); +} + +static void +logGetMaterialiv (GLenum face, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetMaterialiv (0x%x, 0x%x, %p)\n", face, pname, params); + (*nativeRenderTable->GetMaterialiv) (face, pname, params); +} + +static void +logGetPixelMapfv (GLenum map, + GLfloat *values) +{ + fprintf (logFp, "glGetPixelMapfv (0x%x, %p)\n", map, values); + (*nativeRenderTable->GetPixelMapfv) (map, values); +} + +static void +logGetPixelMapuiv (GLenum map, + GLuint *values) +{ + fprintf (logFp, "glGetPixelMapuiv (0x%x, %p)\n", map, values); + (*nativeRenderTable->GetPixelMapuiv) (map, values); +} + +static void +logGetPixelMapusv (GLenum map, + GLushort *values) +{ + fprintf (logFp, "glGetPixelMapusv (0x%x, %p)\n", map, values); + (*nativeRenderTable->GetPixelMapusv) (map, values); +} + +static void +logGetPointerv (GLenum pname, + GLvoid **params) +{ + fprintf (logFp, "glGetPointerv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetPointerv) (pname, params); +} + +static void +logGetPolygonStipple (GLubyte *mask) +{ + fprintf (logFp, "glGetPolygonStipple (%p)\n", mask); + (*nativeRenderTable->GetPolygonStipple) (mask); +} + +static const GLubyte * +logGetString (GLenum name) +{ + fprintf (logFp, "glGetString (0x%x)\n", name); + return (*nativeRenderTable->GetString) (name); +} + +static void +logGetTexEnvfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->GetTexEnvfv) (target, pname, params); +} + +static void +logGetTexEnviv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->GetTexEnviv) (target, pname, params); +} + +static void +logGetTexGendv (GLenum coord, + GLenum pname, + GLdouble *params) +{ + fprintf (logFp, "glGetTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->GetTexGendv) (coord, pname, params); +} + +static void +logGetTexGenfv (GLenum coord, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->GetTexGenfv) (coord, pname, params); +} + +static void +logGetTexGeniv (GLenum coord, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->GetTexGeniv) (coord, pname, params); +} + +static void +logGetTexImage (GLenum target, + GLint level, + GLenum format, + GLenum type, + void *pixels) +{ + fprintf (logFp, "glGetTexImage (0x%x, %d, 0x%x, 0x%x, %p)\n", + target, level, format, type, pixels); + (*nativeRenderTable->GetTexImage) (target, level, format, type, + pixels); +} +static void +logGetTexLevelParameterfv (GLenum target, + GLint level, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexLevelParameterfv (0x%x, %d, 0x%x, %p)\n", + target, level, pname, params); + (*nativeRenderTable->GetTexLevelParameterfv) (target, level, + pname, params); +} + +static void +logGetTexLevelParameteriv (GLenum target, + GLint level, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexLevelParameteriv (0x%x, %d, 0x%x, %p)\n", + target, level, pname, params); + (*nativeRenderTable->GetTexLevelParameteriv) (target, level, + pname, params); +} + +static void +logGetTexParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetTexParameterfv) (target, pname, params); +} + +static void +logGetTexParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetTexParameteriv) (target, pname, params); +} + +static void +logHint (GLenum target, + GLenum mode) +{ + fprintf (logFp, "glHint (0x%x, 0x%x)\n", target, mode); + (*nativeRenderTable->Hint) (target, mode); +} + +static void +logIndexMask (GLuint mask) +{ + fprintf (logFp, "glIndexMask (%d)\n", mask); + (*nativeRenderTable->IndexMask) (mask); +} + +static void +logIndexPointer (GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glIndexPointer (0x%x, %d, %p)\n", type, stride, pointer); + (*nativeRenderTable->IndexPointer) (type, stride, pointer); +} + +static void +logIndexdv (const GLdouble *c) +{ + vCnt[indexdvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexdv (%p)\n", c); + (*nativeRenderTable->Indexdv) (c); +} + +static void +logIndexfv (const GLfloat *c) +{ + vCnt[indexfvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexfv (%p)\n", c); + (*nativeRenderTable->Indexfv) (c); +} + +static void +logIndexiv (const GLint *c) +{ + vCnt[indexivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexiv (%p)\n", c); + (*nativeRenderTable->Indexiv) (c); +} + +static void +logIndexsv (const GLshort *c) +{ + vCnt[indexsvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexsv (%p)\n", c); + (*nativeRenderTable->Indexsv) (c); +} + +static void +logIndexubv (const GLubyte *c) +{ + vCnt[indexubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexubv (%p)\n", c); + (*nativeRenderTable->Indexubv) (c); +} + +static void +logInitNames (void) +{ + fprintf (logFp, "glInitNames ()\n" ); + (*nativeRenderTable->InitNames) (); +} + +static void +logInterleavedArrays (GLenum format, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glInterleavedArrays (0x%x, %d, %p)\n", + format, stride, pointer); + (*nativeRenderTable->InterleavedArrays) (format, stride, pointer); +} + +static GLboolean +logIsEnabled (GLenum cap) +{ + fprintf (logFp, "glIsEnabled (0x%x)\n", cap); + return (*nativeRenderTable->IsEnabled) (cap); +} + +static GLboolean +logIsList (GLuint list) +{ + fprintf (logFp, "glIsList (%d)\n", list); + return (*nativeRenderTable->IsList) (list); +} + +static GLboolean +logIsTexture (GLuint texture) +{ + fprintf (logFp, "glIsTexture (%d)\n", texture); + return (*nativeRenderTable->IsTexture) (texture); +} + +static void +logLightModelf (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glLightModelf (0x%x, %f)\n", pname, param); + (*nativeRenderTable->LightModelf) (pname, param); +} + +static void +logLightModelfv (GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glLightModelfv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->LightModelfv) (pname, params); +} + +static void +logLightModeli (GLenum pname, + GLint param) +{ + fprintf (logFp, "glLightModeli (0x%x, %d)\n", pname, param); + (*nativeRenderTable->LightModeli) (pname, param); +} + +static void +logLightModeliv (GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glLightModeliv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->LightModeliv) (pname, params); +} + +static void +logLightf (GLenum light, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glLightf (0x%x, 0x%x, %f)\n", light, pname, param); + (*nativeRenderTable->Lightf) (light, pname, param); +} + +static void +logLightfv (GLenum light, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glLightfv (0x%x, 0x%x, %p)\n", light, pname, params); + (*nativeRenderTable->Lightfv) (light, pname, params); +} + +static void +logLighti (GLenum light, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glLighti (0x%x, 0x%x, %d)\n", light, pname, param); + (*nativeRenderTable->Lighti) (light, pname, param); +} + +static void +logLightiv (GLenum light, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glLightiv (0x%x, 0x%x, %p)\n", light, pname, params); + (*nativeRenderTable->Lightiv) (light, pname, params); +} + +static void +logLineStipple (GLint factor, + GLushort pattern) +{ + fprintf (logFp, "glLineStipple (%d, %d)\n", factor, pattern); + (*nativeRenderTable->LineStipple) (factor, pattern); +} + +static void +logLineWidth (GLfloat width) +{ + fprintf (logFp, "glLineWidth (%f)\n", width); + (*nativeRenderTable->LineWidth) (width); +} + +static void +logListBase (GLuint base) +{ + fprintf (logFp, "glListBase (%d)\n", base); + (*nativeRenderTable->ListBase) (base); +} + +static void +logLoadIdentity (void) +{ + fprintf (logFp, "glLoadIdentity ()\n"); + (*nativeRenderTable->LoadIdentity) (); +} + +static void +logLoadMatrixd (const GLdouble *m) +{ + fprintf (logFp, "glLoadMatrixd (%p)\n", m); + (*nativeRenderTable->LoadMatrixd) (m); +} + +static void +logLoadMatrixf (const GLfloat *m) +{ + fprintf (logFp, "glLoadMatrixf (%p)\n", m); + (*nativeRenderTable->LoadMatrixf) (m); +} + +static void +logLoadName (GLuint name) +{ + fprintf (logFp, "glLoadName (%d)\n", name); + (*nativeRenderTable->LoadName) (name); +} + +static void +logLogicOp (GLenum opcode) +{ + fprintf (logFp, "glLogicOp(0x%x)\n", opcode); + (*nativeRenderTable->LogicOp) (opcode); +} + +static void +logMap1d (GLenum target, + GLdouble u1, + GLdouble u2, + GLint stride, + GLint order, + const GLdouble *points) +{ + fprintf (logFp, "glMap1d (0x%x, %f, %f, %d, %d, %p)\n", + target, u1, u2, stride, order, points); + (*nativeRenderTable->Map1d) (target, u1, u2, stride, order, points); +} + +static void +logMap1f (GLenum target, + GLfloat u1, + GLfloat u2, + GLint stride, + GLint order, + const GLfloat *points) +{ + fprintf (logFp, "glMap1f (0x%x, %f, %f, %d, %d, %p)\n", + target, u1, u2, stride, order, points); + (*nativeRenderTable->Map1f) (target, u1, u2, stride, order, points); +} + +static void +logMap2d (GLenum target, + GLdouble u1, + GLdouble u2, + GLint ustride, + GLint uorder, + GLdouble v1, + GLdouble v2, + GLint vstride, + GLint vorder, + const GLdouble *points) +{ + fprintf (logFp, "glMap2d (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n", + target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + (*nativeRenderTable->Map2d) (target, u1, u2, ustride, uorder, v1, v2, + vstride, vorder, points); +} + +static void +logMap2f (GLenum target, + GLfloat u1, + GLfloat u2, + GLint ustride, + GLint uorder, + GLfloat v1, + GLfloat v2, + GLint vstride, + GLint vorder, + const GLfloat *points) +{ + fprintf (logFp, "glMap2f (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n", + target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + (*nativeRenderTable->Map2f) (target, u1, u2, ustride, uorder, v1, v2, + vstride, vorder, points); +} + +static void +logMapGrid1d (GLint un, + GLdouble u1, + GLdouble u2) +{ + fprintf (logFp, "glMapGrid1d (%d, %f, %f)\n", un, u1, u2); + (*nativeRenderTable->MapGrid1d) (un, u1, u2); +} + +static void +logMapGrid1f (GLint un, + GLfloat u1, + GLfloat u2) +{ + fprintf (logFp, "glMapGrid1f (%d, %f, %f)\n", un, u1, u2); + (*nativeRenderTable->MapGrid1f) (un, u1, u2); +} + +static void +logMapGrid2d (GLint un, + GLdouble u1, + GLdouble u2, + GLint vn, + GLdouble v1, + GLdouble v2) +{ + fprintf (logFp, "glMapGrid2d (%d, %f, %f, %d, %f, %f)\n", + un, u1, u2, vn, v1, v2); + (*nativeRenderTable->MapGrid2d) (un, u1, u2, vn, v1, v2); +} + +static void +logMapGrid2f (GLint un, + GLfloat u1, + GLfloat u2, + GLint vn, + GLfloat v1, + GLfloat v2) +{ + fprintf (logFp, "glMapGrid2f (%d, %f, %f, %d, %f, %f)\n", + un, u1, u2, vn, v1, v2); + (*nativeRenderTable->MapGrid2f) (un, u1, u2, vn, v1, v2); +} + +static void +logMaterialf (GLenum face, + GLenum pname, + GLfloat param) +{ + vCnt[materialfIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMaterialf (0x%x, 0x%x, %f)\n", face, pname, param); + (*nativeRenderTable->Materialf) (face, pname, param); +} + +static void +logMaterialfv (GLenum face, + GLenum pname, + const GLfloat *params) +{ + vCnt[materialfvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMaterialfv (0x%x, 0x%x, %p)\n", + face, pname, params); + (*nativeRenderTable->Materialfv) (face, pname, params); +} + +static void +logMateriali (GLenum face, + GLenum pname, + GLint param) +{ + vCnt[materialiIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMateriali (0x%x, 0x%x, %d)\n", face, pname, param); + (*nativeRenderTable->Materiali) (face, pname, param); +} + +static void +logMaterialiv (GLenum face, + GLenum pname, + const GLint *params) +{ + vCnt[materialivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMaterialiv (0x%x, 0x%x, %p)\n", + face, pname, params); + (*nativeRenderTable->Materialiv) (face, pname, params); +} + +static void +logMatrixMode (GLenum mode) +{ + fprintf (logFp, "glMatrixMode (0x%x)\n", mode); + (*nativeRenderTable->MatrixMode) (mode); +} + +static void +logMultMatrixd (const GLdouble *m) +{ + fprintf (logFp, "glMultMatrixd (%p)\n", m); + (*nativeRenderTable->MultMatrixd) (m); +} + +static void +logMultMatrixf (const GLfloat *m) +{ + fprintf (logFp, "glMultMatrixf (%p)\n", m); + (*nativeRenderTable->MultMatrixf) (m); +} + +static void +logNewList (GLuint list, + GLenum mode) +{ + fprintf (logFp, "glNewList (%d, 0x%x)\n", list, mode); + (*nativeRenderTable->NewList) (list, mode); +} + +static void +logNormal3bv (const GLbyte *v) +{ + vCnt[normal3bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3bv (%p)\n", v); + (*nativeRenderTable->Normal3bv) (v); +} + +static void +logNormal3dv (const GLdouble *v) +{ + vCnt[normal3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3dv (%p)\n", v); + (*nativeRenderTable->Normal3dv) (v); +} + +static void +logNormal3fv (const GLfloat *v) +{ + vCnt[normal3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3fv (%p)\n", v); + (*nativeRenderTable->Normal3fv) (v); +} + +static void +logNormal3iv (const GLint *v) +{ + vCnt[normal3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3iv (%p)\n", v); + (*nativeRenderTable->Normal3iv) (v); +} + +static void +logNormal3sv (const GLshort *v) +{ + vCnt[normal3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3sv (%p)\n", v); + (*nativeRenderTable->Normal3sv) (v); +} + +static void +logNormalPointer (GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glNormalPointer (0x%x, %d, %p)\n", type, stride, pointer); + (*nativeRenderTable->NormalPointer) (type, stride, pointer); +} + +static void +logOrtho (GLdouble left, + GLdouble right, + GLdouble bottom, + GLdouble top, + GLdouble zNear, + GLdouble zFar) +{ + fprintf (logFp, "glOrtho (%f, %f, %f, %f, %f, %f)\n", + left, right, bottom, top, zNear, zFar); + (*nativeRenderTable->Ortho) (left, right, bottom, top, zNear, zFar); +} + +static void +logPassThrough (GLfloat token) +{ + fprintf (logFp, "glPassThrough (%f)\n", token); + (*nativeRenderTable->PassThrough) (token); +} + +static void +logPixelMapfv (GLenum map, + GLsizei mapsize, + const GLfloat *values) +{ + fprintf (logFp, "glPixelMapfv (0x%x, %d, %p)\n", map, mapsize, values); + (*nativeRenderTable->PixelMapfv) (map, mapsize, values); +} + +static void +logPixelMapuiv (GLenum map, + GLsizei mapsize, + const GLuint *values) +{ + fprintf (logFp, "glPixelMapuiv (0x%x, %d, %p)\n", map, mapsize, values); + (*nativeRenderTable->PixelMapuiv) (map, mapsize, values); +} + +static void +logPixelMapusv (GLenum map, + GLsizei mapsize, + const GLushort *values) +{ + fprintf (logFp, "glPixelMapusv (0x%x, %d, %p)\n", map, mapsize, values); + (*nativeRenderTable->PixelMapusv) (map, mapsize, values); +} + +static void +logPixelStoref (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glPixelStoref (0x%x, %f)\n", pname, param); + (*nativeRenderTable->PixelStoref) (pname, param); +} + +static void +logPixelStorei (GLenum pname, + GLint param) +{ + fprintf (logFp, "glPixelStorei (0x%x, %d)\n", pname, param); + (*nativeRenderTable->PixelStorei) (pname, param); +} + +static void +logPixelTransferf (GLenum pname, GLfloat param) +{ + fprintf (logFp, "glPixelTransferf (0x%x, %f)\n", pname, param); + (*nativeRenderTable->PixelTransferf) (pname, param); +} + +static void +logPixelTransferi (GLenum pname, + GLint param) +{ + fprintf (logFp, "glPixelTransferi (0x%x, %d)\n", pname, param); + (*nativeRenderTable->PixelTransferi) (pname, param); +} + +static void +logPixelZoom (GLfloat xfactor, + GLfloat yfactor) +{ + fprintf (logFp, "glPixelZoom (%f, %f)\n", xfactor, yfactor); + (*nativeRenderTable->PixelZoom) (xfactor, yfactor); +} + +static void +logPointSize (GLfloat size) +{ + fprintf (logFp, "glPointSize" ); + (*nativeRenderTable->PointSize) (size); +} + +static void +logPolygonMode (GLenum face, + GLenum mode) +{ + fprintf (logFp, "glPolygonMode (0x%x, 0x%x)\n", face, mode ); + (*nativeRenderTable->PolygonMode) (face, mode); +} + +static void +logPolygonOffset (GLfloat factor, + GLfloat units) +{ + fprintf (logFp, "glPolygonOffset (%f, %f)\n", factor, units); + (*nativeRenderTable->PolygonOffset) (factor, units); +} + +static void +logPolygonStipple (const GLubyte *mask) +{ + fprintf (logFp, "glPolygonStipple (%p)\n", mask); + (*nativeRenderTable->PolygonStipple) (mask); +} + +static void +logPopAttrib (void) +{ + fprintf (logFp, "glPopAttrib ()\n"); + (*nativeRenderTable->PopAttrib) (); +} + +static void +logPopClientAttrib (void) +{ + fprintf (logFp, "glPopClientAttrib ()\n" ); + (*nativeRenderTable->PopClientAttrib) (); +} + +static void +logPopMatrix (void) +{ + fprintf (logFp, "glPopMatrix ()\n" ); + (*nativeRenderTable->PopMatrix) (); +} + +static void +logPopName (void) +{ + fprintf (logFp, "glPopName ()\n"); + (*nativeRenderTable->PopName) (); +} + +static void +logPrioritizeTextures (GLsizei n, + const GLuint *textures, + const GLclampf *priorities) +{ + fprintf (logFp, "glPrioritizeTextures (%d, %p, %p)\n", + n, textures, priorities); + (*nativeRenderTable->PrioritizeTextures) (n, textures, priorities); +} + +static void +logPushAttrib (GLbitfield mask) +{ + fprintf (logFp, "glPushAttrib (0x%x)\n", mask); + (*nativeRenderTable->PushAttrib) (mask); +} + +static void +logPushClientAttrib (GLbitfield mask) +{ + fprintf (logFp, "glPushClientAttrib (0x%x)\n", mask); + (*nativeRenderTable->PushClientAttrib) (mask); +} + +static void +logPushMatrix (void) +{ + fprintf (logFp, "glPushMatrix ()\n" ); + (*nativeRenderTable->PushMatrix) (); +} + +static void +logPushName (GLuint name) +{ + fprintf (logFp, "glPushName (%d)\n", name); + (*nativeRenderTable->PushName) (name); +} + +static void +logRasterPos2dv (const GLdouble *v) +{ + fprintf (logFp, "glRasterPos2dv (%p)\n", v); + (*nativeRenderTable->RasterPos2dv) (v); +} + +static void +logRasterPos2fv (const GLfloat *v) +{ + fprintf (logFp, "glRasterPos2dv (%p)\n", v); + (*nativeRenderTable->RasterPos2fv) (v); +} + +static void +logRasterPos2iv (const GLint *v) +{ + fprintf (logFp, "glRasterPos2iv (%p)\n", v); + (*nativeRenderTable->RasterPos2iv) (v); +} + +static void +logRasterPos2sv (const GLshort *v) +{ + fprintf (logFp, "glRasterPos2sv (%p)\n", v); + (*nativeRenderTable->RasterPos2sv) (v); +} + +static void +logRasterPos3dv (const GLdouble *v) +{ + fprintf (logFp, "glRasterPos3dv (%p)\n", v); + (*nativeRenderTable->RasterPos3dv) (v); +} + +static void +logRasterPos3fv (const GLfloat *v) +{ + fprintf (logFp, "glRasterPos3fv (%p)\n", v); + (*nativeRenderTable->RasterPos3fv) (v); +} + +static void +logRasterPos3iv (const GLint *v) +{ + fprintf (logFp, "glRasterPos3iv (%p)\n", v); + (*nativeRenderTable->RasterPos3iv) (v); +} + +static void +logRasterPos3sv (const GLshort *v) +{ + fprintf (logFp, "glRasterPos3sv (%p)\n", v); + (*nativeRenderTable->RasterPos3sv) (v); +} + +static void +logRasterPos4dv (const GLdouble *v) +{ + fprintf (logFp, "glRasterPos4dv (%p)\n", v); + (*nativeRenderTable->RasterPos4dv) (v); +} + +static void +logRasterPos4fv (const GLfloat *v) +{ + fprintf (logFp, "glRasterPos4fv (%p)\n", v); + (*nativeRenderTable->RasterPos4fv) (v); +} + +static void +logRasterPos4iv (const GLint *v) +{ + fprintf (logFp, "glRasterPos4iv (%p)\n", v); + (*nativeRenderTable->RasterPos4iv) (v); +} + +static void +logRasterPos4sv (const GLshort *v) +{ + fprintf (logFp, "glRasterPos4sv (%p)\n", v); + (*nativeRenderTable->RasterPos4sv) (v); +} + +static void +logReadBuffer (GLenum mode) +{ + fprintf (logFp, "glReadBuffer (0x%x)\n", mode); + (*nativeRenderTable->ReadBuffer) (mode); +} + +static void +logReadPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void *pixels) +{ + fprintf (logFp, "glReadPixels (%d, %d, %d, %d, 0x%x, 0x%x, %p)\n", + x, y, width, height, format, type, pixels); + (*nativeRenderTable->ReadPixels) (x, y, width, height, format, type, + pixels); +} + +static void +logRectdv (const GLdouble *v1, + const GLdouble *v2) +{ + fprintf (logFp, "glRectdv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectdv) (v1, v2); +} + +static void +logRectfv (const GLfloat *v1, + const GLfloat *v2) +{ + fprintf (logFp, "glRectfv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectfv) (v1, v2); +} + +static void +logRectiv (const GLint *v1, + const GLint *v2) +{ + fprintf (logFp, "glRectiv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectiv) (v1, v2); +} + +static void +logRectsv (const GLshort *v1, + const GLshort *v2) +{ + fprintf (logFp, "glRectsv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectsv) (v1, v2); +} + +static GLint +logRenderMode (GLenum mode) +{ + fprintf (logFp, "glRenderMode (0x%x)\n", mode); + return (*nativeRenderTable->RenderMode) (mode); +} + +static void +logRotated (GLdouble angle, + GLdouble x, + GLdouble y, + GLdouble z) +{ + fprintf (logFp, "glRotated (%f, %f, %f, %f)\n", angle, x, y, z); + (*nativeRenderTable->Rotated) (angle, x, y, z); +} + +static void +logRotatef (GLfloat angle, + GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glRotatef (%f, %f, %f, %f)\n", angle, x, y, z); + (*nativeRenderTable->Rotatef) (angle, x, y, z); +} + +static void +logScaled (GLdouble x, + GLdouble y, + GLdouble z) +{ + fprintf (logFp, "glScaled (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Scaled) (x, y, z); +} + +static void +logScalef (GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glScalef (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Scalef) (x, y, z); +} + +static void +logScissor (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glScissor (%d, %d, %d, %d)\n", x, y, width, height); + (*nativeRenderTable->Scissor) (x, y, width, height); +} + +static void +logSelectBuffer (GLsizei size, + GLuint *buffer) +{ + fprintf (logFp, "glSelectBuffer (%d, %p)\n", size, buffer); + (*nativeRenderTable->SelectBuffer) (size, buffer); +} + +static void +logShadeModel (GLenum mode) +{ + fprintf (logFp, "glShadeModel (0x%x)\n", mode); + (*nativeRenderTable->ShadeModel) (mode); +} + +static void +logStencilFunc (GLenum func, + GLint ref, + GLuint mask) +{ + fprintf (logFp, "glStencilFunc (0x%x, %d, %d)\n", func, ref, mask); + (*nativeRenderTable->StencilFunc) (func, ref, mask); +} + +static void +logStencilMask (GLuint mask) +{ + fprintf (logFp, "glStencilMask (0x%x)\n", mask); + (*nativeRenderTable->StencilMask) (mask); +} + +static void +logStencilOp (GLenum fail, + GLenum zfail, + GLenum zpass) +{ + fprintf (logFp, "glStencilOp (0x%x, 0x%x, 0x%x)\n", fail, zfail, zpass); + (*nativeRenderTable->StencilOp) (fail, zfail, zpass); +} + +static void +logTexCoord1dv (const GLdouble *v) +{ + vCnt[texCoord1dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1dv (%p)\n", v); + (*nativeRenderTable->TexCoord1dv) (v); +} + +static void +logTexCoord1fv (const GLfloat *v) +{ + vCnt[texCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1fv (%p)\n", v); + (*nativeRenderTable->TexCoord1fv) (v); +} + +static void +logTexCoord1iv (const GLint *v) +{ + vCnt[texCoord1ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1iv (%p)\n", v); + (*nativeRenderTable->TexCoord1iv) (v); +} + +static void +logTexCoord1sv (const GLshort *v) +{ + vCnt[texCoord1svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1sv (%p)\n", v); + (*nativeRenderTable->TexCoord1sv) (v); +} + +static void +logTexCoord2dv (const GLdouble *v) +{ + vCnt[texCoord2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2dv (%p)\n", v); + (*nativeRenderTable->TexCoord2dv) (v); +} + +static void +logTexCoord2fv (const GLfloat *v) +{ + vCnt[texCoord2fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2fv (%p)\n", v); + (*nativeRenderTable->TexCoord2fv) (v); +} + +static void +logTexCoord2iv (const GLint *v) +{ + vCnt[texCoord2ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2iv (%p)\n", v); + (*nativeRenderTable->TexCoord2iv) (v); +} + +static void +logTexCoord2sv (const GLshort *v) +{ + vCnt[texCoord2svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2sv (%p)\n", v); + (*nativeRenderTable->TexCoord2sv) (v); +} + + +static void +logTexCoord3dv (const GLdouble *v) +{ + vCnt[texCoord3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3dv (%p)\n", v); + (*nativeRenderTable->TexCoord3dv) (v); +} + +static void +logTexCoord3fv (const GLfloat *v) +{ + vCnt[texCoord3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3fv (%p)\n", v); + (*nativeRenderTable->TexCoord3fv) (v); +} + +static void +logTexCoord3iv (const GLint *v) +{ + vCnt[texCoord3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3iv (%p)\n", v); + (*nativeRenderTable->TexCoord3iv) (v); +} + +static void +logTexCoord3sv (const GLshort *v) +{ + vCnt[texCoord3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3sv (%p)\n", v); + (*nativeRenderTable->TexCoord3sv) (v); +} + +static void +logTexCoord4dv (const GLdouble *v) +{ + vCnt[texCoord4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4dv (%p)\n", v); + (*nativeRenderTable->TexCoord4dv) (v); +} + +static void +logTexCoord4fv (const GLfloat *v) +{ + vCnt[texCoord4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4fv (%p)\n", v); + (*nativeRenderTable->TexCoord4fv) (v); +} + +static void +logTexCoord4iv (const GLint *v) +{ + vCnt[texCoord4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4iv (%p)\n", v); + (*nativeRenderTable->TexCoord4iv) (v); +} + +static void +logTexCoord4sv (const GLshort *v) +{ + vCnt[texCoord4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4sv (%p)\n", v); + (*nativeRenderTable->TexCoord4sv) (v); +} + +static void +logTexCoordPointer (GLint size, + GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glTexCoordPointer (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->TexCoordPointer) (size, type, stride, pointer); +} + +static void +logTexEnvf (GLenum target, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glTexEnvf (0x%x, 0x%x, %f)\n", target, pname, param); + (*nativeRenderTable->TexEnvf) (target, pname, param); +} + +static void +logTexEnvfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->TexEnvfv) (target, pname, params); +} + +static void +logTexEnvi (GLenum target, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glTexEnvi (0x%x, 0x%x, %d)\n", target, pname, param); + (*nativeRenderTable->TexEnvi) (target, pname, param); +} + +static void +logTexEnviv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->TexEnviv) (target, pname, params); +} + +static void +logTexGend (GLenum coord, + GLenum pname, + GLdouble param) +{ + fprintf (logFp, "glTexGend (0x%x, 0x%x, %f)\n", coord, pname, param); + (*nativeRenderTable->TexGend) (coord, pname, param); +} + +static void +logTexGendv (GLenum coord, + GLenum pname, + const GLdouble *params) +{ + fprintf (logFp, "glTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->TexGendv) (coord, pname, params); +} + +static void +logTexGenf (GLenum coord, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glTexGenf (0x%x, 0x%x, %f)\n", coord, pname, param); + (*nativeRenderTable->TexGenf) (coord, pname, param); +} + +static void +logTexGenfv (GLenum coord, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->TexGenfv) (coord, pname, params); +} + +static void +logTexGeni (GLenum coord, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glTexGeni (0x%x, 0x%x, %d)\n", coord, pname, param); + (*nativeRenderTable->TexGeni) (coord, pname, param); +} + +static void +logTexGeniv (GLenum coord, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->TexGeniv) (coord, pname, params); +} + +static void +logTexImage1D (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLint border, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexImage1D (0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p)\n", + target, level, internalformat, width, border, format, type, + pixels); + (*nativeRenderTable->TexImage1D) (target, level, internalformat, + width, border, format, type, + pixels); +} + +static void +logTexImage2D (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexImage2D (0x%x, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, internalformat, + width, height, border, format, type, pixels); + (*nativeRenderTable->TexImage2D) (target, level, internalformat, + width, height, border, format, type, + pixels); +} + +static void +logTexParameterf (GLenum target, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glTexParameterf (0x%x, 0x%x, %f)\n", + target, pname, param); + (*nativeRenderTable->TexParameterf) (target, pname, param); +} + +static void +logTexParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glTexParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->TexParameterfv) (target, pname, params); +} + +static void +logTexParameteri (GLenum target, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glTexParameteri (0x%x, 0x%x, 0x%x)\n", + target, pname, param); + (*nativeRenderTable->TexParameteri) (target, pname, param); +} + +static void +logTexParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glTexParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->TexParameteriv) (target, pname, params); +} + +static void +logTexSubImage1D (GLenum target, + GLint level, + GLint xoffset, + GLsizei width, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexSubImage1D (0x%x, %d, %d, %d, 0x%x, 0x%x, %p)\n", + target, level, xoffset, width, format, type, pixels); + (*nativeRenderTable->TexSubImage1D) (target, level, xoffset, width, + format, type, pixels); +} + +static void +logTexSubImage2D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexSubImage2D (0x%x, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset, + width, height, format, type, pixels); + (*nativeRenderTable->TexSubImage2D) (target, level, xoffset, yoffset, + width, height, format, type, + pixels); +} + +static void +logTranslated (GLdouble x, + GLdouble y, + GLdouble z) +{ + fprintf (logFp, "glTranslated (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Translated) (x, y, z); +} + +static void +logTranslatef (GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glTranslatef (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Translatef) (x, y, z); +} + +static void +logVertex2dv (const GLdouble *v) +{ + vCnt[vertex2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2dv (%p)\n", v); + (*nativeRenderTable->Vertex2dv) (v); +} + +static void +logVertex2fv (const GLfloat *v) +{ + vCnt[vertex2fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2dv (%p)\n", v); + (*nativeRenderTable->Vertex2fv) (v); +} + +static void +logVertex2iv (const GLint *v) +{ + vCnt[vertex2ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2iv (%p)\n", v); + (*nativeRenderTable->Vertex2iv) (v); +} + +static void +logVertex2sv (const GLshort *v) +{ + vCnt[vertex2svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2sv (%p)\n", v); + (*nativeRenderTable->Vertex2sv) (v); +} + +static void +logVertex3dv (const GLdouble *v) +{ + vCnt[vertex3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3dv (%p)\n", v); + (*nativeRenderTable->Vertex3dv) (v); +} + +static void +logVertex3fv (const GLfloat *v) +{ + vCnt[vertex3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3fv (%p)\n", v); + (*nativeRenderTable->Vertex3fv) (v); +} + +static void +logVertex3iv (const GLint *v) +{ + vCnt[vertex3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3iv (%p)\n", v); + (*nativeRenderTable->Vertex3iv) (v); +} + +static void +logVertex3sv (const GLshort *v) +{ + vCnt[vertex3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3sv (%p)\n", v); + (*nativeRenderTable->Vertex3sv) (v); +} + +static void +logVertex4dv (const GLdouble *v) +{ + vCnt[vertex4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4dv (%p)\n", v); + (*nativeRenderTable->Vertex4dv) (v); +} + +static void +logVertex4fv (const GLfloat *v) +{ + vCnt[vertex4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4fv (%p)\n", v); + (*nativeRenderTable->Vertex4fv) (v); +} + +static void +logVertex4iv (const GLint *v) +{ + vCnt[vertex4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4iv (%p)\n", v); + (*nativeRenderTable->Vertex4iv) (v); +} + +static void +logVertex4sv (const GLshort *v) +{ + vCnt[vertex4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4sv (%p)\n", v); + (*nativeRenderTable->Vertex4sv) (v); +} + +static void +logVertexPointer (GLint size, + GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glVertexPointer (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->VertexPointer) (size, type, stride, pointer); +} + +static void +logViewport (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glViewport (%d %d %d %d)\n", x, y, width, height); + (*nativeRenderTable->Viewport) (x, y, width, height); +} + +static void +logBlendColor (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) +{ + fprintf (logFp, "glBlendColor (%f, %f, %f, %f)\n", + red, green, blue, alpha); + (*nativeRenderTable->BlendColor) (red, green, blue, alpha); +} + +static void +logBlendEquation (GLenum mode) +{ + fprintf (logFp, "glBlendEquation (0x%x)\n", mode); + (*nativeRenderTable->BlendEquation) (mode); +} + +static void +logColorTable (GLenum target, + GLenum internalformat, + GLsizei width, + GLenum format, + GLenum type, + const GLvoid *table) +{ + fprintf (logFp, "glColorTable (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n", + target, internalformat, width, format, type, table); + (*nativeRenderTable->ColorTable) (target, internalformat, width, + format, type, table); +} + +static void +logColorTableParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ColorTableParameterfv) (target, pname, params); +} + +static void +logColorTableParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ColorTableParameteriv) (target, pname, params); +} + +static void +logCopyColorTable (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyColorTable (0x%x, 0x%x, %d, %d, %d)\n", + target, internalformat, x, y, width); + (*nativeRenderTable->CopyColorTable) (target, internalformat, + x, y, width); +} + +static void +logGetColorTable (GLenum target, + GLenum format, + GLenum type, + GLvoid *table) +{ + fprintf (logFp, "glGetColorTable (0x%x, 0x%x, 0x%x, %p)\n", + target, format, type, table); + (*nativeRenderTable->GetColorTable) (target, format, type, table); +} + +static void +logGetColorTableParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetColorTableParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetColorTableParameterfv) (target, pname, params); +} + +static void +logGetColorTableParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetColorTableParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetColorTableParameteriv) (target, pname, params); +} + +static void +logColorSubTable (GLenum target, + GLsizei start, + GLsizei count, + GLenum format, + GLenum type, + const GLvoid *data) +{ + fprintf (logFp, "glColorSubTable (0x%x, %d, %d, 0x%x, 0x%x, %p)\n", + target, start, count, format, type, data); + (*nativeRenderTable->ColorSubTable) (target, start, count, + format, type, data); +} + +static void +logCopyColorSubTable (GLenum target, + GLsizei start, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyColorSubTable (0x%x, %d, %d, %d, %d)\n", + target, start, x, y, width); + (*nativeRenderTable->CopyColorSubTable) (target, start, x, y, width); +} + +static void +logConvolutionFilter1D (GLenum target, + GLenum internalformat, + GLsizei width, + GLenum format, + GLenum type, + const GLvoid *image) +{ + fprintf (logFp, "glConvolutionFilter1D (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n", + target, internalformat, width, format, type, image); + (*nativeRenderTable->ConvolutionFilter1D) (target, internalformat, + width, format, type, image); +} + +static void +logConvolutionFilter2D (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *image) +{ + fprintf (logFp, "glConvolutionFilter2D (0x%x, 0x%x, %d, %d, " + "0x%x, 0x%x, %p)\n", target, internalformat, width, height, + format, type, image); + (*nativeRenderTable->ConvolutionFilter2D) (target, internalformat, + width, height, format, + type, image); +} + +static void +logConvolutionParameterf (GLenum target, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %f)\n", + target, pname, param); + (*nativeRenderTable->ConvolutionParameterf) (target, pname, param); +} + +static void +logConvolutionParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glConvolutionParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ConvolutionParameterfv) (target, pname, params); +} + +static void +logConvolutionParameteri (GLenum target, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %d)\n", + target, pname, param); + (*nativeRenderTable->ConvolutionParameteri) (target, pname, param); +} + +static void +logConvolutionParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glConvolutionParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ConvolutionParameteriv) (target, pname, params); +} + +static void +logCopyConvolutionFilter1D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyConvolutionFilter1D (0x%x, 0x%x, %d, %d, %d)\n", + target, internalformat, x, y, width); + (*nativeRenderTable->CopyConvolutionFilter1D) (target, internalformat, + x, y, width); +} + +static void +logCopyConvolutionFilter2D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glCopyConvolutionFilter2D (0x%x, 0x%x, %d, %d, %d, %d)\n", + target, internalformat, x, y, width, height); + (*nativeRenderTable->CopyConvolutionFilter2D) (target, internalformat, + x, y, width, height); +} + +static void +logGetConvolutionFilter (GLenum target, + GLenum format, + GLenum type, + GLvoid *image) +{ + fprintf (logFp, "glGetConvolutionFilter (0x%x, 0x%x, 0x%x, %p)\n", + target, format, type, image); + (*nativeRenderTable->GetConvolutionFilter) (target, format, type, + image); +} + +static void +logGetConvolutionParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetConvolutionParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetConvolutionParameterfv) (target, pname, + params); +} + +static void +logGetConvolutionParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetConvolutionParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetConvolutionParameteriv) (target, pname, + params); +} + +static void +logGetSeparableFilter (GLenum target, + GLenum format, + GLenum type, + GLvoid *row, + GLvoid *column, + GLvoid *span) +{ + fprintf (logFp, "glGetSeparableFilter (0x%x, 0x%x, 0x%x, %p, %p, %p)\n", + target, format, type, row, column, span); + (*nativeRenderTable->GetSeparableFilter) (target, format, type, + row, column, span); +} + +static void +logSeparableFilter2D (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *row, + const GLvoid *column) +{ + fprintf (logFp, "glSeparableFilter2D (0x%x, 0x%x, %d, %d, " + "0x%x, 0x%x, %p, %p)\n", target, internalformat, width, height, + format, type, row, column); + (*nativeRenderTable->SeparableFilter2D) (target, internalformat, + width, height, format, + type, row, column); +} + +static void +logGetHistogram (GLenum target, + GLboolean reset, + GLenum format, + GLenum type, + GLvoid *values) +{ + fprintf (logFp, "glGetHistogram (0x%x, %d, 0x%x, 0x%x, %p)\n", + target, reset, format, type, values); + (*nativeRenderTable->GetHistogram) (target, reset, format, type, + values); +} + +static void +logGetHistogramParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetHistogramParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetHistogramParameterfv) (target, pname, params); +} + +static void +logGetHistogramParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetHistogramParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetHistogramParameteriv) (target, pname, params); +} + +static void +logGetMinmax (GLenum target, + GLboolean reset, + GLenum format, + GLenum type, + GLvoid *values) +{ + fprintf (logFp, "glGetMinmax (0x%x, %d, 0x%x, 0x%x, %p)\n", + target, reset, format, type, values); + (*nativeRenderTable->GetMinmax) (target, reset, format, type, values); +} + +static void +logGetMinmaxParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "GetMinmaxParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetMinmaxParameterfv) (target, pname, params); +} + +static void +logGetMinmaxParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "GetMinmaxParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetMinmaxParameteriv) (target, pname, params); +} + +static void +logHistogram (GLenum target, + GLsizei width, + GLenum internalformat, + GLboolean sink) +{ + fprintf (logFp, "glHistogram (0x%x, %d, 0x%x, %d)\n", + target, width, internalformat, sink); + (*nativeRenderTable->Histogram) (target, width, internalformat, sink); +} + +static void +logMinmax (GLenum target, + GLenum internalformat, + GLboolean sink) +{ + fprintf (logFp, "glMinmax (0x%x, 0x%x, %d)\n", + target, internalformat, sink); + (*nativeRenderTable->Minmax) (target, internalformat, sink); +} + +static void +logResetHistogram (GLenum target) +{ + fprintf (logFp, "glResetHistogram (0x%x)\n", target); + (*nativeRenderTable->ResetHistogram) (target); +} + +static void +logResetMinmax (GLenum target) +{ + fprintf (logFp, "glResetMinmax (0x%x)\n", target); + (*nativeRenderTable->ResetMinmax) (target); +} + +static void +logCopyTexSubImage3D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glCopyTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, " + "%d, %d)\n", target, level, xoffset, yoffset, zoffset, + x, y, width, height); + (*nativeRenderTable->CopyTexSubImage3D) (target, level, + xoffset, yoffset, zoffset, + x, y, width, height); +} + +static void +logTexImage3D (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + const GLvoid *pixels) +{ + fprintf (logFp, "glTexImage3D (0x%x, %d, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, internalformat, + width, height, depth, border, format, type, pixels); + (*nativeRenderTable->TexImage3D) (target, level, internalformat, + width, height, depth, border, + format, type, pixels); +} + +static void +logTexSubImage3D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type, + const GLvoid *pixels) +{ + fprintf (logFp, "glTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type, pixels); + (*nativeRenderTable->TexSubImage3D) (target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels); +} + +/* GL_ARB_multitexture */ + +static void +logActiveTextureARB (GLenum texture) +{ + fprintf (logFp, "glActiveTextureARB (0x%x)\n", texture); + (*nativeRenderTable->ActiveTextureARB) (texture); +} + +static void +logClientActiveTextureARB (GLenum texture) +{ + fprintf (logFp, "glClientActiveTextureARB (0x%x)\n", texture); + (*nativeRenderTable->ClientActiveTextureARB) (texture); +} + +static void +logMultiTexCoord1dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord1dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1dvARB) (target, v); +} + +static void +logMultiTexCoord1fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1fvARB) (target, v); +} + +static void +logMultiTexCoord1ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord1ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1ivARB) (target, v); +} + +static void +logMultiTexCoord1svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord1svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1svARB) (target, v); +} + +static void +logMultiTexCoord2dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2dvARB) (target, v); +} + +static void +logMultiTexCoord2fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord2fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2fvARB) (target, v); +} + +static void +logMultiTexCoord2ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord2ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2ivARB) (target, v); +} + +static void +logMultiTexCoord2svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord2svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2svARB) (target, v); +} + +static void +logMultiTexCoord3dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3dvARB) (target, v); +} + +static void +logMultiTexCoord3fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3fvARB) (target, v); +} + +static void +logMultiTexCoord3ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3ivARB) (target, v); +} + +static void +logMultiTexCoord3svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3svARB) (target, v); +} + +static void +logMultiTexCoord4dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4dvARB) (target, v); +} + +static void +logMultiTexCoord4fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4fvARB) (target, v); +} + +static void +logMultiTexCoord4ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4ivARB) (target, v); +} + +static void +logMultiTexCoord4svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4svARB) (target, v); +} + + +/* GL_ARB_multisample */ + +static void +logSampleCoverageARB (GLclampf value, + GLboolean invert) +{ + fprintf (logFp, "glSampleCoverageARB (%f, %d)\n", value, invert); + (*nativeRenderTable->SampleCoverageARB) (value, invert); +} + + +/* GL_EXT_texture_object */ + +static GLboolean +logAreTexturesResidentEXT (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + fprintf (logFp, "glAreTexturesResidentEXT (%d, %p, %p)\n", + n, textures, residences); + return (*nativeRenderTable->AreTexturesResidentEXT) (n, textures, + residences); +} +static void +logGenTexturesEXT (GLsizei n, + GLuint *textures) +{ + fprintf (logFp, "glGenTexturesEXT (%d, %p)\n", n, textures); + (*nativeRenderTable->GenTexturesEXT) (n, textures); +} + +static GLboolean +logIsTextureEXT (GLuint texture) +{ + fprintf (logFp, "glIsTextureEXT (%d)\n", texture); + return (*nativeRenderTable->IsTextureEXT) (texture); +} + + +/* GL_SGIS_multisample */ + +static void +logSampleMaskSGIS (GLclampf value, + GLboolean invert) +{ + fprintf (logFp, "glSampleMaskSGIS (%f, %d)\n", value, invert); + (*nativeRenderTable->SampleMaskSGIS) (value, invert); +} + +static void +logSamplePatternSGIS (GLenum pattern) +{ + fprintf (logFp, "glSamplePatternSGIS (0x%x)\n", pattern); + (*nativeRenderTable->SamplePatternSGIS) (pattern); +} + + +/* GL_EXT_point_parameters */ + +static void +logPointParameterfEXT (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glPointParameterfEXT (0x%x, %f)\n", pname, param); + (*nativeRenderTable->PointParameterfEXT) (pname, param); +} + +static void +logPointParameterfvEXT (GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glPointParameterfvEXT (0x%x, %p)\n", pname, params); + (*nativeRenderTable->PointParameterfvEXT) (pname, params); +} + + +/* GL_MESA_window_pos */ + +static void +logWindowPos3fMESA (GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glWindowPos3fMESA (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->WindowPos3fMESA) (x, y, z); +} + + +/* GL_EXT_blend_func_separate */ + +static void +logBlendFuncSeparateEXT (GLenum sfactorRGB, + GLenum dfactorRGB, + GLenum sfactorAlpha, + GLenum dfactorAlpha) +{ + fprintf (logFp, "glBlendFuncSeparateEXT (0x%x, 0x%x, 0x%x, 0x%x)\n", + sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); + (*nativeRenderTable->BlendFuncSeparateEXT) (sfactorRGB, + dfactorRGB, + sfactorAlpha, + dfactorAlpha); +} + + +/* GL_EXT_fog_coord */ + +static void +logFogCoordfvEXT (const GLfloat *coord) +{ + vCnt[fogCoordfvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glFogCoordfvEXT (%p)\n", coord); + (*nativeRenderTable->FogCoordfvEXT) (coord); +} + +static void +logFogCoorddvEXT (const GLdouble *coord) +{ + vCnt[fogCoorddvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glFogCoorddvEXT (%p)\n", coord); + (*nativeRenderTable->FogCoorddvEXT) (coord); +} + +static void +logFogCoordPointerEXT (GLenum type, + GLsizei stride, + const GLvoid *pointer) +{ + fprintf (logFp, "glFogCoordPointerEXT (0x%x, %d, %p)\n", + type, stride, pointer); + (*nativeRenderTable->FogCoordPointerEXT) (type, stride, pointer); +} + + +/* GL_EXT_secondary_color */ + +static void +logSecondaryColor3bvEXT (const GLbyte *v) +{ + vCnt[secondaryColor3bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3bvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3bvEXT) (v); +} + +static void +logSecondaryColor3dvEXT (const GLdouble *v) +{ + vCnt[secondaryColor3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3dvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3dvEXT) (v); +} + +static void +logSecondaryColor3fvEXT (const GLfloat *v) +{ + vCnt[secondaryColor3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3fvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3fvEXT) (v); +} + +static void +logSecondaryColor3ivEXT (const GLint *v) +{ + vCnt[secondaryColor3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3ivEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3ivEXT) (v); +} + +static void +logSecondaryColor3svEXT (const GLshort *v) +{ + vCnt[secondaryColor3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3svEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3svEXT) (v); +} + +static void +logSecondaryColor3ubvEXT (const GLubyte *v) +{ + vCnt[secondaryColor3ubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3ubvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3ubvEXT) (v); +} + +static void +logSecondaryColor3uivEXT (const GLuint *v) +{ + vCnt[secondaryColor3uivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3uivEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3uivEXT) (v); +} + +static void +logSecondaryColor3usvEXT (const GLushort *v) +{ + vCnt[secondaryColor3usvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3usvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3usvEXT) (v); +} + +static void +logSecondaryColorPointerEXT (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer) +{ + fprintf (logFp, "glSecondaryColorPointerEXT (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->SecondaryColorPointerEXT) (size, type, + stride, pointer); +} + + +/* GL_NV_point_sprite */ + +static void +logPointParameteriNV (GLenum pname, + GLint param) +{ + fprintf (logFp, "glPointParameteriNV (0x%x, %d)\n", pname, param); + (*nativeRenderTable->PointParameteriNV) (pname, param); +} + +static void +logPointParameterivNV (GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glPointParameterivNV (0x%x, %p)\n", pname, params); + (*nativeRenderTable->PointParameterivNV) (pname, params); +} + + +/* GL_EXT_stencil_two_side */ + +static void +logActiveStencilFaceEXT (GLenum face) +{ + fprintf (logFp, "glActiveStencilFaceEXT (0x%x)\n", face); + (*nativeRenderTable->ActiveStencilFaceEXT) (face); +} + + +/* GL_EXT_framebuffer_object */ + +static GLboolean +logIsRenderbufferEXT (GLuint renderbuffer) +{ + fprintf (logFp, "glIsRenderbufferEXT (%d)\n", renderbuffer); + return (*nativeRenderTable->IsRenderbufferEXT) (renderbuffer); +} + +static void +logBindRenderbufferEXT (GLenum target, + GLuint renderbuffer) +{ + fprintf (logFp, "glBindRenderbufferEXT (0x%x, %d)\n", + target, renderbuffer); + (*nativeRenderTable->BindRenderbufferEXT) (target, renderbuffer); +} + +static void +logDeleteRenderbuffersEXT (GLsizei n, + const GLuint *renderbuffers) +{ + fprintf (logFp, "glDeleteRenderbuffersEXT (%d, %p)\n", n, renderbuffers); + (*nativeRenderTable->DeleteRenderbuffersEXT) (n, renderbuffers); +} + +static void +logGenRenderbuffersEXT (GLsizei n, + GLuint *renderbuffers) +{ + fprintf (logFp, "glGenRenderbuffersEXT (%d, %p)\n", n, renderbuffers); + (*nativeRenderTable->GenRenderbuffersEXT) (n, renderbuffers); +} + +static void +logRenderbufferStorageEXT (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glRenderbufferStorageEXT (0x%x, 0x%x, %d, %d)\n", + target, internalformat, width, height); + (*nativeRenderTable->RenderbufferStorageEXT) (target, + internalformat, + width, height); +} + +static void +logGetRenderbufferParameterivEXT (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetRenderbufferParameterivEXT (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetRenderbufferParameterivEXT) (target, + pname, + params); +} + +static GLboolean +logIsFramebufferEXT (GLuint framebuffer) +{ + fprintf (logFp, "glIsFramebufferEXT (%d)\n", framebuffer); + return (*nativeRenderTable->IsFramebufferEXT) (framebuffer); +} + +static void +logBindFramebufferEXT (GLenum target, + GLuint framebuffer) +{ + fprintf (logFp, "glBindFramebufferEXT (0x%x, %d)\n", target, framebuffer); + (*nativeRenderTable->BindFramebufferEXT) (target, framebuffer); +} + +static void +logDeleteFramebuffersEXT (GLsizei n, + const GLuint *framebuffers) +{ + fprintf (logFp, "glDeleteFramebuffersEXT (%d, %p)\n", n, framebuffers); + (*nativeRenderTable->DeleteFramebuffersEXT) (n, framebuffers); +} + +static void +logGenFramebuffersEXT (GLsizei n, + GLuint *framebuffers) +{ + fprintf (logFp, "glGenFramebuffersEXT (%d, %p)\n", n, framebuffers); + (*nativeRenderTable->GenFramebuffersEXT) (n, framebuffers); +} + +static GLenum +logCheckFramebufferStatusEXT (GLenum target) +{ + fprintf (logFp, "glCheckFramebufferStatusEXT (0x%x)\n", target); + return (*nativeRenderTable->CheckFramebufferStatusEXT) (target); +} + +static void +logFramebufferTexture1DEXT (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) +{ + fprintf (logFp, "glFramebufferTexture1DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n", + target, attachment, textarget, texture, level); + (*nativeRenderTable->FramebufferTexture1DEXT) (target, attachment, + textarget, texture, + level); +} + +static void +logFramebufferTexture2DEXT (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) +{ + fprintf (logFp, "glFramebufferTexture2DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n", + target, attachment, textarget, texture, level); + (*nativeRenderTable->FramebufferTexture2DEXT) (target, attachment, + textarget, texture, + level); +} + +static void +logFramebufferTexture3DEXT (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLint zoffset) +{ + fprintf (logFp, "glFramebufferTexture3DEXT (0x%x, 0x%x, 0x%x, " + "%d, %d, %d)\n", target, attachment, textarget, texture, + level, zoffset); + (*nativeRenderTable->FramebufferTexture3DEXT) (target, attachment, + textarget, texture, + level, zoffset); +} + +static void +logFramebufferRenderbufferEXT (GLenum target, + GLenum attachment, + GLenum buffertarget, + GLuint renderbuffer) +{ + fprintf (logFp, "glFramebufferRenderbufferEXT (0x%x, 0x%x, 0x%x, %d)\n", + target, attachment, buffertarget, renderbuffer); + (*nativeRenderTable->FramebufferRenderbufferEXT) (target, + attachment, + buffertarget, + renderbuffer); +} + +static void +logGetFramebufferAttachmentParameterivEXT (GLenum target, + GLenum attach, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetFramebufferAttachmentParameterivEXT (0x%x, " + "0x%x, 0x%x, %p)\n", target, attach, pname, params); + (*nativeRenderTable->GetFramebufferAttachmentParameterivEXT) (target, + attach, + pname, + params); +} + +static void +logGenerateMipmapEXT (GLenum target) +{ + fprintf (logFp, "glGenerateMipmapEXT (0x%x)\n", target); + (*nativeRenderTable->GenerateMipmapEXT) (target); +} + +static struct _glapi_table __logRenderTable = { + logNewList, + logEndList, + logCallList, + logCallLists, + logDeleteLists, + logGenLists, + logListBase, + logBegin, + logBitmap, + 0, /* glColor3b */ + logColor3bv, + 0, /* glColor3d */ + logColor3dv, + 0, /* glColor3f */ + logColor3fv, + 0, /* glColor3i */ + logColor3iv, + 0, /* glColor3s */ + logColor3sv, + 0, /* glColor3ub */ + logColor3ubv, + 0, /* glColor3ui */ + logColor3uiv, + 0, /* glColor3us */ + logColor3usv, + 0, /* glColor4b */ + logColor4bv, + 0, /* glColor4d */ + logColor4dv, + 0, /* glColor4f */ + logColor4fv, + 0, /* glColor4i */ + logColor4iv, + 0, /* glColor4s */ + logColor4sv, + 0, /* glColor4ub */ + logColor4ubv, + 0, /* glColor4ui */ + logColor4uiv, + 0, /* glColor4us */ + logColor4usv, + 0, /* glEdgeFlag */ + logEdgeFlagv, + logEnd, + 0, /* glIndexd */ + logIndexdv, + 0, /* glIndexf */ + logIndexfv, + 0, /* glIndexi */ + logIndexiv, + 0, /* glIndexs */ + logIndexsv, + 0, /* glNormal3b */ + logNormal3bv, + 0, /* glNormal3d */ + logNormal3dv, + 0, /* glNormal3f */ + logNormal3fv, + 0, /* glNormal3i */ + logNormal3iv, + 0, /* glNormal3s */ + logNormal3sv, + 0, /* glRasterPos2d */ + logRasterPos2dv, + 0, /* glRasterPos2f */ + logRasterPos2fv, + 0, /* glRasterPos2i */ + logRasterPos2iv, + 0, /* glRasterPos2s */ + logRasterPos2sv, + 0, /* glRasterPos3d */ + logRasterPos3dv, + 0, /* glRasterPos3f */ + logRasterPos3fv, + 0, /* glRasterPos3i */ + logRasterPos3iv, + 0, /* glRasterPos3s */ + logRasterPos3sv, + 0, /* glRasterPos4d */ + logRasterPos4dv, + 0, /* glRasterPos4f */ + logRasterPos4fv, + 0, /* glRasterPos4i */ + logRasterPos4iv, + 0, /* glRasterPos4s */ + logRasterPos4sv, + 0, /* glRectd */ + logRectdv, + 0, /* glRectf */ + logRectfv, + 0, /* glRecti */ + logRectiv, + 0, /* glRects */ + logRectsv, + 0, /* glTexCoord1d */ + logTexCoord1dv, + 0, /* glTexCoord1f */ + logTexCoord1fv, + 0, /* glTexCoord1i */ + logTexCoord1iv, + 0, /* glTexCoord1s */ + logTexCoord1sv, + 0, /* glTexCoord2d */ + logTexCoord2dv, + 0, /* glTexCoord2f */ + logTexCoord2fv, + 0, /* glTexCoord2i */ + logTexCoord2iv, + 0, /* glTexCoord2s */ + logTexCoord2sv, + 0, /* glTexCoord3d */ + logTexCoord3dv, + 0, /* glTexCoord3f */ + logTexCoord3fv, + 0, /* glTexCoord3i */ + logTexCoord3iv, + 0, /* glTexCoord3s */ + logTexCoord3sv, + 0, /* glTexCoord4d */ + logTexCoord4dv, + 0, /* glTexCoord4f */ + logTexCoord4fv, + 0, /* glTexCoord4i */ + logTexCoord4iv, + 0, /* glTexCoord4s */ + logTexCoord4sv, + 0, /* glVertex2d */ + logVertex2dv, + 0, /* glVertex2f */ + logVertex2fv, + 0, /* glVertex2i */ + logVertex2iv, + 0, /* glVertex2s */ + logVertex2sv, + 0, /* glVertex3d */ + logVertex3dv, + 0, /* glVertex3f */ + logVertex3fv, + 0, /* glVertex3i */ + logVertex3iv, + 0, /* glVertex3s */ + logVertex3sv, + 0, /* glVertex4d */ + logVertex4dv, + 0, /* glVertex4f */ + logVertex4fv, + 0, /* glVertex4i */ + logVertex4iv, + 0, /* glVertex4s */ + logVertex4sv, + logClipPlane, + logColorMaterial, + logCullFace, + logFogf, + logFogfv, + logFogi, + logFogiv, + logFrontFace, + logHint, + logLightf, + logLightfv, + logLighti, + logLightiv, + logLightModelf, + logLightModelfv, + logLightModeli, + logLightModeliv, + logLineStipple, + logLineWidth, + logMaterialf, + logMaterialfv, + logMateriali, + logMaterialiv, + logPointSize, + logPolygonMode, + logPolygonStipple, + logScissor, + logShadeModel, + logTexParameterf, + logTexParameterfv, + logTexParameteri, + logTexParameteriv, + logTexImage1D, + logTexImage2D, + logTexEnvf, + logTexEnvfv, + logTexEnvi, + logTexEnviv, + logTexGend, + logTexGendv, + logTexGenf, + logTexGenfv, + logTexGeni, + logTexGeniv, + logFeedbackBuffer, + logSelectBuffer, + logRenderMode, + logInitNames, + logLoadName, + logPassThrough, + logPopName, + logPushName, + logDrawBuffer, + logClear, + logClearAccum, + logClearIndex, + logClearColor, + logClearStencil, + logClearDepth, + logStencilMask, + logColorMask, + logDepthMask, + logIndexMask, + logAccum, + logDisable, + logEnable, + logFinish, + logFlush, + logPopAttrib, + logPushAttrib, + logMap1d, + logMap1f, + logMap2d, + logMap2f, + logMapGrid1d, + logMapGrid1f, + logMapGrid2d, + logMapGrid2f, + 0, /* glEvalCoord1d */ + logEvalCoord1dv, + 0, /* glEvalCoord1f */ + logEvalCoord1fv, + 0, /* glEvalCoord2d */ + logEvalCoord2dv, + 0, /* glEvalCoord2f */ + logEvalCoord2fv, + logEvalMesh1, + logEvalPoint1, + logEvalMesh2, + logEvalPoint2, + logAlphaFunc, + logBlendFunc, + logLogicOp, + logStencilFunc, + logStencilOp, + logDepthFunc, + logPixelZoom, + logPixelTransferf, + logPixelTransferi, + logPixelStoref, + logPixelStorei, + logPixelMapfv, + logPixelMapuiv, + logPixelMapusv, + logReadBuffer, + logCopyPixels, + logReadPixels, + logDrawPixels, + logGetBooleanv, + logGetClipPlane, + logGetDoublev, + logGetError, + logGetFloatv, + logGetIntegerv, + logGetLightfv, + logGetLightiv, + logGetMapdv, + logGetMapfv, + logGetMapiv, + logGetMaterialfv, + logGetMaterialiv, + logGetPixelMapfv, + logGetPixelMapuiv, + logGetPixelMapusv, + logGetPolygonStipple, + logGetString, + logGetTexEnvfv, + logGetTexEnviv, + logGetTexGendv, + logGetTexGenfv, + logGetTexGeniv, + logGetTexImage, + logGetTexParameterfv, + logGetTexParameteriv, + logGetTexLevelParameterfv, + logGetTexLevelParameteriv, + logIsEnabled, + logIsList, + logDepthRange, + logFrustum, + logLoadIdentity, + logLoadMatrixf, + logLoadMatrixd, + logMatrixMode, + logMultMatrixf, + logMultMatrixd, + logOrtho, + logPopMatrix, + logPushMatrix, + logRotated, + logRotatef, + logScaled, + logScalef, + logTranslated, + logTranslatef, + logViewport, + logArrayElement, + logBindTexture, + logColorPointer, + logDisableClientState, + logDrawArrays, + logDrawElements, + logEdgeFlagPointer, + logEnableClientState, + logIndexPointer, + 0, /* glIndexub */ + logIndexubv, + logInterleavedArrays, + logNormalPointer, + logPolygonOffset, + logTexCoordPointer, + logVertexPointer, + logAreTexturesResident, + logCopyTexImage1D, + logCopyTexImage2D, + logCopyTexSubImage1D, + logCopyTexSubImage2D, + logDeleteTextures, + logGenTextures, + logGetPointerv, + logIsTexture, + logPrioritizeTextures, + logTexSubImage1D, + logTexSubImage2D, + logPopClientAttrib, + logPushClientAttrib, + logBlendColor, + logBlendEquation, + 0, /* glDrawRangeElements */ + logColorTable, + logColorTableParameterfv, + logColorTableParameteriv, + logCopyColorTable, + logGetColorTable, + logGetColorTableParameterfv, + logGetColorTableParameteriv, + logColorSubTable, + logCopyColorSubTable, + logConvolutionFilter1D, + logConvolutionFilter2D, + logConvolutionParameterf, + logConvolutionParameterfv, + logConvolutionParameteri, + logConvolutionParameteriv, + logCopyConvolutionFilter1D, + logCopyConvolutionFilter2D, + logGetConvolutionFilter, + logGetConvolutionParameterfv, + logGetConvolutionParameteriv, + logGetSeparableFilter, + logSeparableFilter2D, + logGetHistogram, + logGetHistogramParameterfv, + logGetHistogramParameteriv, + logGetMinmax, + logGetMinmaxParameterfv, + logGetMinmaxParameteriv, + logHistogram, + logMinmax, + logResetHistogram, + logResetMinmax, + logTexImage3D, + logTexSubImage3D, + logCopyTexSubImage3D, + logActiveTextureARB, + logClientActiveTextureARB, + 0, /* glMultiTexCoord1dARB */ + logMultiTexCoord1dvARB, + 0, /* glMultiTexCoord1fARB */ + logMultiTexCoord1fvARB, + 0, /* glMultiTexCoord1iARB */ + logMultiTexCoord1ivARB, + 0, /* glMultiTexCoord1sARB */ + logMultiTexCoord1svARB, + 0, /* glMultiTexCoord2dARB */ + logMultiTexCoord2dvARB, + 0, /* glMultiTexCoord2fARB */ + logMultiTexCoord2fvARB, + 0, /* glMultiTexCoord2iARB */ + logMultiTexCoord2ivARB, + 0, /* glMultiTexCoord2sARB */ + logMultiTexCoord2svARB, + 0, /* glMultiTexCoord3dARB */ + logMultiTexCoord3dvARB, + 0, /* glMultiTexCoord3fARB */ + logMultiTexCoord3fvARB, + 0, /* glMultiTexCoord3iARB */ + logMultiTexCoord3ivARB, + 0, /* glMultiTexCoord3sARB */ + logMultiTexCoord3svARB, + 0, /* glMultiTexCoord4dARB */ + logMultiTexCoord4dvARB, + 0, /* glMultiTexCoord4fARB */ + logMultiTexCoord4fvARB, + 0, /* glMultiTexCoord4iARB */ + logMultiTexCoord4ivARB, + 0, /* glMultiTexCoord4sARB */ + logMultiTexCoord4svARB, + 0, /* glLoadTransposeMatrixfARB */ + 0, /* glLoadTransposeMatrixdARB */ + 0, /* glMultTransposeMatrixfARB */ + 0, /* glMultTransposeMatrixdARB */ + logSampleCoverageARB, + 0, /* glDrawBuffersARB */ + 0, /* glPolygonOffsetEXT */ + 0, /* glGetTexFilterFuncSGIS */ + 0, /* glTexFilterFuncSGIS */ + 0, /* glGetHistogramEXT */ + 0, /* glGetHistogramParameterfvEXT */ + 0, /* glGetHistogramParameterivEXT */ + 0, /* glGetMinmaxEXT */ + 0, /* glGetMinmaxParameterfvEXT */ + 0, /* glGetMinmaxParameterivEXT */ + 0, /* glGetConvolutionFilterEXT */ + 0, /* glGetConvolutionParameterfvEXT */ + 0, /* glGetConvolutionParameterivEXT */ + 0, /* glGetSeparableFilterEXT */ + 0, /* glGetColorTableSGI */ + 0, /* glGetColorTableParameterfvSGI */ + 0, /* glGetColorTableParameterivSGI */ + 0, /* glPixelTexGenSGIX */ + 0, /* glPixelTexGenParameteriSGIS */ + 0, /* glPixelTexGenParameterivSGIS */ + 0, /* glPixelTexGenParameterfSGIS */ + 0, /* glPixelTexGenParameterfvSGIS */ + 0, /* glGetPixelTexGenParameterivSGIS */ + 0, /* glGetPixelTexGenParameterfvSGIS */ + 0, /* glTexImage4DSGIS */ + 0, /* glTexSubImage4DSGIS */ + logAreTexturesResidentEXT, + logGenTexturesEXT, + logIsTextureEXT, + 0, /* glDetailTexFuncSGIS */ + 0, /* glGetDetailTexFuncSGIS */ + 0, /* glSharpenTexFuncSGIS */ + 0, /* glGetSharpenTexFuncSGIS */ + logSampleMaskSGIS, + logSamplePatternSGIS, + 0, /* glColorPointerEXT */ + 0, /* glEdgeFlagPointerEXT */ + 0, /* glIndexPointerEXT */ + 0, /* glNormalPointerEXT */ + 0, /* glTexCoordPointerEXT */ + 0, /* glVertexPointerEXT */ + 0, /* glSpriteParameterfSGIX */ + 0, /* glSpriteParameterfvSGIX */ + 0, /* glSpriteParameteriSGIX */ + 0, /* glSpriteParameterivSGIX */ + logPointParameterfEXT, + logPointParameterfvEXT, + 0, /* glGetInstrumentsSGIX */ + 0, /* glInstrumentsBufferSGIX */ + 0, /* glPollInstrumentsSGIX */ + 0, /* glReadInstrumentsSGIX */ + 0, /* glStartInstrumentsSGIX */ + 0, /* glStopInstrumentsSGIX */ + 0, /* glFrameZoomSGIX */ + 0, /* glTagSampleBufferSGIX */ + 0, /* glReferencePlaneSGIX */ + 0, /* glFlushRasterSGIX */ + 0, /* glGetListParameterfvSGIX */ + 0, /* glGetListParameterivSGIX */ + 0, /* glListParameterfSGIX */ + 0, /* glListParameterfvSGIX */ + 0, /* glListParameteriSGIX */ + 0, /* glListParameterivSGIX */ + 0, /* glFragmentColorMaterialSGIX */ + 0, /* glFragmentLightfSGIX */ + 0, /* glFragmentLightfvSGIX */ + 0, /* glFragmentLightiSGIX */ + 0, /* glFragmentLightivSGIX */ + 0, /* glFragmentLightModelfSGIX */ + 0, /* glFragmentLightModelfvSGIX */ + 0, /* glFragmentLightModeliSGIX */ + 0, /* glFragmentLightModelivSGIX */ + 0, /* glFragmentMaterialfSGIX */ + 0, /* glFragmentMaterialfvSGIX */ + 0, /* glFragmentMaterialiSGIX */ + 0, /* glFragmentMaterialivSGIX */ + 0, /* glGetFragmentLightfvSGIX */ + 0, /* glGetFragmentLightivSGIX */ + 0, /* glGetFragmentMaterialfvSGIX */ + 0, /* glGetFragmentMaterialivSGIX */ + 0, /* glLightEnviSGIX */ + 0, /* glVertexWeightfEXT */ + 0, /* glVertexWeightfvEXT */ + 0, /* glVertexWeightPointerEXT */ + 0, /* glFlushVertexArrayRangeNV */ + 0, /* glVertexArrayRangeNV */ + 0, /* glCombinerParameterfvNV */ + 0, /* glCombinerParameterfNV */ + 0, /* glCombinerParameterivNV */ + 0, /* glCombinerParameteriNV */ + 0, /* glCombinerInputNV */ + 0, /* glCombinerOutputNV */ + 0, /* glFinalCombinerInputNV */ + 0, /* glGetCombinerInputParameterfvNV */ + 0, /* glGetCombinerInputParameterivNV */ + 0, /* glGetCombinerOutputParameterfvNV */ + 0, /* glGetCombinerOutputParameterivNV */ + 0, /* glGetFinalCombinerInputParameterfvNV */ + 0, /* glGetFinalCombinerInputParameterivNV */ + 0, /* glResizeBuffersMESA */ + 0, /* glWindowPos2dMESA */ + 0, /* glWindowPos2dvMESA */ + 0, /* glWindowPos2fMESA */ + 0, /* glWindowPos2fvMESA */ + 0, /* glWindowPos2iMESA */ + 0, /* glWindowPos2ivMESA */ + 0, /* glWindowPos2sMESA */ + 0, /* glWindowPos2svMESA */ + 0, /* glWindowPos3dMESA */ + 0, /* glWindowPos3dvMESA */ + logWindowPos3fMESA, + 0, /* glWindowPos3fvMESA */ + 0, /* glWindowPos3iMESA */ + 0, /* glWindowPos3ivMESA */ + 0, /* glWindowPos3sMESA */ + 0, /* glWindowPos3svMESA */ + 0, /* glWindowPos4dMESA */ + 0, /* glWindowPos4dvMESA */ + 0, /* glWindowPos4fMESA */ + 0, /* glWindowPos4fvMESA */ + 0, /* glWindowPos4iMESA */ + 0, /* glWindowPos4ivMESA */ + 0, /* glWindowPos4sMESA */ + 0, /* glWindowPos4svMESA */ + logBlendFuncSeparateEXT, + 0, /* glIndexMaterialEXT */ + 0, /* glIndexFuncEXT */ + 0, /* glLockArraysEXT */ + 0, /* glUnlockArraysEXT */ + 0, /* glCullParameterdvEXT */ + 0, /* glCullParameterfvEXT */ + 0, /* glHintPGI */ + 0, /* glFogCoordfEXT */ + logFogCoordfvEXT, + 0, /* glFogCoorddEXT */ + logFogCoorddvEXT, + logFogCoordPointerEXT, + 0, /* glGetColorTableEXT */ + 0, /* glGetColorTableParameterivEXT */ + 0, /* glGetColorTableParameterfvEXT */ + 0, /* glTbufferMask3DFX */ + 0, /* glCompressedTexImage3DARB */ + 0, /* glCompressedTexImage2DARB */ + 0, /* glCompressedTexImage1DARB */ + 0, /* glCompressedTexSubImage3DARB */ + 0, /* glCompressedTexSubImage2DARB */ + 0, /* glCompressedTexSubImage1DARB */ + 0, /* glGetCompressedTexImageARB */ + 0, /* glSecondaryColor3bEXT */ + logSecondaryColor3bvEXT, + 0, /* glSecondaryColor3dEXT */ + logSecondaryColor3dvEXT, + 0, /* glSecondaryColor3fEXT */ + logSecondaryColor3fvEXT, + 0, /* glSecondaryColor3iEXT */ + logSecondaryColor3ivEXT, + 0, /* glSecondaryColor3sEXT */ + logSecondaryColor3svEXT, + 0, /* glSecondaryColor3ubEXT */ + logSecondaryColor3ubvEXT, + 0, /* glSecondaryColor3uiEXT */ + logSecondaryColor3uivEXT, + 0, /* glSecondaryColor3usEXT */ + logSecondaryColor3usvEXT, + logSecondaryColorPointerEXT, + 0, /* glAreProgramsResidentNV */ + 0, /* glBindProgramNV */ + 0, /* glDeleteProgramsNV */ + 0, /* glExecuteProgramNV */ + 0, /* glGenProgramsNV */ + 0, /* glGetProgramParameterdvNV */ + 0, /* glGetProgramParameterfvNV */ + 0, /* glGetProgramivNV */ + 0, /* glGetProgramStringNV */ + 0, /* glGetTrackMatrixivNV */ + 0, /* glGetVertexAttribdvARB */ + 0, /* glGetVertexAttribfvARB */ + 0, /* glGetVertexAttribivARB */ + 0, /* glGetVertexAttribPointervNV */ + 0, /* glIsProgramNV */ + 0, /* glLoadProgramNV */ + 0, /* glProgramParameter4dNV */ + 0, /* glProgramParameter4dvNV */ + 0, /* glProgramParameter4fNV */ + 0, /* glProgramParameter4fvNV */ + 0, /* glProgramParameters4dvNV */ + 0, /* glProgramParameters4fvNV */ + 0, /* glRequestResidentProgramsNV */ + 0, /* glTrackMatrixNV */ + 0, /* glVertexAttribPointerNV */ + 0, /* glVertexAttrib1dARB */ + 0, /* glVertexAttrib1dvARB */ + 0, /* glVertexAttrib1fARB */ + 0, /* glVertexAttrib1fvARB */ + 0, /* glVertexAttrib1sARB */ + 0, /* glVertexAttrib1svARB */ + 0, /* glVertexAttrib2dARB */ + 0, /* glVertexAttrib2dvARB */ + 0, /* glVertexAttrib2fARB */ + 0, /* glVertexAttrib2fvARB */ + 0, /* glVertexAttrib2sARB */ + 0, /* glVertexAttrib2svARB */ + 0, /* glVertexAttrib3dARB */ + 0, /* glVertexAttrib3dvARB */ + 0, /* glVertexAttrib3fARB */ + 0, /* glVertexAttrib3fvARB */ + 0, /* glVertexAttrib3sARB */ + 0, /* glVertexAttrib3svARB */ + 0, /* glVertexAttrib4dARB */ + 0, /* glVertexAttrib4dvARB */ + 0, /* glVertexAttrib4fARB */ + 0, /* glVertexAttrib4fvARB */ + 0, /* glVertexAttrib4sARB */ + 0, /* glVertexAttrib4svARB */ + 0, /* glVertexAttrib4NubARB */ + 0, /* glVertexAttrib4NubvARB */ + 0, /* glVertexAttribs1dvNV */ + 0, /* glVertexAttribs1fvNV */ + 0, /* glVertexAttribs1svNV */ + 0, /* glVertexAttribs2dvNV */ + 0, /* glVertexAttribs2fvNV */ + 0, /* glVertexAttribs2svNV */ + 0, /* glVertexAttribs3dvNV */ + 0, /* glVertexAttribs3fvNV */ + 0, /* glVertexAttribs3svNV */ + 0, /* glVertexAttribs4dvNV */ + 0, /* glVertexAttribs4fvNV */ + 0, /* glVertexAttribs4svNV */ + 0, /* glVertexAttribs4ubvNV */ + logPointParameteriNV, + logPointParameterivNV, + 0, /* glMultiDrawArraysEXT */ + 0, /* glMultiDrawElementsEXT */ + logActiveStencilFaceEXT, + 0, /* glDeleteFencesNV */ + 0, /* glGenFencesNV */ + 0, /* glIsFenceNV */ + 0, /* glTestFenceNV */ + 0, /* glGetFenceivNV */ + 0, /* glFinishFenceNV */ + 0, /* glSetFenceNV */ + 0, /* glVertexAttrib4bvARB */ + 0, /* glVertexAttrib4ivARB */ + 0, /* glVertexAttrib4ubvARB */ + 0, /* glVertexAttrib4usvARB */ + 0, /* glVertexAttrib4uivARB */ + 0, /* glVertexAttrib4NbvARB */ + 0, /* glVertexAttrib4NsvARB */ + 0, /* glVertexAttrib4NivARB */ + 0, /* glVertexAttrib4NusvARB */ + 0, /* glVertexAttrib4NuivARB */ + 0, /* glVertexAttribPointerARB */ + 0, /* glEnableVertexAttribArrayARB */ + 0, /* glDisableVertexAttribArrayARB */ + 0, /* glProgramStringARB */ + 0, /* glProgramEnvParameter4dARB */ + 0, /* glProgramEnvParameter4dvARB */ + 0, /* glProgramEnvParameter4fARB */ + 0, /* glProgramEnvParameter4fvARB */ + 0, /* glProgramLocalParameter4dARB */ + 0, /* glProgramLocalParameter4dvARB */ + 0, /* glProgramLocalParameter4fARB */ + 0, /* glProgramLocalParameter4fvARB */ + 0, /* glGetProgramEnvParameterdvARB */ + 0, /* glGetProgramEnvParameterfvARB */ + 0, /* glGetProgramLocalParameterdvARB */ + 0, /* glGetProgramLocalParameterfvARB */ + 0, /* glGetProgramivARB */ + 0, /* glGetProgramStringARB */ + 0, /* glProgramNamedParameter4fNV */ + 0, /* glProgramNamedParameter4dNV */ + 0, /* glProgramNamedParameter4fvNV */ + 0, /* glProgramNamedParameter4dvNV */ + 0, /* glGetProgramNamedParameterfvNV */ + 0, /* glGetProgramNamedParameterdvNV */ + 0, /* glBindBufferARB */ + 0, /* glBufferDataARB */ + 0, /* glBufferSubDataARB */ + 0, /* glDeleteBuffersARB */ + 0, /* glGenBuffersARB */ + 0, /* glGetBufferParameterivARB */ + 0, /* glGetBufferPointervARB */ + 0, /* glGetBufferSubDataARB */ + 0, /* glIsBufferARB */ + 0, /* glMapBufferARB */ + 0, /* glUnmapBufferARB */ + 0, /* glDepthBoundsEXT */ + 0, /* glGenQueriesARB */ + 0, /* glDeleteQueriesARB */ + 0, /* glIsQueryARB */ + 0, /* glBeginQueryARB */ + 0, /* glEndQueryARB */ + 0, /* glGetQueryivARB */ + 0, /* glGetQueryObjectivARB */ + 0, /* glGetQueryObjectuivARB */ + 0, /* glMultiModeDrawArraysIBM */ + 0, /* glMultiModeDrawElementsIBM */ + 0, /* glBlendEquationSeparateEXT */ + 0, /* glDeleteObjectARB */ + 0, /* glGetHandleARB */ + 0, /* glDetachObjectARB */ + 0, /* glCreateShaderObjectARB */ + 0, /* glShaderSourceARB */ + 0, /* glCompileShaderARB */ + 0, /* glCreateProgramObjectARB */ + 0, /* glAttachObjectARB */ + 0, /* glLinkProgramARB */ + 0, /* glUseProgramObjectARB */ + 0, /* glValidateProgramARB */ + 0, /* glUniform1fARB */ + 0, /* glUniform2fARB */ + 0, /* glUniform3fARB */ + 0, /* glUniform4fARB */ + 0, /* glUniform1iARB */ + 0, /* glUniform2iARB */ + 0, /* glUniform3iARB */ + 0, /* glUniform4iARB */ + 0, /* glUniform1fvARB */ + 0, /* glUniform2fvARB */ + 0, /* glUniform3fvARB */ + 0, /* glUniform4fvARB */ + 0, /* glUniform1ivARB */ + 0, /* glUniform2ivARB */ + 0, /* glUniform3ivARB */ + 0, /* glUniform4ivARB */ + 0, /* glUniformMatrix2fvARB */ + 0, /* glUniformMatrix3fvARB */ + 0, /* glUniformMatrix4fvARB */ + 0, /* glGetObjectParameterfvARB */ + 0, /* glGetObjectParameterivARB */ + 0, /* glGetInfoLogARB */ + 0, /* glGetAttachedObjectsARB */ + 0, /* glGetUniformLocationARB */ + 0, /* glGetActiveUniformARB */ + 0, /* glGetUniformfvARB */ + 0, /* glGetUniformivARB */ + 0, /* glGetShaderSourceARB */ + 0, /* glBindAttribLocationARB */ + 0, /* glGetActiveAttribARB */ + 0, /* glGetAttribLocationARB */ + 0, /* glGetVertexAttribdvNV */ + 0, /* glGetVertexAttribfvNV */ + 0, /* glGetVertexAttribivNV */ + 0, /* glVertexAttrib1dNV */ + 0, /* glVertexAttrib1dvNV */ + 0, /* glVertexAttrib1fNV */ + 0, /* glVertexAttrib1fvNV */ + 0, /* glVertexAttrib1sNV */ + 0, /* glVertexAttrib1svNV */ + 0, /* glVertexAttrib2dNV */ + 0, /* glVertexAttrib2dvNV */ + 0, /* glVertexAttrib2fNV */ + 0, /* glVertexAttrib2fvNV */ + 0, /* glVertexAttrib2sNV */ + 0, /* glVertexAttrib2svNV */ + 0, /* glVertexAttrib3dNV */ + 0, /* glVertexAttrib3dvNV */ + 0, /* glVertexAttrib3fNV */ + 0, /* glVertexAttrib3fvNV */ + 0, /* glVertexAttrib3sNV */ + 0, /* glVertexAttrib3svNV */ + 0, /* glVertexAttrib4dNV */ + 0, /* glVertexAttrib4dvNV */ + 0, /* glVertexAttrib4fNV */ + 0, /* glVertexAttrib4fvNV */ + 0, /* glVertexAttrib4sNV */ + 0, /* glVertexAttrib4svNV */ + 0, /* glVertexAttrib4ubNV */ + 0, /* glVertexAttrib4ubvNV */ + 0, /* glGenFragmentShadersATI */ + 0, /* glBindFragmentShaderATI */ + 0, /* glDeleteFragmentShaderATI */ + 0, /* glBeginFragmentShaderATI */ + 0, /* glEndFragmentShaderATI */ + 0, /* glPassTexCoordATI */ + 0, /* glSampleMapATI */ + 0, /* glColorFragmentOp1ATI */ + 0, /* glColorFragmentOp2ATI */ + 0, /* glColorFragmentOp3ATI */ + 0, /* glAlphaFragmentOp1ATI */ + 0, /* glAlphaFragmentOp2ATI */ + 0, /* glAlphaFragmentOp3ATI */ + 0, /* glSetFragmentShaderConstantATI */ + logIsRenderbufferEXT, + logBindRenderbufferEXT, + logDeleteRenderbuffersEXT, + logGenRenderbuffersEXT, + logRenderbufferStorageEXT, + logGetRenderbufferParameterivEXT, + logIsFramebufferEXT, + logBindFramebufferEXT, + logDeleteFramebuffersEXT, + logGenFramebuffersEXT, + logCheckFramebufferStatusEXT, + logFramebufferTexture1DEXT, + logFramebufferTexture2DEXT, + logFramebufferTexture3DEXT, + logFramebufferRenderbufferEXT, + logGetFramebufferAttachmentParameterivEXT, + logGenerateMipmapEXT, + 0, /* glStencilFuncSeparate */ + 0, /* glStencilOpSeparate */ + 0, /* glStencilMaskSeparate */ + 0, /* glGetQueryObjecti64vEXT */ + 0 /* glGetQueryObjectui64vEXT */ +}; + +static Bool isCurrent = FALSE; + +static void (*flushContextCache) (void); +static void (*setRenderTables) (struct _glapi_table *table); + +static void +GlxLogFlushContextCache (void) +{ + if (isCurrent) + { + fprintf (logFp, "LOSE CURRENT\n"); + isCurrent = FALSE; + } + + (*flushContextCache) (); +} + +static void +GlxLogSetRenderTables (struct _glapi_table *table) +{ + nativeRenderTable = table; + + if (table) + { + fprintf (logFp, "FORCE CURRENT\n"); + isCurrent = TRUE; + + (*setRenderTables) (&__logRenderTable); + } + else + { + (*setRenderTables) (0); + } +} + +void +xglInitGlxLog (void) +{ + if (logFp) + return; + + if (__xglGLXLogFp) + { + logFp = __xglGLXLogFp; + + flushContextCache = __xglGLXFunc.flushContextCache; + setRenderTables = __xglGLXFunc.setRenderTables; + + __xglGLXFunc.flushContextCache = GlxLogFlushContextCache; + __xglGLXFunc.setRenderTables = GlxLogSetRenderTables; + } +} + +#endif |