diff options
183 files changed, 30965 insertions, 18991 deletions
diff --git a/xc/config/cf/Imake.rules b/xc/config/cf/Imake.rules index 1a1aa03d6..1767e8188 100644 --- a/xc/config/cf/Imake.rules +++ b/xc/config/cf/Imake.rules @@ -5,7 +5,7 @@ XCOMM XCOMM XCOMM XCOMM -XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.60 1999/08/14 10:48:57 dawes Exp $ +XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.86 2000/12/12 17:05:30 dawes Exp $ /* * MACHINE-INDEPENDENT RULES; DO NOT MODIFY @@ -85,6 +85,10 @@ XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.60 1999/08/14 10:48:57 dawe * InstallNamedProgNoClobber (srcname,dstname,dest) * MakeFlagsToShellFlags (makeflags,shellcmd) * MakeNamedTargetSubdir (dir,flags,subname) + * LinkConfDirectoryLong (mdir,cdir,rdir,ldir,opath,npath) + * LinkConfDirectory (mdir,cdir,rdir,ldir) + * LinkConfFileLong (cfile,lfile,opath,npath) + * LinkConfFile (cfile,lfile) * LinkFileList (step,list,dir,sub) * LinkVarDirectory (mdir,cdir,rdir,ldir) * InstallMultipleDestFlags (step,list,dest,flags) @@ -123,6 +127,7 @@ XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.60 1999/08/14 10:48:57 dawe * SpecialObjectRule (objs,depends,options) * SpecialCObjectRule (basename,depends,options) * LexFile (file) + * M4File (file,includes) * YaccFile (file,flags) * YaccFileNoFlags (file) * MakeLibrary (libname,objlist) @@ -314,6 +319,10 @@ XCOMM special target for clearmake @@\ #define RunProgramWithSetup(setup,progvar,options) setup $(progvar) options #endif +#ifndef RunPerlScript +#define RunPerlScript(script,options) $(PERL) $(PERLOPTS) script options +#endif + #ifndef RemoveFile #define RemoveFile(file) $(RM) file #endif /* RemoveFile */ @@ -533,6 +542,7 @@ includes:: srclist @@\ all:: $(BUILDBINDIR)/binary binary @@\ @@\ $(BUILDBINDIR)/binary: binary @@\ + MakeDir($(BUILDBINDIR)) @@\ RemoveFile($@) @@\ cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/binary . #endif /* LinkBuildBinary */ @@ -1134,6 +1144,17 @@ install:: LibraryTargetName(libname) @@\ /* + * InstallDriverSDKLibraryModule - rule to install Driver SDK library module. + * (only used for XFree86). This is a no-op + * rule so that Imakefiles on non-XFree86 systems + * continue to build Makefiles correctly. + */ +#ifndef InstallDriverSDKLibraryModule +#define InstallDriverSDKLibraryModule(lib,dlib,dir) +#endif + + +/* * MergeIntoInstalledLibrary - generate rules to merge one library into another */ #ifndef MergeIntoInstalledLibrary @@ -1173,6 +1194,8 @@ InstallTarget(install.ln,Concat(llib-l,libname.ln),$(INSTLIBFLAGS),dest) */ #ifndef InstallManPageLong #define InstallManPageLong(file,destdir,dest) @@\ +BuildInstallHtmlManPage(file,dest,$(MANSUFFIX)) @@\ + @@\ InstallNamedTarget(install.man,file.man,$(INSTMANFLAGS),destdir,dest.$(MANSUFFIX)) #endif /* InstallManPageLong */ @@ -1191,6 +1214,8 @@ InstallManPageLong(file,destdir,file) */ #ifndef InstallManPageAliases #define InstallManPageAliases(file,destdir,aliases) @@\ +InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX)) @@\ + @@\ install.man:: @@\ @(TMP=/tmp/tmp.$$$$; \ @@\ RemoveFile($${TMP}); \ @@\ @@ -1208,6 +1233,8 @@ install.man:: @@\ */ #ifndef InstallGenManPageLong #define InstallGenManPageLong(file,destdir,dest,suffix) @@\ +BuildInstallHtmlManPage(file,dest,suffix) @@\ + @@\ install.man:: file.man @@\ MakeDir($(DESTDIR)destdir) @@\ $(INSTALL) -c $(INSTMANFLAGS) file.man $(DESTDIR)destdir/dest.suffix @@ -1228,6 +1255,8 @@ InstallGenManPageLong(file,destdir,file,suffix) */ #ifndef InstallGenManPageAliases #define InstallGenManPageAliases(file,destdir,suffix,aliases) @@\ +InstallHtmlManPageAliases(file,aliases,suffix) @@\ + @@\ install.man:: @@\ @(TMP=/tmp/tmp.$$$$; \ @@\ RemoveFile($${TMP}); \ @@\ @@ -1238,6 +1267,83 @@ install.man:: @@\ RemoveFile($${TMP})) #endif /* InstallGenManPageAliases */ + +/* + * RmanDependency - generate rules to build the rman program if + * this Imakefile is within the source tree. + */ +#ifndef RmanDependency +#ifdef UseInstalled +#define RmanDependency() /**/ +#else +#define RmanDependency() @@\ +NoCmpScript(ProgramTargetName($(RMAN))) @@\ + @@\ +ProgramTargetName($(RMAN)): @@\ + @echo "checking $@ over in $(TOP)/config/util first..."; \ @@\ + cd $(TOP)/config/util && $(MAKE) rman; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)" + +#endif /* UseInstalled */ +#endif /* RmanDependency */ + +#ifndef RmanCmdDependency +#ifdef UseInstalled +#define RmanCmdDependency /**/ +#else +#define RmanCmdDependency ProgramTargetName($(RMAN)) +#endif +#endif + +#ifndef BuildInstallHtmlManPage +#if BuildHtmlManPages +XCOMM Don't do: 'AllTarget(dest.suffix.html)'. It breaks external packages +#define BuildInstallHtmlManPage(file,dest,suffix) @@\ + @@\ +dest.suffix.html: file.man RmanCmdDependency @@\ + RemoveFiles(dest.suffix.html dest.suffix-html) @@\ + RunProgram(RMAN,$(RMANOPTIONS) < file.man > dest.suffix-html) && \ @@\ + $(MV) dest.suffix-html $@ @@\ + @@\ +install.man:: dest.suffix.html @@\ + MakeDir($(DESTDIR)$(DOCHTMLDIR)) @@\ + @(SUF=`expr suffix \: '\(.\)'`; \ @@\ + set -x; \ @@\ + $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) dest.suffix.html $(DESTDIR)$(DOCHTMLDIR)/dest.$$SUF.html) @@\ + @@\ +clean:: @@\ + RemoveFiles(dest.suffix.html dest.suffix-html) +#else +#define BuildInstallHtmlManPage(file,dest,suffix) /**/ +#endif +#endif + +#ifndef InstallHtmlManPageAliases +#if BuildHtmlManPages +#define InstallHtmlManPageAliases(file,aliases,suffix) @@\ +install.man:: file.suffix.html @@\ + @SUF=`expr suffix \: '\(.\)'`; \ @@\ + for i in aliases; do (set -x; \ @@\ + RemoveFile($(DESTDIR)$(DOCHTMLDIR)/$$i.$$SUF.html); \ @@\ + (cd $(DESTDIR)$(DOCHTMLDIR); \ @@\ + $(LN) file.$$SUF.html $$i.$$SUF.html)); \ @@\ + done +#else +#define InstallHtmlManPageAliases(file,aliases,suffix) /**/ +#endif +#endif + +#ifndef HtmlManIndex +#if BuildHtmlManPages +#define HtmlManIndex @@\ +html_index:: @@\ + $(HTMLINDEXCMD) $(DESTDIR)$(DOCHTMLDIR) +#else +#define HtmlManIndex html_index:: +#endif +#endif + + /* * ManKeywordsTarget - generate the database used by "man -k". * This rule updates the index in the directory "manpath", which @@ -1409,43 +1515,95 @@ step:: list @@\ for i in list; do (set -x; RemoveFile($$i); $(LN) sub/$$i .); done #endif + /* - * LinkVarDirectory + * LinkConfDirectoryLong * - * Make links from $LIBDIR (<ProjectRoot>/lib/X11) to /var/X11/ - * For example /usr/X11R6/lib/X11/xdm ==> /var/X11/xdm so that X + * Make links from opath (usually <ProjectRoot>/lib/X11) to npath + * For example /usr/X11R6/lib/X11/xdm ==> /etc/X11/xdm so that X * binaries can be mounted from a read-only volume like a CD-ROM; * but files that may need to be edited can be stored locally on * read-write media. If someone has an existing installation, be - * careful and move existing files to the new location in /var. + * careful and move existing files to the new location in /etc. + * XXX Need to make the installation script do this when installing + * binary distributions. * * Since the link is used in the installation process, we need to * make the link relative in order to honor $(DESTDIR) if it is set. */ -#ifndef LinkVarDirectory -#if HasVarDirectory && HasSymLinks -#define LinkVarDirectory(mdir,cdir,rdir,ldir) @@\ +#ifndef LinkConfDirectoryLong +#if UseSeparateConfDir && HasSymLinks +#define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath) @@\ install:: @@\ - MakeDir(Concat($(DESTDIR)$(LIBDIR)/,cdir)) @@\ - MakeDir(Concat($(DESTDIR)$(VARDIR)/,mdir)) @@\ + MakeDir(Concat($(DESTDIR),opath/cdir)) @@\ + MakeDir(Concat($(DESTDIR),npath/mdir)) @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ - if [ -d Concat($(DESTDIR)$(LIBDIR)/,cdir) ]; then \ @@\ - RELPATH=`echo Concat($(LIBDIR)/,cdir) | \ @@\ + if [ -d Concat($(DESTDIR),opath/cdir) ]; then \ @@\ + RELPATH=`echo opath/cdir | \ @@\ sed -e 's:^.::' -e 's:[^/.][^/]*:..:'g`; \ @@\ - cd Concat($(DESTDIR)$(LIBDIR)/,cdir); \ @@\ + cd Concat($(DESTDIR),opath/cdir); \ @@\ if [ -d rdir -a ! -h rdir ]; then \ @@\ (cd rdir; tar cf - . | \ @@\ - (cd Concat($(DESTDIR)$(VARDIR)/,mdir);\ @@\ + (cd Concat($(DESTDIR),npath/mdir); \ @@\ tar xf -; exit 0); exit 0); \ @@\ fi; \ @@\ $(RM) -r rdir; \ @@\ - $(LN) Concat($${RELPATH}$(VARDIR)/,mdir) ldir; \ @@\ + $(LN) Concat($${RELPATH},npath/mdir) ldir; \ @@\ fi #else -#define LinkVarDirectory(mdir,cdir,rdir,ldir) +#define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath) +#endif #endif + +#ifndef LinkConfDirectory +#define LinkConfDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(CONFDIR)) #endif +#ifndef LinkVarDirectory +#define LinkVarDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(VARDIR)) +#endif + +/* + * LinkConfFileLong + * + * Make links from opath (<ProjectRoot>/lib/X11) to npath + * For example /usr/X11R6/lib/X11/xxx ==> /etc/X11/xxx so that X binaries + * can be mounted from a read-only volume like a CD-ROM; + * but files that may need to be edited can be stored locally on + * read-write media. If someone has an existing installation, be + * careful and move existing files to the new location in /etc. + * XXX Need to make the installation script do this when installing + * binary distributions. + * + * Since the link is used in the installation process, we need to + * make the link relative in order to honor $(DESTDIR) if it is set. + */ +#ifndef LinkConfFileLong +#if UseSeparateConfDir && HasSymLinks +#define LinkConfFileLong(cfile,lfile,opath,npath) @@\ +install:: @@\ + MakeDir(Concat($(DESTDIR),opath)) @@\ + MakeDir(Concat($(DESTDIR),npath)) @@\ + @MakeFlagsToShellFlags(i,set +e); \ @@\ + if [ -d Concat($(DESTDIR),opath) ]; then \ @@\ + RELPATH=`echo opath | \ @@\ + sed -e 's:^.::' -e 's:[^/.][^/]*:..:'g`; \ @@\ + cd Concat($(DESTDIR),opath); \ @@\ + if [ -f lfile -a ! -h lfile ]; then \ @@\ + cp -p lfile Concat($(DESTDIR),npath/cfile); \ @@\ + fi; \ @@\ + $(RM) -r lfile; \ @@\ + $(LN) Concat($${RELPATH},npath/cfile) lfile; \ @@\ + fi +#else +#define LinkConfFileLong(cfile,lfile,opath,npath) +#endif +#endif + + +#ifndef LinkConfFile +#define LinkConfFile(cfile,lfile) LinkConfFileLong(cfile,lfile,$(LIBDIR),$(CONFDIR)) +#endif /* * InstallMultipleDestFlags - generate rules to install multiple files at @@ -1768,6 +1926,16 @@ Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\ LintLibReferences(varname,libname,libsource) #endif + /* + * ProjectUnsharedFontLibReferences - unshared font libraries + */ +#ifndef ProjectUnsharedFontLibReferences +#define ProjectUnsharedFontLibReferences() @@\ +DEPFONTLIB = _UseCat($(USRLIBDIR)/,XBuildLibDir/,LibraryTargetName(Xfont)) @@\ +FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) LoaderLibPrefix -lXfont @@\ +LintLibReferences(XFONT,Xfont,$(FONTLIBSRC)) +#endif + /* * SharedLibDependencies - shared library dependencies */ @@ -1776,6 +1944,17 @@ LintLibReferences(varname,libname,libsource) #endif /* + * SharedFontLibReferences - shared font libraries + */ +#ifndef SharedFontLibReferences +#define SharedFontLibReferences() @@\ +SOFONTREV = SharedFontRev @@\ +DEPFONTLIB = SharedLibDependencies(Xfont,$(FONTLIBSRC),SOFONTREV) @@\ +FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) LoaderLibPrefix -lXfont @@\ +LintLibReferences(XFONT,Xfont,$(FONTLIBSRC)) +#endif + +/* * SharedDSLibDependencies - shared library dependencies with data separation */ #ifndef SharedDSLibDependencies @@ -1867,11 +2046,13 @@ LintLibReferences(varname,libname,libsource) #if HasGcc || HasGcc2 #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ - $(CC) -c $(CCOPTIONS) $(ALLDEFINES) options $*.c -o dir/$@ + $(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \ + options $*.c -o dir/$@ #else #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ - $(CC) -c $(CCOPTIONS) $(ALLDEFINES) options $*.c @@\ + $(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \ + options $*.c @@\ $(MV) $@ dir/$@ #endif #endif @@ -1880,11 +2061,13 @@ LintLibReferences(varname,libname,libsource) #if HasGcc || HasGcc2 #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ - $(CXX) -c $(CXXOPTIONS) $(CXXDEFINES) options $*.CCsuf -o dir/$@ + $(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \ + options $*.CCsuf -o dir/$@ #else #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ - $(CXX) -c $(CXXOPTIONS) $(CXXDEFINES) options $*.CCsuf @@\ + $(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \ + options $*.CCsuf @@\ $(MV) $@ dir/$@ #endif #endif @@ -1915,18 +2098,18 @@ LintLibReferences(varname,libname,libsource) * UnsharedLibObjCompile - compile fragment for unshared objects */ #ifndef UnsharedLibObjCompile -#define UnsharedLibObjCompile(options) LibObjCompile(unshared,$(CDEBUGFLAGS) options) +#define UnsharedLibObjCompile(options) LibObjCompile(unshared,$(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) options) #endif #ifndef UnsharedLibObjCplusplusCompile -#define UnsharedLibObjCplusplusCompile(options) LibObjCplusplusCompile(unshared,$(CXXDEBUGFLAGS) options) +#define UnsharedLibObjCplusplusCompile(options) LibObjCplusplusCompile(unshared,$(CXXDEBUGFLAGS) $(CXXLIBDEBUGFLAGS) options) #endif /* * SharedLibObjCompile - compile fragment for shared objects */ #ifndef SharedLibObjCompile -#define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS)) +#define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS)) #endif /* @@ -2003,6 +2186,24 @@ clean:: @@\ RemoveFile(dst.c) #endif /* ObjectFromSpecialSource */ +#ifndef SwitchYYPrefix +#define SwitchYYPrefix(in,out,prefix) \ + sed 's/yy/prefix/g' in > out && RemoveFile(in) +#endif + +#ifndef LexFilePrefix +#define LexFilePrefix(file,prefix) @@\ +file.c: file.l @@\ + ClearmakeOSName \ + $(LEX) $(LFLAGS) file.l @@\ + SwitchYYPrefix(lex.yy.c,file.c,prefix) @@\ + @@\ +depend:: file.c @@\ + @@\ +clean:: @@\ + RemoveFiles(lex.yy.c file.c) +#endif + #ifndef LexFileExplicit #if HasClearmake /* provide a place to hang ClearmakeOSName */ #define LexFileExplicit(file) @@\ @@ -2025,6 +2226,51 @@ clean:: @@\ RemoveFiles(lex.yy.c file.c) #endif /* LexFile */ + +#ifndef M4File +#define M4File(file,includes) @@\ +file: file.m4 includes @@\ + RemoveFile(file) @@\ + $(M4) $(M4FLAGS) file.m4 >file @@\ + @@\ +depend:: file @@\ + @@\ +clean:: @@\ + RemoveFile(file) +#endif /* M4File */ + +#ifndef YaccFilePrefix +#if HasGnuMake +#define YaccFilePrefix(file,flags,prefix) @@\ +depend:: file.c @@\ + @@\ +file.h: file.c @@\ + @@\ +file.c: file.y @@\ + ClearmakeOSName \ + $(YACC) flags file.y @@\ + SwitchYYPrefix(y.tab.c,file.c,prefix) @@\ + @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \@@\ + else exit 0; fi @@\ + @@\ +clean:: @@\ + RemoveFiles(y.tab.c y.tab.h file.h file.c) +#else +#define YaccFilePrefix(file,flags,prefix) @@\ +depend:: file.c @@\ + @@\ +file.h file.c: file.y @@\ + ClearmakeOSName \ + $(YACC) flags file.y @@\ + SwitchYYPrefix(y.tab.c,file.c,prefix) @@\ + @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \ @@\ + else exit 0; fi @@\ + @@\ +clean:: @@\ + RemoveFiles(y.tab.c y.tab.h file.h file.c) +#endif +#endif /* YaccFile */ + #ifndef YaccFile #if HasGnuMake #define YaccFile(file,flags) @@\ @@ -2588,6 +2834,9 @@ NamedTargetSubdirs(includes,dirs,including,NullParameter,includes) #ifndef InstallDriverSDKObjectModule #define InstallDriverSDKObjectModule(module,dest,subdir) #endif +#ifndef InstallDriverSDKObjectSubModule +#define InstallDriverSDKObjectSubModule(module,dest,subdir) +#endif @@ -2924,6 +3173,7 @@ NormalRelocatableTarget(Concat(module,_drv), objects) #ifndef LibraryModuleTarget #if MakeDllModules #define LibraryModuleTarget(module,objects) @@\ +NormalLibraryTarget(module, objects) @@\ DynamicModuleTarget(Concat3(lib,module,.so), objects) #else #define LibraryModuleTarget(module, objects) @@\ @@ -2937,6 +3187,7 @@ NormalLibraryTarget(module, objects) #ifndef DepLibraryModuleTarget #if MakeDllModules #define DepLibraryModuleTarget(module,deplist,objects) @@\ +NormalDepLibraryTarget(module, deplist, objects) @@\ DepDynamicModuleTarget(Concat3(lib,module,.so), deplist, objects) #else #define DepLibraryModuleTarget(module,deplist,objects) @@\ @@ -2953,7 +3204,7 @@ AllTarget(module) @@\ @@\ module: modlist @@\ RemoveFile($@) @@\ - $(LD) -o $@ $(SHLIBLDFLAGS) modlist @@\ + $(CC) -o $@ $(SHLIBLDFLAGS) modlist @@\ @@\ clean:: @@\ RemoveFile(module) @@ -2968,7 +3219,7 @@ AllTarget(module) @@\ @@\ module: deplist @@\ RemoveFile($@) @@\ - $(LD) -o $@ $(SHLIBLDFLAGS) modlist @@\ + $(CC) -o $@ $(SHLIBLDFLAGS) modlist @@\ @@\ clean:: @@\ RemoveFile(module) @@ -3030,3 +3281,23 @@ InstallDynamicModule(ModuleLibraryTargetName(module),dest,subdir) InstallGenManPage(module,$(DRIVERMANDIR),$(DRIVERMANSUFFIX)) #endif +#ifndef BuildObjectFromLibraryWithPath +#define BuildObjectFromLibraryWithPath(libpath,libname,objname) @@\ +AllTarget(objname.Osuf) @@\ + @@\ +objname.Osuf: Concat3(libpath,/lib,libname.a) @@\ + @$(MKDIRHIER) tmp @@\ + @$(CP) Concat3(libpath,/lib,libname.a) tmp @@\ + @(cd tmp; set -x; ArExtCmd Concat(lib,libname.a); \ @@\ + $(LD) $(LDCOMBINEFLAGS) *.Osuf -o ../$@; \ @@\ + RemoveFiles(*.Osuf)) @@\ + @$(RM) -r tmp @@\ + @@\ +clean:: @@\ + RemoveFile(objname.Osuf) +#endif + +#ifndef BuildObjectFromLibrary +#define BuildObjectFromLibrary(libname,objname) BuildObjectFromLibraryWithPath(.,libname,objname) +#endif + diff --git a/xc/config/cf/host.def b/xc/config/cf/host.def index f5d510ca6..bdf4e48e4 100644 --- a/xc/config/cf/host.def +++ b/xc/config/cf/host.def @@ -1,6 +1,11 @@ +#define DefaultGcc2AxpOpt -O2 -mcpu=ev6 #define DefaultGcc2i386Opt -O2 +#ifdef AlphaArchitecture +#define LibraryCDebugFlags -O2 -mcpu=ev6 +#else #define LibraryCDebugFlags -O2 +#endif #define BuildServersOnly YES #define XF86CardDrivers vga tdfx i810 mga ati glint #define LinuxDistribution LinuxRedHat diff --git a/xc/extras/Mesa/include/GL/gl.h b/xc/extras/Mesa/include/GL/gl.h index 4c6d2b3fc..029874b3d 100644 --- a/xc/extras/Mesa/include/GL/gl.h +++ b/xc/extras/Mesa/include/GL/gl.h @@ -44,11 +44,11 @@ #define OPENSTEP #endif -#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__WIN32__) #define __WIN32__ #endif -#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) +#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) # if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ # define GLAPI __declspec(dllexport) # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ @@ -63,7 +63,7 @@ # define GLAPIENTRY #endif /* WIN32 / CYGWIN bracket */ -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(__CYGWIN__) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) #include <gl/mesa_wgl.h> #endif diff --git a/xc/extras/Mesa/src/X/xmesa1.c b/xc/extras/Mesa/src/X/xmesa1.c index 5e4722c89..7afff16b2 100644 --- a/xc/extras/Mesa/src/X/xmesa1.c +++ b/xc/extras/Mesa/src/X/xmesa1.c @@ -2,7 +2,7 @@ /* * Mesa 3-D graphics library * Version: 3.4 - * + * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -2396,7 +2396,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) _mesa_swapbuffers(ctx); if (b->db_state) { - int yTop = b->bottom - y - height; + int yTop = b->height - y - height; #ifdef FX if (b->FXctx) { fxMesaSwapBuffers(); diff --git a/xc/extras/Mesa/src/glheader.h b/xc/extras/Mesa/src/glheader.h index f47f268bc..a6acd9476 100644 --- a/xc/extras/Mesa/src/glheader.h +++ b/xc/extras/Mesa/src/glheader.h @@ -39,9 +39,13 @@ * If you touch this file, everything gets recompiled! * * This file should be included before any other header in the .c files. + * + * Put compiler/OS/assembly pragmas and macros here to avoid + * cluttering other source files. */ + #ifdef XFree86LOADER #include "xf86_ansic.h" #else @@ -70,19 +74,6 @@ - -/* - * Put compiler/OS/assembly pragmas and macros here to avoid - * cluttering other source files. - */ - - - -/* - * XXX move as many of these pragma's and MS Windows-isms into - * the new src/glheader.h file. - */ - #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) # define __WIN32__ #endif diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h index dae66eac6..a42db5ddb 100644 --- a/xc/extras/Mesa/src/mmath.h +++ b/xc/extras/Mesa/src/mmath.h @@ -24,6 +24,7 @@ */ /* $XFree86: xc/extras/Mesa/src/mmath.h,v 1.7 2000/09/24 13:50:14 alanh Exp $ */ + /* * Faster arithmetic functions. If the FAST_MATH preprocessor symbol is * defined on the command line (-DFAST_MATH) then we'll use some (hopefully) diff --git a/xc/extras/Mesa/src/shade_tmp.h b/xc/extras/Mesa/src/shade_tmp.h index 53fe2b368..3de4182be 100644 --- a/xc/extras/Mesa/src/shade_tmp.h +++ b/xc/extras/Mesa/src/shade_tmp.h @@ -629,9 +629,6 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB ) if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); - COPY_3V(base[0], ctx->Light.BaseColor[0]); - if (NR_SIDES == 2) COPY_3V(base[1], ctx->Light.BaseColor[1]); - interesting = cm_flags | VERT_MATERIAL | VERT_END_VB | VERT_NORM; VB->ColorPtr = VB->LitColor[0]; VB->Color[0] = VB->LitColor[0]; diff --git a/xc/extras/Mesa/src/texgen_tmp.h b/xc/extras/Mesa/src/texgen_tmp.h index c1fa50816..6f284e38c 100644 --- a/xc/extras/Mesa/src/texgen_tmp.h +++ b/xc/extras/Mesa/src/texgen_tmp.h @@ -47,7 +47,7 @@ static void TAG(build_m3)(GLfloat f[][3], GLfloat *coord = (GLfloat *)coord_vec->start; GLuint count = coord_vec->count; - const GLfloat *normal = FIRST_NORMAL; + GLfloat *normal = FIRST_NORMAL; GLuint i; LOCAL_VARS; @@ -55,26 +55,21 @@ static void TAG(build_m3)(GLfloat f[][3], (void) flags; (void) cullmask; - /* KW: Had to rearrange this loop to avoid a compiler bug with gcc - * 2.7.3.1 at -O3 optimization. Using -fno-strength-reduce - * also fixed the bug - is this generally necessary? - */ - for (i=0;i<count;i++,STRIDE_F(coord,stride)) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), NEXT_NORMAL) { CHECK { - const GLfloat *norm = normal; GLfloat u[3], two_nu, fx, fy, fz; + CUR_NORMAL; COPY_3V( u, coord ); NORMALIZE_3FV( u ); - two_nu = 2.0F * DOT3(norm,u); - fx = f[i][0] = u[0] - norm[0] * two_nu; - fy = f[i][1] = u[1] - norm[1] * two_nu; - fz = f[i][2] = u[2] - norm[2] * two_nu; + two_nu = 2.0F * DOT3(normal,u); + fx = f[i][0] = u[0] - normal[0] * two_nu; + fy = f[i][1] = u[1] - normal[1] * two_nu; + fz = f[i][2] = u[2] - normal[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]); } } - NEXT_NORMAL; } } @@ -99,23 +94,21 @@ static void TAG(build_m2)(GLfloat f[][3], (void) flags; (void) cullmask; - for (i=0;i<count;i++,STRIDE_F(coord,stride)) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), NEXT_NORMAL) { CHECK { - GLfloat *norm = normal; GLfloat u[3], two_nu, fx, fy, fz; - COPY_2V( u, coord ); - u[2] = 0; + CUR_NORMAL; + COPY_2V( u, coord ); u[2] = 0; NORMALIZE_3FV( u ); - two_nu = 2.0F * DOT3(norm,u); - fx = f[i][0] = u[0] - norm[0] * two_nu; - fy = f[i][1] = u[1] - norm[1] * two_nu; - fz = f[i][2] = u[2] - norm[2] * two_nu; + two_nu = 2.0F * DOT3(normal,u); + fx = f[i][0] = u[0] - normal[0] * two_nu; + fy = f[i][1] = u[1] - normal[1] * two_nu; + fz = f[i][2] = u[2] - normal[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]); } } - NEXT_NORMAL; } } @@ -153,9 +146,10 @@ static void TAG(build_f3)( GLfloat *f, (void) flags; (void) cullmask; - for (i=0;i<count;i++, STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { CHECK { GLfloat u[3], two_nu; + CUR_NORMAL; COPY_3V( u, coord ); NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(normal,u); @@ -186,11 +180,11 @@ static void TAG(build_f2)( GLfloat *f, (void) flags; (void) cullmask; - for (i=0;i<count;i++,STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { CHECK { GLfloat u[3], two_nu; - COPY_2V( u, coord ); - u[2] = 0; + CUR_NORMAL; + COPY_2V( u, coord ); u[2] = 0; NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(normal,u); f[0] = u[0] - normal[0] * two_nu; @@ -250,16 +244,18 @@ static void TAG(texgen_normal_map_nv)( struct vertex_buffer *VB, GLubyte *cullmask = VB->CullMask + VB->Start; GLuint *flags = VB->Flag + VB->Start; GLuint count = VB->Count; - GLuint i; + const GLfloat *normal = FIRST_NORMAL; + GLuint i; LOCAL_VARS; (void) flags; - + (void) cullmask; - for (i=0;i<count;i++, NEXT_NORMAL) { + for (i=0; i<count; i++,NEXT_NORMAL) { CHECK { + CUR_NORMAL; texcoord[i][0] = normal[0]; texcoord[i][1] = normal[1]; texcoord[i][2] = normal[2]; @@ -412,7 +408,10 @@ static void TAG(texgen)( struct vertex_buffer *VB, GLuint textureUnit ) const GLfloat *normal = FIRST_NORMAL; for (i=0;i<count;i++, NEXT_NORMAL) { - CHECK texcoord[i][0] = normal[0]; + CHECK { + CUR_NORMAL; + texcoord[i][0] = normal[0]; + } } break; } @@ -443,7 +442,10 @@ static void TAG(texgen)( struct vertex_buffer *VB, GLuint textureUnit ) case GL_NORMAL_MAP_NV: { const GLfloat *normal = FIRST_NORMAL; for (i=0;i<count;i++, NEXT_NORMAL) { - CHECK texcoord[i][1] = normal[1]; + CHECK { + CUR_NORMAL; + texcoord[i][1] = normal[1]; + } } break; } @@ -470,7 +472,10 @@ static void TAG(texgen)( struct vertex_buffer *VB, GLuint textureUnit ) case GL_NORMAL_MAP_NV: { const GLfloat *normal = FIRST_NORMAL; for (i=0;i<count;i++,NEXT_NORMAL) { - CHECK texcoord[i][2] = normal[2]; + CHECK { + CUR_NORMAL; + texcoord[i][2] = normal[2]; + } } break; } @@ -508,6 +513,7 @@ static void TAG(init_texgen)( void ) #undef CULL #undef FIRST_NORMAL #undef NEXT_NORMAL +#undef CUR_NORMAL #undef LOCAL_VARS #undef CHECK diff --git a/xc/extras/Mesa/src/texture.c b/xc/extras/Mesa/src/texture.c index 2b8a57668..0c5b974e5 100644 --- a/xc/extras/Mesa/src/texture.c +++ b/xc/extras/Mesa/src/texture.c @@ -79,41 +79,42 @@ typedef void (*build_f_func)( GLfloat *f, * gains to texture generation, but it is still necessary to cope * with the two different formats. */ +#define IDX 0 #define TAG(x) x #define FIRST_NORMAL normals->start +#define CUR_NORMAL (void) normal #define NEXT_NORMAL STRIDE_F(normal, normals->stride) +#define CHECK #define LOCAL_VARS -#define CHECK -#define IDX 0 #include "texgen_tmp.h" +#define IDX 2 #define TAG(x) x##_compacted #define FIRST_NORMAL normals->start -#define NEXT_NORMAL ((flags[i]&VERT_NORM) ? (normal=first_normal[i]) : (normal)) -#define CHECK -#define IDX 2 -#define LOCAL_VARS \ - GLfloat (*first_normal)[3] = (GLfloat (*)[3]) FIRST_NORMAL; - +#define CUR_NORMAL ((flags[i]&VERT_NORM) ? normal=normal_ptr : normal) +#define NEXT_NORMAL STRIDE_F(normal_ptr, normals->stride) +#define CHECK +#define LOCAL_VARS GLfloat *normal_ptr = FIRST_NORMAL; #include "texgen_tmp.h" + +#define IDX 1 #define TAG(x) x##_masked #define FIRST_NORMAL normals->start +#define CUR_NORMAL (void) normal #define NEXT_NORMAL STRIDE_F(normal, normals->stride) -#define LOCAL_VARS #define CHECK if (cullmask[i]) -#define IDX 1 +#define LOCAL_VARS #include "texgen_tmp.h" +#define IDX 3 #define TAG(x) x##_compacted_masked #define FIRST_NORMAL normals->start -#define NEXT_NORMAL ((flags[i]&VERT_NORM) ? normal=first_normal[i] : 0) +#define CUR_NORMAL ((flags[i]&VERT_NORM) ? normal=normal_ptr : normal) +#define NEXT_NORMAL STRIDE_F(normal_ptr, normals->stride) #define CHECK if (cullmask[i]) -#define IDX 3 -#define LOCAL_VARS \ - GLfloat (*first_normal)[3] = (GLfloat (*)[3]) FIRST_NORMAL; - +#define LOCAL_VARS GLfloat *normal_ptr = FIRST_NORMAL; #include "texgen_tmp.h" @@ -2228,15 +2229,15 @@ _mesa_texture_combine(const GLcontext *ctx, */ RGBshift = 6; for (i = 0; i < n; i++) { - GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - 128, - (GLint)arg1[i][RCOMP] - 128) + - S_PROD((GLint)arg0[i][GCOMP] - 128, - (GLint)arg1[i][GCOMP] - 128) + - S_PROD((GLint)arg0[i][BCOMP] - 128, - (GLint)arg1[i][BCOMP] - 128)) >> RGBshift; - rgba[i][RCOMP] = (GLubyte) CLAMP(dot, 0, 255); - rgba[i][GCOMP] = (GLubyte) CLAMP(dot, 0, 255); - rgba[i][BCOMP] = (GLubyte) CLAMP(dot, 0, 255); + GLuint dot = (PROD(arg0[i][RCOMP] - 128, + arg1[i][RCOMP] - 128) + + PROD(arg0[i][GCOMP] - 128, + arg1[i][GCOMP] - 128) + + PROD(arg0[i][BCOMP] - 128, + arg1[i][BCOMP] - 128)) >> RGBshift; + rgba[i][RCOMP] = (GLubyte) MIN2(dot, 255); + rgba[i][GCOMP] = (GLubyte) MIN2(dot, 255); + rgba[i][BCOMP] = (GLubyte) MIN2(dot, 255); } } break; diff --git a/xc/extras/Mesa/src/varray.h b/xc/extras/Mesa/src/varray.h index 468e511fc..68dbc6238 100644 --- a/xc/extras/Mesa/src/varray.h +++ b/xc/extras/Mesa/src/varray.h @@ -138,4 +138,9 @@ extern void gl_exec_array_elements( GLcontext *ctx, extern void gl_update_client_state( GLcontext *ctx ); +#ifdef VAO +struct gl_array_object * +_mesa_alloc_vertex_array_object(GLcontext *ctx, GLuint name); +#endif + #endif diff --git a/xc/extras/freetype2/builds/cygwin/mkinstalldirs b/xc/extras/freetype2/builds/cygwin/mkinstalldirs index ef1ca1707..484d125ea 100644 --- a/xc/extras/freetype2/builds/cygwin/mkinstalldirs +++ b/xc/extras/freetype2/builds/cygwin/mkinstalldirs @@ -4,7 +4,7 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.2 2001/01/05 22:57:50 kem Exp $ +# $Id: mkinstalldirs,v 1.3 2001/01/08 16:21:35 nathanh Exp $ errstatus=0 diff --git a/xc/extras/freetype2/builds/unix/mkinstalldirs b/xc/extras/freetype2/builds/unix/mkinstalldirs index ef1ca1707..484d125ea 100755 --- a/xc/extras/freetype2/builds/unix/mkinstalldirs +++ b/xc/extras/freetype2/builds/unix/mkinstalldirs @@ -4,7 +4,7 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.2 2001/01/05 22:57:50 kem Exp $ +# $Id: mkinstalldirs,v 1.3 2001/01/08 16:21:35 nathanh Exp $ errstatus=0 diff --git a/xc/extras/ogl-sample/main/doc/man/manglw/Distfile b/xc/extras/ogl-sample/main/doc/man/manglw/Distfile index 5b89e629e..a66ef4718 100755 --- a/xc/extras/ogl-sample/main/doc/man/manglw/Distfile +++ b/xc/extras/ogl-sample/main/doc/man/manglw/Distfile @@ -1,6 +1,6 @@ # -# $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/Distfile,v 1.2 2001/01/05 22:57:51 kem Exp $ +# $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/Distfile,v 1.3 2001/01/08 16:21:35 nathanh Exp $ # DISTDIR_SI = /xc/doc/man/GL/glw diff --git a/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile b/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile index 225c7ce39..a976daa42 100755 --- a/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile +++ b/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile @@ -32,8 +32,8 @@ # published by SGI, but has not been independently verified as being # compliant with the OpenGL(R) version 1.2.1 Specification. # -# $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/GNUmakefile,v 1.2 2001/01/05 22:57:51 kem Exp $ +# $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/GNUmakefile,v 1.3 2001/01/08 16:21:35 nathanh Exp $ COMMONPREF = standard include $(ROOT)/usr/include/make/commondefs diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile b/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile index 499529b90..8e48861fa 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile @@ -1,6 +1,6 @@ # -# $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/Distfile,v 1.2 2001/01/05 22:57:51 kem Exp $ +# $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/Distfile,v 1.3 2001/01/08 16:21:35 nathanh Exp $ # DISTFILES_SI = \ diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c index cd85dbb18..3c4565df3 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c @@ -31,13 +31,13 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ */ /* utility routines for GLX. * Since these routines are used both in the Motif and X versions of * the widget, they cannot peek directly into the structure * - * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDAUtil.c,v 1.2 2001/01/05 22:57:51 kem Exp $ + * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDAUtil.c,v 1.3 2001/01/08 16:21:35 nathanh Exp $ */ /* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c,v 1.2 2000/11/02 20:39:06 dawes Exp $ */ diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c index 350c0f7c7..1b8150366 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.c,v 1.2 2001/01/05 22:57:51 kem Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.c,v 1.3 2001/01/08 16:21:35 nathanh Exp $ */ #include <stdio.h> diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h index 67753b0c1..28da64bfd 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.h,v 1.2 2001/01/05 22:57:51 kem Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.h,v 1.3 2001/01/08 16:21:35 nathanh Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h index a80d36d48..61b905e48 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawAP.h,v 1.2 2001/01/05 22:57:51 kem Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawAP.h,v 1.3 2001/01/08 16:21:35 nathanh Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c index ea89e957d..49d1c594f 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.c,v 1.2 2001/01/05 22:57:51 kem Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.c,v 1.3 2001/01/08 16:21:35 nathanh Exp $ */ #ifndef __GLX_MOTIF diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h index d6136c6af..9d32d4043 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.h,v 1.2 2001/01/05 22:57:51 kem Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.h,v 1.3 2001/01/08 16:21:35 nathanh Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h index 8be9a431a..e565e4a69 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawAP.h,v 1.2 2001/01/05 22:57:51 kem Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawAP.h,v 1.3 2001/01/08 16:21:35 nathanh Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile b/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile index a943a5889..46e50e442 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile @@ -32,8 +32,8 @@ # published by SGI, but has not been independently verified as being # compliant with the OpenGL(R) version 1.2.1 Specification. # -# $Date: 2001/01/05 22:57:51 $ $Revision: 1.2 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GNUmakefile,v 1.2 2001/01/05 22:57:51 kem Exp $ +# $Date: 2001/01/08 16:21:35 $ $Revision: 1.3 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GNUmakefile,v 1.3 2001/01/08 16:21:35 nathanh Exp $ include $(ROOT)/usr/include/make/commondefs diff --git a/xc/include/GL/glx.h b/xc/include/GL/glx.h index ac7284edc..12ac361ed 100644 --- a/xc/include/GL/glx.h +++ b/xc/include/GL/glx.h @@ -1,11 +1,10 @@ #ifndef __GLX_glx_h__ #define __GLX_glx_h__ -/* $XFree86: xc/include/GL/glx.h,v 1.7 2000/06/30 18:27:00 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.0 (the "License"), the contents of this +** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 @@ -34,6 +33,9 @@ ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** $Date: 2001/01/08 16:21:35 $ $Revision: 1.10 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glx.h,v 1.10 2001/01/08 16:21:35 nathanh Exp $ */ #include <X11/Xlib.h> diff --git a/xc/include/GL/glxmd.h b/xc/include/GL/glxmd.h index 9b634840e..7f9074aa3 100644 --- a/xc/include/GL/glxmd.h +++ b/xc/include/GL/glxmd.h @@ -1,26 +1,41 @@ #ifndef _GLX_glxmd_h_ #define _GLX_glxmd_h_ -/* $XFree86: xc/include/GL/glxmd.h,v 1.2 1999/06/14 07:23:28 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glxmd.h,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ /* diff --git a/xc/include/GL/glxproto.h b/xc/include/GL/glxproto.h index a6659cde1..2dfabfd92 100644 --- a/xc/include/GL/glxproto.h +++ b/xc/include/GL/glxproto.h @@ -1,47 +1,75 @@ #ifndef _GLX_glxproto_h_ #define _GLX_glxproto_h_ -/* $XFree86: xc/include/GL/glxproto.h,v 1.2 1999/06/14 07:23:29 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glxproto.h,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ -#include "GL/glxmd.h" +#include "glxmd.h" /*****************************************************************************/ /* ** Errrors. -*/ -#define GLXBadContext 0 +*/ +#define GLXBadContext 0 #define GLXBadContextState 1 #define GLXBadDrawable 2 #define GLXBadPixmap 3 #define GLXBadContextTag 4 #define GLXBadCurrentWindow 5 -#define GLXBadRenderRequest 6 -#define GLXBadLargeRequest 7 +#define GLXBadRenderRequest 6 +#define GLXBadLargeRequest 7 #define GLXUnsupportedPrivateRequest 8 +#define GLXBadFBConfig 9 +#define GLXBadPbuffer 10 +#define GLXBadCurrentDrawable 11 +#define GLXBadWindow 12 + +#define __GLX_NUMBER_ERRORS 12 + +/* +** Events. +** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX +** event - this helps initialization if the server supports the pbuffer +** extension and the client doesn't. +*/ +#define GLX_PbufferClobber 0 -#define __GLX_NUMBER_ERRORS 8 -#define __GLX_NUMBER_EVENTS 1 +#define __GLX_NUMBER_EVENTS 17 #define GLX_EXTENSION_NAME "GLX" #define GLX_EXTENSION_ALIAS "SGI-GLX" @@ -62,6 +90,11 @@ #define GLXContextID CARD32 #define GLXPixmap CARD32 #define GLXDrawable CARD32 +#define GLXPbuffer CARD32 +#define GLXWindow CARD32 +#define GLXFBConfigID CARD32 +#define GLXFBConfigIDSGIX CARD32 +#define GLXPbufferSGIX CARD32 /* ** ContextTag is not exposed to the API. @@ -106,7 +139,7 @@ typedef struct GLXRender { /* ** Large render command request. A single large rendering command -** is output in multiple X extension requests. The first packet +** is output in multiple X extension requests. The first packet ** contains an opcode dependent header (see below) that describes ** the data that follows. */ @@ -122,7 +155,7 @@ typedef struct GLXRenderLarge { #define sz_xGLXRenderLargeReq 16 /* -** GLX single request. Commands that go over as single GLX protocol +** GLX single request. Commands that go over as single GLX protocol ** requests use this structure. The glxCode will be one of the X_GLsop ** opcodes. */ @@ -192,7 +225,7 @@ typedef struct GLXMakeCurrent { CARD8 reqType; CARD8 glxCode; CARD16 length B16; - GLXDrawable drawable B32; + GLXDrawable drawable B32; GLXContextID context B32; GLXContextTag oldContextTag B32; } xGLXMakeCurrentReq; @@ -242,7 +275,7 @@ typedef struct GLXSwapBuffers { CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; - GLXDrawable drawable B32; + GLXDrawable drawable B32; } xGLXSwapBuffersReq; #define sz_xGLXSwapBuffersReq 12 @@ -331,10 +364,10 @@ typedef struct GLXVendorPrivateWithReply { ** glXQueryExtensionsString request */ typedef struct GLXQueryExtensionsString { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 screen B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; } xGLXQueryExtensionsStringReq; #define sz_xGLXQueryExtensionsStringReq 8 @@ -342,11 +375,11 @@ typedef struct GLXQueryExtensionsString { ** glXQueryServerString request */ typedef struct GLXQueryServerString { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 screen B32; - CARD32 name B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + CARD32 name B32; } xGLXQueryServerStringReq; #define sz_xGLXQueryServerStringReq 12 @@ -354,29 +387,174 @@ typedef struct GLXQueryServerString { ** glXClientInfo request */ typedef struct GLXClientInfo { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 major B32; - CARD32 minor B32; - CARD32 numbytes B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 major B32; + CARD32 minor B32; + CARD32 numbytes B32; } xGLXClientInfoReq; #define sz_xGLXClientInfoReq 16 +/*** Start of GLX 1.3 requests */ + /* -** glXQueryContextInfoEXT request +** glXGetFBConfigs request */ -typedef struct GLXQueryContextInfoEXT { +typedef struct GLXGetFBConfigs { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; +} xGLXGetFBConfigsReq; +#define sz_xGLXGetFBConfigsReq 8 + +/* +** glXCreatePixmap request +*/ +typedef struct GLXCreatePixmap { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + CARD32 pixmap B32; + GLXPixmap glxpixmap B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreatePixmapReq; +#define sz_xGLXCreatePixmapReq 24 + +/* +** glXDestroyPixmap request +*/ +typedef struct GLXDestroyPixmap { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXPixmap glxpixmap B32; +} xGLXDestroyPixmapReq; +#define sz_xGLXDestroyPixmapReq 8 + +/* +** glXCreateNewContext request +*/ +typedef struct GLXCreateNewContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; - CARD32 vendorCode B32; /* vendor-specific opcode */ - CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXContextID context B32; -} xGLXQueryContextInfoEXTReq; -#define sz_xGLXQueryContextInfoEXTReq 16 + GLXFBConfigID fbconfig B32; + CARD32 screen B32; + CARD32 renderType; + GLXContextID shareList B32; + BOOL isDirect; + CARD8 reserved1; + CARD16 reserved2 B16; +} xGLXCreateNewContextReq; +#define sz_xGLXCreateNewContextReq 28 -/************************************************************************/ +/* +** glXQueryContext request +*/ +typedef struct GLXQueryContext { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXContextID context B32; +} xGLXQueryContextReq; +#define sz_xGLXQueryContextReq 8 + +/* +** glXMakeContextCurrent request +*/ +typedef struct GLXMakeContextCurrent { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXContextTag oldContextTag B32; + GLXDrawable drawable B32; + GLXDrawable readdrawable B32; + GLXContextID context B32; +} xGLXMakeContextCurrentReq; +#define sz_xGLXMakeContextCurrentReq 20 + +/* +** glXCreatePbuffer request +*/ +typedef struct GLXCreatePbuffer { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + GLXPbuffer pbuffer B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreatePbufferReq; +#define sz_xGLXCreatePbufferReq 20 + +/* +** glXDestroyPbuffer request +*/ +typedef struct GLXDestroyPbuffer { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXPbuffer pbuffer B32; +} xGLXDestroyPbufferReq; +#define sz_xGLXDestroyPbufferReq 8 + +/* +** glXGetDrawableAttributes request +*/ +typedef struct GLXGetDrawableAttributes { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXDrawable drawable B32; +} xGLXGetDrawableAttributesReq; +#define sz_xGLXGetDrawableAttributesReq 8 + +/* +** glXChangeDrawableAttributes request +*/ +typedef struct GLXChangeDrawableAttributes { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXDrawable drawable B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXChangeDrawableAttributesReq; +#define sz_xGLXChangeDrawableAttributesReq 12 + +/* +** glXCreateWindow request +*/ +typedef struct GLXCreateWindow { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + CARD32 window B32; + GLXWindow glxwindow B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreateWindowReq; +#define sz_xGLXCreateWindowReq 24 + +/* +** glXDestroyWindow request +*/ +typedef struct GLXDestroyWindow { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXWindow glxwindow B32; +} xGLXDestroyWindowReq; +#define sz_xGLXDestroyWindowReq 8 /* Replies */ @@ -431,7 +609,7 @@ typedef struct { CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; - CARD32 pad5 B32; + CARD32 depth B32; CARD32 pad6 B32; } xGLXGetTexImageReply; #define sz_xGLXGetTexImageReply 32 @@ -441,6 +619,62 @@ typedef struct { CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 height B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetSeparableFilterReply; +#define sz_xGLXGetSeparableFilterReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 height B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetConvolutionFilterReply; +#define sz_xGLXGetConvolutionFilterReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetHistogramReply; +#define sz_xGLXGetHistogramReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetMinmaxReply; +#define sz_xGLXGetMinmaxReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 newMode B32; @@ -520,16 +754,16 @@ typedef struct { ** the number of words of data which follow the header. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 retval B32; - CARD32 size B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 retval B32; + CARD32 size B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXVendorPrivReply; #define sz_xGLXVendorPrivReply 32 @@ -538,16 +772,16 @@ typedef struct { ** n indicates the number of bytes to be returned. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad1 B32; - CARD32 n B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 n B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXQueryExtensionsStringReply; #define sz_xGLXQueryExtensionsStringReply 32 @@ -556,19 +790,142 @@ typedef struct { ** n indicates the number of bytes to be returned. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad1 B32; - CARD32 n B32; - CARD32 pad3 B32; /* NOTE: may hold a single value */ - CARD32 pad4 B32; /* NOTE: may hold half a double */ - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 n B32; + CARD32 pad3 B32; /* NOTE: may hold a single value */ + CARD32 pad4 B32; /* NOTE: may hold half a double */ + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXQueryServerStringReply; #define sz_xGLXQueryServerStringReply 32 +/*** Start of GLX 1.3 replies */ + +/* +** glXGetFBConfigs reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 numFBConfigs B32; + CARD32 numAttribs B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetFBConfigsReply; +#define sz_xGLXGetFBConfigsReply 32 + +/* +** glXQueryContext reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 n B32; /* number of attribute/value pairs */ + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXQueryContextReply; +#define sz_xGLXQueryContextReply 32 + +/* +** glXMakeContextCurrent reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + GLXContextTag contextTag B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXMakeContextCurrentReply; +#define sz_xGLXMakeContextCurrentReply 32 + +/* +** glXCreateGLXPbuffer reply +** This is used only in the direct rendering case on SGIs - otherwise +** CreateGLXPbuffer has no reply. It is not part of GLX 1.3. +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 success; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXCreateGLXPbufferReply; +#define sz_xGLXCreateGLXPbufferReply 32 + +/* +** glXGetDrawableAttributes reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 numAttribs B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetDrawableAttributesReply; +#define sz_xGLXGetDrawableAttributesReply 32 + +/* +** glXGetColorTable reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetColorTableReply; +#define sz_xGLXGetColorTableReply 32 + +/************************************************************************/ + +/* GLX extension requests and replies */ + +/* +** glXQueryContextInfoEXT request +*/ +typedef struct GLXQueryContextInfoEXT { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 vendorCode B32; /* vendor-specific opcode */ + CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ + GLXContextID context B32; +} xGLXQueryContextInfoEXTReq; +#define sz_xGLXQueryContextInfoEXTReq 16 + /* ** glXQueryContextInfoEXT reply */ @@ -577,7 +934,7 @@ typedef struct { CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; - CARD32 n B32; /* number of attribute/value pairs */ + CARD32 n B32; /* number of attribute/value pairs */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; @@ -589,6 +946,29 @@ typedef struct { /************************************************************************/ /* +** Events +*/ + +typedef struct { + BYTE type; + BYTE pad; + CARD16 sequenceNumber B16; + CARD16 event_type B16; /*** was clobber_class */ + CARD16 draw_type B16; + CARD32 drawable B32; + CARD32 buffer_mask B32; /*** was mask */ + CARD16 aux_buffer B16; + CARD16 x B16; + CARD16 y B16; + CARD16 width B16; + CARD16 height B16; + CARD16 count B16; + CARD32 unused2 B32; +} xGLXPbufferClobberEvent; + +/************************************************************************/ + +/* ** Size of the standard X request header. */ #define __GLX_SINGLE_HDR_SIZE sz_xGLXSingleReq @@ -617,7 +997,8 @@ typedef struct { /* ** The glBitmap, glPolygonStipple, glTexImage[12]D, glTexSubImage[12]D ** and glDrawPixels calls all have a pixel header transmitted after the -** Render or RenderLarge header and before their own opcode specific headers. +** Render or RenderLarge header and before their own opcode specific +** headers. */ #define __GLX_PIXEL_HDR \ BOOL swapBytes; \ @@ -626,7 +1007,7 @@ typedef struct { CARD8 reserved1; \ CARD32 rowLength B32; \ CARD32 skipRows B32; \ - CARD32 skipPixels B32; \ + CARD32 skipPixels B32; \ CARD32 alignment B32 #define __GLX_PIXEL_HDR_SIZE 20 @@ -636,6 +1017,27 @@ typedef struct { } __GLXpixelHeader; /* +** glTexImage[34]D and glTexSubImage[34]D calls +** all have a pixel header transmitted after the Render or RenderLarge +** header and before their own opcode specific headers. +*/ +#define __GLX_PIXEL_3D_HDR \ + BOOL swapBytes; \ + BOOL lsbFirst; \ + CARD8 reserved0; \ + CARD8 reserved1; \ + CARD32 rowLength B32; \ + CARD32 imageHeight B32; \ + CARD32 imageDepth B32; \ + CARD32 skipRows B32; \ + CARD32 skipImages B32; \ + CARD32 skipVolumes B32; \ + CARD32 skipPixels B32; \ + CARD32 alignment B32 + +#define __GLX_PIXEL_3D_HDR_SIZE 36 + +/* ** Data that is specific to a glBitmap call. The data is sent in the ** following order: ** Render or RenderLarge header @@ -683,19 +1085,18 @@ typedef struct { #define __GLX_POLYGONSTIPPLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE) - /* ** Data that is specific to a glTexImage1D or glTexImage2D call. The ** data is sent in the following order: -** Render or RenderLarge header -** Pixel header -** TexImage header +** Render or RenderLarge header +** Pixel header +** TexImage header ** When a glTexImage1D call the height field is unexamined by the server. */ #define __GLX_TEXIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ - CARD32 components B32; \ + CARD32 components B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 border B32; \ @@ -728,12 +1129,62 @@ typedef struct { } __GLXdispatchTexImageHeader; /* -** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The +** Data that is specific to a glTexImage3D or glTexImage4D call. The ** data is sent in the following order: -** Render or RenderLarge header -** Pixel header -** TexSubImage header -** When a glTexSubImage1D call is made, the yoffset and height fields +** Render or RenderLarge header +** Pixel 3D header +** TexImage 3D header +** When a glTexImage3D call the size4d and woffset fields are unexamined +** by the server. +** Could be used by all TexImage commands and perhaps should be in the +** future. +*/ +#define __GLX_TEXIMAGE_3D_HDR \ + CARD32 target B32; \ + CARD32 level B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 depth B32; \ + CARD32 size4d B32; \ + CARD32 border B32; \ + CARD32 format B32; \ + CARD32 type B32; \ + CARD32 nullimage B32 + +#define __GLX_TEXIMAGE_3D_HDR_SIZE 44 + +#define __GLX_TEXIMAGE_3D_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ + __GLX_TEXIMAGE_3D_HDR_SIZE) + +#define __GLX_TEXIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXIMAGE_3D_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXtexImage3DHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXtexImage3DLargeHeader; + +typedef struct { + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXdispatchTexImage3DHeader; + +/* +** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The +** data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** TexSubImage header +** When a glTexSubImage1D call is made, the yoffset and height fields ** are unexamined by the server and are considered to be padding. */ #define __GLX_TEXSUBIMAGE_HDR \ @@ -773,11 +1224,61 @@ typedef struct { } __GLXdispatchTexSubImageHeader; /* +** Data that is specific to a glTexSubImage3D and 4D calls. The +** data is sent in the following order: +** Render or RenderLarge header +** Pixel 3D header +** TexSubImage 3D header +** When a glTexSubImage3D call is made, the woffset and size4d fields +** are unexamined by the server and are considered to be padding. +*/ +#define __GLX_TEXSUBIMAGE_3D_HDR \ + CARD32 target B32; \ + CARD32 level B32; \ + CARD32 xoffset B32; \ + CARD32 yoffset B32; \ + CARD32 zoffset B32; \ + CARD32 woffset B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 depth B32; \ + CARD32 size4d B32; \ + CARD32 format B32; \ + CARD32 type B32; \ + CARD32 nullImage \ + +#define __GLX_TEXSUBIMAGE_3D_HDR_SIZE 52 + +#define __GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) + +#define __GLX_TEXSUBIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXtexSubImage3DHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXtexSubImage3DLargeHeader; + +typedef struct { + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXdispatchTexSubImage3DHeader; + +/* ** Data that is specific to a glDrawPixels call. The data is sent in the ** following order: ** Render or RenderLarge header ** Pixel header -** Bitmap header +** DrawPixels header */ #define __GLX_DRAWPIXELS_HDR \ CARD32 width B32; \ @@ -811,6 +1312,46 @@ typedef struct { } __GLXdispatchDrawPixelsHeader; /* +** Data that is specific to a glConvolutionFilter1D or glConvolutionFilter2D +** call. The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ConvolutionFilter header +** When a glConvolutionFilter1D call the height field is unexamined by the server. +*/ +#define __GLX_CONV_FILT_HDR \ + CARD32 target B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_CONV_FILT_HDR_SIZE 24 + +#define __GLX_CONV_FILT_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) + +#define __GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXConvolutionFilterHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXConvolutionFilterLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXdispatchConvolutionFilterHeader; + +/* ** Data that is specific to a glDrawArraysEXT call. The data is sent in the ** following order: ** Render or RenderLarge header @@ -822,7 +1363,7 @@ typedef struct { #define __GLX_DRAWARRAYS_HDR \ CARD32 numVertexes B32; \ CARD32 numComponents B32; \ - CARD32 primType B32 + CARD32 primType B32 #define __GLX_DRAWARRAYS_HDR_SIZE 12 @@ -846,7 +1387,7 @@ typedef struct { #define __GLX_COMPONENT_HDR \ CARD32 datatype B32; \ INT32 numVals B32; \ - CARD32 component B32 + CARD32 component B32 typedef struct { __GLX_COMPONENT_HDR; @@ -854,6 +1395,81 @@ typedef struct { #define __GLX_COMPONENT_HDR_SIZE 12 +/* +** Data that is specific to a glColorTable call +** The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ColorTable header +*/ + +#define __GLX_COLOR_TABLE_HDR \ + CARD32 target B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_COLOR_TABLE_HDR_SIZE 20 + +#define __GLX_COLOR_TABLE_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_COLOR_TABLE_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXColorTableHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXColorTableLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXdispatchColorTableHeader; + +/* +** Data that is specific to a glColorSubTable call +** The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ColorTable header +*/ + +#define __GLX_COLOR_SUBTABLE_HDR \ + CARD32 target B32; \ + CARD32 start B32; \ + CARD32 count B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_COLOR_SUBTABLE_HDR_SIZE 20 + +#define __GLX_COLOR_SUBTABLE_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + \ + __GLX_COLOR_SUBTABLE_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXColorSubTableHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXColorSubTableLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXdispatchColorSubTableHeader; + /*****************************************************************************/ @@ -863,6 +1479,11 @@ typedef struct { #undef GLXContextID #undef GLXPixmap #undef GLXDrawable +#undef GLXPbuffer +#undef GLXWindow +#undef GLXFBConfigID +#undef GLXFBConfigIDSGIX +#undef GLXPbufferSGIX /* Opcodes for GLX commands */ @@ -933,6 +1554,23 @@ typedef struct { #define X_GLsop_GetTexLevelParameteriv 139 #define X_GLsop_IsEnabled 140 #define X_GLsop_IsList 141 +#define X_GLsop_AreTexturesResident 143 +#define X_GLsop_DeleteTextures 144 +#define X_GLsop_GenTextures 145 +#define X_GLsop_IsTexture 146 +#define X_GLsop_GetColorTable 147 +#define X_GLsop_GetColorTableParameterfv 148 +#define X_GLsop_GetColorTableParameteriv 149 +#define X_GLsop_GetConvolutionFilter 150 +#define X_GLsop_GetConvolutionParameterfv 151 +#define X_GLsop_GetConvolutionParameteriv 152 +#define X_GLsop_GetSeparableFilter 153 +#define X_GLsop_GetHistogram 154 +#define X_GLsop_GetHistogramParameterfv 155 +#define X_GLsop_GetHistogramParameteriv 156 +#define X_GLsop_GetMinmax 157 +#define X_GLsop_GetMinmaxParameterfv 158 +#define X_GLsop_GetMinmaxParameteriv 159 /* Opcodes for rendering commands */ @@ -1127,8 +1765,8 @@ typedef struct { #define X_GLrop_Translated 189 #define X_GLrop_Translatef 190 #define X_GLrop_Viewport 191 -#define X_GLrop_DrawArrays 4116 -#define X_GLrop_PolygonOffset 4098 +#define X_GLrop_DrawArrays 193 +#define X_GLrop_PolygonOffset 192 #define X_GLrop_CopyTexImage1D 4119 #define X_GLrop_CopyTexImage2D 4120 #define X_GLrop_CopyTexSubImage1D 4121 @@ -1138,14 +1776,56 @@ typedef struct { #define X_GLrop_BindTexture 4117 #define X_GLrop_PrioritizeTextures 4118 #define X_GLrop_Indexubv 194 +#define X_GLrop_BlendColor 4096 +#define X_GLrop_BlendEquation 4097 +#define X_GLrop_ColorTable 2053 +#define X_GLrop_ColorTableParameterfv 2054 +#define X_GLrop_ColorTableParameteriv 2055 +#define X_GLrop_CopyColorTable 2056 +#define X_GLrop_ColorSubTable 195 +#define X_GLrop_CopyColorSubTable 196 +#define X_GLrop_ConvolutionFilter1D 4101 +#define X_GLrop_ConvolutionFilter2D 4102 +#define X_GLrop_ConvolutionParameterf 4103 +#define X_GLrop_ConvolutionParameterfv 4104 +#define X_GLrop_ConvolutionParameteri 4105 +#define X_GLrop_ConvolutionParameteriv 4106 +#define X_GLrop_CopyConvolutionFilter1D 4107 +#define X_GLrop_CopyConvolutionFilter2D 4108 +#define X_GLrop_SeparableFilter2D 4109 +#define X_GLrop_Histogram 4110 +#define X_GLrop_Minmax 4111 +#define X_GLrop_ResetHistogram 4112 +#define X_GLrop_ResetMinmax 4113 +#define X_GLrop_TexImage3D 4114 +#define X_GLrop_TexSubImage3D 4115 +#define X_GLrop_CopyTexSubImage3D 4123 +#define X_GLrop_ActiveTextureARB 197 +#define X_GLrop_MultiTexCoord1dvARB 198 +#define X_GLrop_MultiTexCoord1fvARB 199 +#define X_GLrop_MultiTexCoord1ivARB 200 +#define X_GLrop_MultiTexCoord1svARB 201 +#define X_GLrop_MultiTexCoord2dvARB 202 +#define X_GLrop_MultiTexCoord2fvARB 203 +#define X_GLrop_MultiTexCoord2ivARB 204 +#define X_GLrop_MultiTexCoord2svARB 205 +#define X_GLrop_MultiTexCoord3dvARB 206 +#define X_GLrop_MultiTexCoord3fvARB 207 +#define X_GLrop_MultiTexCoord3ivARB 208 +#define X_GLrop_MultiTexCoord3svARB 209 +#define X_GLrop_MultiTexCoord4dvARB 210 +#define X_GLrop_MultiTexCoord4fvARB 211 +#define X_GLrop_MultiTexCoord4ivARB 212 +#define X_GLrop_MultiTexCoord4svARB 213 +#define X_GLrop_DrawArraysEXT 4116 /* Opcodes for Vendor Private commands */ -#define X_GLvop_AreTexturesResident 11 -#define X_GLvop_DeleteTextures 12 -#define X_GLvop_GenTextures 13 -#define X_GLvop_IsTexture 14 +#define X_GLvop_AreTexturesResidentEXT 11 +#define X_GLvop_DeleteTexturesEXT 12 +#define X_GLvop_GenTexturesEXT 13 +#define X_GLvop_IsTextureEXT 14 /* Opcodes for GLX vendor private commands */ diff --git a/xc/include/GL/glxtokens.h b/xc/include/GL/glxtokens.h index 8c4f2185a..146ea2974 100644 --- a/xc/include/GL/glxtokens.h +++ b/xc/include/GL/glxtokens.h @@ -1,11 +1,10 @@ #ifndef __GLX_glxtokens_h__ #define __GLX_glxtokens_h__ -/* $XFree86: xc/include/GL/glxtokens.h,v 1.4 2000/06/17 00:02:46 martin Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.0 (the "License"), the contents of this +** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 @@ -34,6 +33,9 @@ ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.7 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glxtokens.h,v 1.7 2001/01/08 16:21:36 nathanh Exp $ */ #ifdef __cplusplus @@ -223,7 +225,6 @@ extern "C" { #define GLX_EXT_visual_rating 1 #define GLX_ARB_get_proc_address 1 - #ifdef __cplusplus } #endif diff --git a/xc/lib/GL/dri/drm/Imakefile b/xc/lib/GL/dri/drm/Imakefile index 65085e090..f4401b274 100644 --- a/xc/lib/GL/dri/drm/Imakefile +++ b/xc/lib/GL/dri/drm/Imakefile @@ -33,6 +33,9 @@ OS_SUBDIR = cygwin OS_SUBDIR2 = cygwin #endif +LinkSourceFile(xf86drm.h,$(XF86OSSRC)) +LinkSourceFile(xf86drmR128.h,$(XF86OSSRC)) + LinkSourceFile(xf86drm.c,$(XF86OSSRC)/$(OS_SUBDIR)/drm) LinkSourceFile(xf86drmHash.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) diff --git a/xc/lib/GL/glx/clientattrib.c b/xc/lib/GL/glx/clientattrib.c index 0e23c09ad..7e0684ddf 100644 --- a/xc/lib/GL/glx/clientattrib.c +++ b/xc/lib/GL/glx/clientattrib.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/clientattrib.c,v 1.4 2000/02/18 16:23:09 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.5 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/clientattrib.c,v 1.5 2001/01/08 16:21:36 nathanh Exp $ */ #include <assert.h> @@ -32,22 +47,22 @@ void glEnableClientState(GLenum array) switch (array) { case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_TRUE; + gc->state.vertArray.color.enable = GL_TRUE; break; case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_TRUE; + gc->state.vertArray.edgeFlag.enable = GL_TRUE; break; case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_TRUE; + gc->state.vertArray.index.enable = GL_TRUE; break; case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_TRUE; + gc->state.vertArray.normal.enable = GL_TRUE; break; case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_TRUE; + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_TRUE; break; case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_TRUE; + gc->state.vertArray.vertex.enable = GL_TRUE; break; default: __glXSetError(gc, GL_INVALID_ENUM); @@ -60,22 +75,22 @@ void glDisableClientState(GLenum array) switch (array) { case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_FALSE; + gc->state.vertArray.color.enable = GL_FALSE; break; case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_FALSE; + gc->state.vertArray.edgeFlag.enable = GL_FALSE; break; case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_FALSE; + gc->state.vertArray.index.enable = GL_FALSE; break; case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_FALSE; + gc->state.vertArray.normal.enable = GL_FALSE; break; case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_FALSE; + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_FALSE; break; case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_FALSE; + gc->state.vertArray.vertex.enable = GL_FALSE; break; default: __glXSetError(gc, GL_INVALID_ENUM); diff --git a/xc/lib/GL/glx/compsize.c b/xc/lib/GL/glx/compsize.c index cf5de61bb..4dff51b62 100644 --- a/xc/lib/GL/glx/compsize.c +++ b/xc/lib/GL/glx/compsize.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/compsize.c,v 1.2 1999/06/14 07:23:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/compsize.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ #include <GL/gl.h> @@ -106,15 +121,36 @@ GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } @@ -154,11 +190,19 @@ GLint __glTexParameterfv_size(GLenum e) switch (e) { case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: return 1; case GL_TEXTURE_BORDER_COLOR: return 4; + case GL_TEXTURE_PRIORITY: + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; default: return 0; } @@ -226,15 +270,36 @@ GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } @@ -282,21 +347,121 @@ GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } return (elements * esize * w * h); } +GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d) +{ + GLint elements, esize; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (d * (h * ((w+7)/8))); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return (elements * esize * w * h * d); +} + GLint __glLightfv_size(GLenum pname) { switch (pname) { @@ -326,6 +491,7 @@ GLint __glLightModelfv_size(GLenum pname) case GL_LIGHT_MODEL_AMBIENT: return 4; case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1; case GL_LIGHT_MODEL_TWO_SIDE: return 1; + case GL_LIGHT_MODEL_COLOR_CONTROL: return 1; default: return 0; } @@ -356,3 +522,46 @@ GLint __glMaterialiv_size(GLenum pname) return __glMaterialfv_size(pname); } +GLint __glColorTableParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return -1; + } +} + +GLint __glColorTableParameteriv_size(GLenum pname) +{ + return __glColorTableParameterfv_size(pname); +} + +GLint __glConvolutionParameterfv_size(GLenum pname) +{ + switch(pname) { + case GL_CONVOLUTION_BORDER_MODE: + return 1; + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + default: /* error: bad enum value */ + return -1; + } +} + +GLint __glConvolutionParameteriv_size(GLenum pname) +{ + return __glConvolutionParameterfv_size(pname); +} diff --git a/xc/lib/GL/glx/eval.c b/xc/lib/GL/glx/eval.c index ca4f54ce5..2b57fdb2a 100644 --- a/xc/lib/GL/glx/eval.c +++ b/xc/lib/GL/glx/eval.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/eval.c,v 1.2 1999/06/14 07:23:35 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/eval.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/g_render.c b/xc/lib/GL/glx/g_render.c index b9f37c171..7f61e7b26 100644 --- a/xc/lib/GL/glx/g_render.c +++ b/xc/lib/GL/glx/g_render.c @@ -1,21 +1,30 @@ -/* $XFree86: xc/lib/GL/glx/g_render.c,v 1.2 1999/06/14 07:23:35 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packrender.h" @@ -2803,3 +2812,586 @@ void glIndexubv(const GLubyte *c) __GLX_END(8); } +void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_BlendColor,20); + __GLX_PUT_FLOAT(4,red); + __GLX_PUT_FLOAT(8,green); + __GLX_PUT_FLOAT(12,blue); + __GLX_PUT_FLOAT(16,alpha); + __GLX_END(20); +} + +void glBlendEquation(GLenum mode) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_BlendEquation,8); + __GLX_PUT_LONG(4,mode); + __GLX_END(8); +} + +void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glColorTableParameterfv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ColorTableParameterfv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glColorTableParameteriv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ColorTableParameteriv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyColorTable,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyColorSubTable,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,start); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ConvolutionParameterf,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT(12,params); + __GLX_END(16); +} + +void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glConvolutionParameterfv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ConvolutionParameterfv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glConvolutionParameteri(GLenum target, GLenum pname, GLint params) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ConvolutionParameteri,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG(12,params); + __GLX_END(16); +} + +void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glConvolutionParameteriv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ConvolutionParameteriv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyConvolutionFilter1D,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyConvolutionFilter2D,28); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_PUT_LONG(24,height); + __GLX_END(28); +} + +void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_Histogram,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,internalformat); + __GLX_PUT_CHAR(16,sink); + __GLX_END(20); +} + +void glMinmax(GLenum target, GLenum internalformat, GLboolean sink) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_Minmax,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_CHAR(12,sink); + __GLX_END(16); +} + +void glResetHistogram(GLenum target) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ResetHistogram,8); + __GLX_PUT_LONG(4,target); + __GLX_END(8); +} + +void glResetMinmax(GLenum target) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ResetMinmax,8); + __GLX_PUT_LONG(4,target); + __GLX_END(8); +} + +void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyTexSubImage3D,40); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,level); + __GLX_PUT_LONG(12,xoffset); + __GLX_PUT_LONG(16,yoffset); + __GLX_PUT_LONG(20,zoffset); + __GLX_PUT_LONG(24,x); + __GLX_PUT_LONG(28,y); + __GLX_PUT_LONG(32,width); + __GLX_PUT_LONG(36,height); + __GLX_END(40); +} + +void glActiveTextureARB(GLenum texture) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ActiveTextureARB,8); + __GLX_PUT_LONG(4,texture); + __GLX_END(8); +} + +void glMultiTexCoord1dARB(GLenum target, GLdouble s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1dvARB,16); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_LONG(12,target); + __GLX_END(16); +} + +void glMultiTexCoord1dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1dvARB,16); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_LONG(12,target); + __GLX_END(16); +} + +void glMultiTexCoord1fARB(GLenum target, GLfloat s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1fvARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1fvARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord1iARB(GLenum target, GLint s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1ivARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1ivARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord1sARB(GLenum target, GLshort s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2dvARB,24); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_LONG(20,target); + __GLX_END(24); +} + +void glMultiTexCoord2dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2dvARB,24); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_LONG(20,target); + __GLX_END(24); +} + +void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2fvARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_END(16); +} + +void glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2fvARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_END(16); +} + +void glMultiTexCoord2iARB(GLenum target, GLint s, GLint t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2ivARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_END(16); +} + +void glMultiTexCoord2ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2ivARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_END(16); +} + +void glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_END(12); +} + +void glMultiTexCoord2svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_END(12); +} + +void glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3dvARB,32); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_DOUBLE(20,r); + __GLX_PUT_LONG(28,target); + __GLX_END(32); +} + +void glMultiTexCoord3dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3dvARB,32); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_DOUBLE(20,v[2]); + __GLX_PUT_LONG(28,target); + __GLX_END(32); +} + +void glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3fvARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_PUT_FLOAT(16,r); + __GLX_END(20); +} + +void glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3fvARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_PUT_FLOAT(16,v[2]); + __GLX_END(20); +} + +void glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3ivARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_PUT_LONG(16,r); + __GLX_END(20); +} + +void glMultiTexCoord3ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3ivARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_PUT_LONG(16,v[2]); + __GLX_END(20); +} + +void glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_PUT_SHORT(12,r); + __GLX_END(16); +} + +void glMultiTexCoord3svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_PUT_SHORT(12,v[2]); + __GLX_END(16); +} + +void glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4dvARB,40); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_DOUBLE(20,r); + __GLX_PUT_DOUBLE(28,q); + __GLX_PUT_LONG(36,target); + __GLX_END(40); +} + +void glMultiTexCoord4dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4dvARB,40); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_DOUBLE(20,v[2]); + __GLX_PUT_DOUBLE(28,v[3]); + __GLX_PUT_LONG(36,target); + __GLX_END(40); +} + +void glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4fvARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_PUT_FLOAT(16,r); + __GLX_PUT_FLOAT(20,q); + __GLX_END(24); +} + +void glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4fvARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_PUT_FLOAT(16,v[2]); + __GLX_PUT_FLOAT(20,v[3]); + __GLX_END(24); +} + +void glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4ivARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_PUT_LONG(16,r); + __GLX_PUT_LONG(20,q); + __GLX_END(24); +} + +void glMultiTexCoord4ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4ivARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_PUT_LONG(16,v[2]); + __GLX_PUT_LONG(20,v[3]); + __GLX_END(24); +} + +void glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_PUT_SHORT(12,r); + __GLX_PUT_SHORT(14,q); + __GLX_END(16); +} + +void glMultiTexCoord4svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_PUT_SHORT(12,v[2]); + __GLX_PUT_SHORT(14,v[3]); + __GLX_END(16); +} + diff --git a/xc/lib/GL/glx/g_single.c b/xc/lib/GL/glx/g_single.c index b41865ef0..4488e559e 100644 --- a/xc/lib/GL/glx/g_single.c +++ b/xc/lib/GL/glx/g_single.c @@ -1,21 +1,30 @@ -/* $XFree86: xc/lib/GL/glx/g_single.c,v 1.2 1999/06/14 07:23:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packsingle.h" @@ -417,3 +426,237 @@ GLboolean glIsList(GLuint list) return retval; } +/* + * Somewhere between GLX 1.2 and 1.3 (in SGI's code anyway) the + * protocol for glAreTexturesResident, glDeleteTextures, glGenTextures, + * and glIsTexture() was changed. Before, calls to these functions + * generated protocol for the old GL_EXT_texture_object versions of those + * calls. In the newer code, this is actually corrected; calls to the + * 1.1 functions generate 1.1 protocol and calls to the EXT functions + * generate EXT protocol. + * Unfortunately, this correction causes an incompatibility. Specifically, + * an updated libGL.so will send protocol requests that the server won't + * be able to handle. For example, calling glGenTextures will generate a + * BadRequest error. + * For now, we'll keep generating EXT protocol from libGL. We'll update + * the server to understand both the 1.1 and EXT protocol ASAP. At some point + * in the future we'll correct libGL.so as well. That should be a smoother + * transition path. + */ + +GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + GLboolean retval = 0; + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + if (n < 0) return retval; + cmdlen = 4+n*4; + __GLX_SINGLE_BEGIN(X_GLsop_AreTexturesResident,cmdlen); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_PUT_LONG_ARRAY(4,textures,n); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_RETVAL(retval, GLboolean); + __GLX_SINGLE_GET_CHAR_ARRAY(residences,n); + __GLX_SINGLE_END(); + return retval; +#else + return glAreTexturesResidentEXT(n, textures, residences); +#endif +} + +void glDeleteTextures(GLsizei n, const GLuint *textures) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + __GLX_SINGLE_LOAD_VARIABLES(); + if (n < 0) return; + cmdlen = 4+n*4; + __GLX_SINGLE_BEGIN(X_GLsop_DeleteTextures,cmdlen); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_PUT_LONG_ARRAY(4,textures,n); + __GLX_SINGLE_END(); +#else + glDeleteTexturesEXT(n, textures); +#endif +} + +void glGenTextures(GLsizei n, GLuint *textures) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GenTextures,4); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_LONG_ARRAY(textures,n); + __GLX_SINGLE_END(); +#else + glGenTexturesEXT(n, textures); +#endif +} + +GLboolean glIsTexture(GLuint texture) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + GLboolean retval = 0; + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_IsTexture,4); + __GLX_SINGLE_PUT_LONG(0,texture); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_RETVAL(retval, GLboolean); + __GLX_SINGLE_END(); + return retval; +#else + return glIsTextureEXT(texture); +#endif +} + +void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTableParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTableParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogramParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogramParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmaxParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmaxParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + diff --git a/xc/lib/GL/glx/g_vendpriv.c b/xc/lib/GL/glx/g_vendpriv.c index b178ab811..b3258e9dc 100644 --- a/xc/lib/GL/glx/g_vendpriv.c +++ b/xc/lib/GL/glx/g_vendpriv.c @@ -1,26 +1,35 @@ -/* $XFree86: xc/lib/GL/glx/g_vendpriv.c,v 1.2 1999/06/14 07:23:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packvendpriv.h" -GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) +GLboolean glAreTexturesResidentEXT(GLsizei n, const GLuint *textures, GLboolean *residences) { __GLX_VENDPRIV_DECLARE_VARIABLES(); GLboolean retval = 0; @@ -28,7 +37,7 @@ GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *re __GLX_VENDPRIV_LOAD_VARIABLES(); if (n < 0) return retval; cmdlen = 4+n*4; - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_AreTexturesResident,cmdlen); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_AreTexturesResidentEXT,cmdlen); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_PUT_LONG_ARRAY(4,textures,n); __GLX_VENDPRIV_READ_XREPLY(); @@ -38,37 +47,37 @@ GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *re return retval; } -void glDeleteTextures(GLsizei n, const GLuint *textures) +void glDeleteTexturesEXT(GLsizei n, const GLuint *textures) { __GLX_VENDPRIV_DECLARE_VARIABLES(); __GLX_VENDPRIV_LOAD_VARIABLES(); if (n < 0) return; cmdlen = 4+n*4; - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivate,X_GLvop_DeleteTextures,cmdlen); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivate,X_GLvop_DeleteTexturesEXT,cmdlen); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_PUT_LONG_ARRAY(4,textures,n); __GLX_VENDPRIV_END(); } -void glGenTextures(GLsizei n, GLuint *textures) +void glGenTexturesEXT(GLsizei n, GLuint *textures) { __GLX_VENDPRIV_DECLARE_VARIABLES(); xGLXVendorPrivReply reply; __GLX_VENDPRIV_LOAD_VARIABLES(); - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_GenTextures,4); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_GenTexturesEXT,4); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_VENDPRIV_READ_XREPLY(); __GLX_VENDPRIV_GET_LONG_ARRAY(textures,n); __GLX_VENDPRIV_END(); } -GLboolean glIsTexture(GLuint texture) +GLboolean glIsTextureEXT(GLuint texture) { __GLX_VENDPRIV_DECLARE_VARIABLES(); GLboolean retval = 0; xGLXVendorPrivReply reply; __GLX_VENDPRIV_LOAD_VARIABLES(); - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_IsTexture,4); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_IsTextureEXT,4); __GLX_VENDPRIV_PUT_LONG(0,texture); __GLX_VENDPRIV_READ_XREPLY(); __GLX_VENDPRIV_GET_RETVAL(retval, GLboolean); diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h index f89c1b58a..1ad952931 100644 --- a/xc/lib/GL/glx/glxclient.h +++ b/xc/lib/GL/glx/glxclient.h @@ -1,22 +1,39 @@ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.13 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/glxclient.h,v 1.13 2001/01/08 16:21:36 nathanh Exp $ */ /* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.11 2000/12/07 20:26:03 dawes Exp $ */ @@ -32,12 +49,11 @@ #define _GLX_client_h_ #define NEED_REPLIES #define NEED_EVENTS -#include <string.h> -#include <stdlib.h> #include <X11/Xproto.h> #include <X11/Xlibint.h> -#include <GL/gl.h> #include <GL/glx.h> +#include <string.h> +#include <stdlib.h> #include "glxint.h" #include "glxproto.h" #include "glapitable.h" @@ -54,6 +70,8 @@ #define __GL_BOOLEAN_ARRAY (GL_BYTE - 1) +#define __GLX_MAX_TEXTURE_UNITS 32 + typedef struct __GLXcontextRec __GLXcontext; typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate; typedef struct _glapi_table __GLapi; @@ -211,55 +229,34 @@ typedef struct __GLXpixelStoreModeRec { GLboolean swapEndian; GLboolean lsbFirst; GLuint rowLength; + GLuint imageHeight; + GLuint imageDepth; GLuint skipRows; GLuint skipPixels; + GLuint skipImages; GLuint alignment; } __GLXpixelStoreMode; +typedef struct __GLXvertexArrayPointerStateRec { + GLboolean enable; + void (*proc)(const void *); + const GLubyte *ptr; + GLsizei skip; + GLint size; + GLenum type; + GLsizei stride; +} __GLXvertexArrayPointerState; + typedef struct __GLXvertArrayStateRec { - GLboolean vertexEnable; - void (*vertexCall)(const char *); - const char *vertexPtr; - GLsizei vertexSkip; - GLint vertexSize; - GLenum vertexType; - GLsizei vertexStride; - - GLboolean normalEnable; - void (*normalCall)(const char *); - const char *normalPtr; - GLsizei normalSkip; - GLenum normalType; - GLsizei normalStride; - - GLboolean colorEnable; - void (*colorCall)(const char *); - const char *colorPtr; - GLsizei colorSkip; - GLint colorSize; - GLenum colorType; - GLsizei colorStride; - - GLboolean indexEnable; - void (*indexCall)(const char *); - const char *indexPtr; - GLsizei indexSkip; - GLenum indexType; - GLsizei indexStride; - - GLboolean texCoordEnable; - void (*texCoordCall)(const char *); - const char *texCoordPtr; - GLsizei texCoordSkip; - GLint texCoordSize; - GLenum texCoordType; - GLsizei texCoordStride; - - GLboolean edgeFlagEnable; - void (*edgeFlagCall)(const GLboolean *); - GLsizei edgeFlagSkip; - const GLboolean *edgeFlagPtr; - GLsizei edgeFlagStride; + __GLXvertexArrayPointerState vertex; + __GLXvertexArrayPointerState normal; + __GLXvertexArrayPointerState color; + __GLXvertexArrayPointerState index; + __GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS]; + __GLXvertexArrayPointerState edgeFlag; + GLint maxElementsVertices; + GLint maxElementsIndices; + GLint activeTexture; } __GLXvertArrayState; typedef struct __GLXattributeRec { @@ -370,8 +367,8 @@ struct __GLXcontextRec { ** Fill newImage with the unpacked form of oldImage getting it ** ready for transport to the server. */ - void (*fillImage)(__GLXcontext*, GLint, GLint, GLenum, GLenum, - const GLvoid*, GLubyte*, GLubyte*); + void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLvoid*, GLubyte*, GLubyte*); /* ** Client side attribs. @@ -587,7 +584,7 @@ extern CARD8 __glXSetupForCommand(Display *dpy); */ /* Return the size, in bytes, of some pixel data */ -extern GLint __glImageSize(GLint, GLint, GLenum, GLenum); +extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum); /* Return the k value for a given map target */ extern GLint __glEvalComputeK(GLenum); @@ -599,10 +596,8 @@ extern GLint __glEvalComputeK(GLenum); ** updated to contain the modes needed by the server to decode the ** sent data. */ -extern void __glFillImage(__GLXcontext*, GLint, GLint, - GLenum, GLenum, - const GLvoid*, GLubyte*, - GLubyte*); +extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLvoid*, GLubyte*, GLubyte*); /* Copy map data with a stride into a packed buffer */ extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *); @@ -616,8 +611,8 @@ extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint, ** Empty an image out of the reply buffer into the clients memory applying ** the pack modes to pack back into the clients requested format. */ -extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLenum, - GLenum, const GLubyte *, GLvoid *); +extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLubyte *, GLvoid *); /* @@ -637,6 +632,10 @@ extern void __glXClientInfo ( Display *dpy, int opcode ); ** is illegal these procedures return 0. */ extern GLint __glCallLists_size(GLint, GLenum); +extern GLint __glColorTableParameterfv_size(GLenum); +extern GLint __glColorTableParameteriv_size(GLenum); +extern GLint __glConvolutionParameterfv_size(GLenum); +extern GLint __glConvolutionParameteriv_size(GLenum); extern GLint __glDrawPixels_size(GLenum, GLenum, GLint, GLint); extern GLint __glReadPixels_size(GLenum, GLenum, GLint, GLint); extern GLint __glLightModelfv_size(GLenum); @@ -649,6 +648,7 @@ extern GLint __glFogfv_size(GLenum); extern GLint __glFogiv_size(GLenum); extern GLint __glTexImage1D_size(GLenum, GLenum, GLint); extern GLint __glTexImage2D_size(GLenum, GLenum, GLint, GLint); +extern GLint __glTexImage3D_size(GLenum, GLenum, GLint, GLint, GLint); extern GLint __glTexEnvfv_size(GLenum); extern GLint __glTexEnviv_size(GLenum); extern GLint __glTexGenfv_size(GLenum); diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index d89bac9ee..bca7173f9 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -1,56 +1,67 @@ /* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.13 2000/11/13 23:31:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.19 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/glxcmds.c,v 1.19 2001/01/08 16:21:36 nathanh Exp $ */ -/* - * Direct rendering support added by Precision Insight, Inc. - * - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Brian Paul <brian@precisioninsight.com> - */ - #include "packsingle.h" #include "glxclient.h" #include <extutil.h> #include <Xext.h> -#include <string.h> +#include <strings.h> #include "glapi.h" #ifdef GLX_DIRECT_RENDERING #include "indirect_init.h" #endif -static const char GL_ClientExtensions[] = - "GL_EXT_abgr " - "GL_EXT_blend_color " - "GL_EXT_blend_minmax " - "GL_EXT_blend_subtract " ; - -static const char GLXClientVendorName[] = "SGI"; -static const char GLXClientVersion[] = "1.2"; -static const char GLXClientExtensions[] = - "GLX_EXT_visual_info " - "GLX_EXT_visual_rating " - "GLX_EXT_import_context " - "GLX_ARB_get_proc_address "; +static const char __glXGLClientExtensions[] = + "GL_ARB_multitexture " + "GL_ARB_imaging " + "GL_EXT_abgr " + "GL_EXT_blend_color " + "GL_EXT_blend_minmax " + "GL_EXT_blend_subtract " + ; + +static const char __glXGLXClientVendorName[] = "SGI"; +static const char __glXGLXClientVersion[] = "1.2"; +static const char __glXGLXClientExtensions[] = + "GLX_EXT_visual_info " + "GLX_EXT_visual_rating " + "GLX_EXT_import_context " + ; /* ** Create a new context. @@ -1275,7 +1286,7 @@ const char *glXQueryExtensionsString( Display *dpy, int screen ) psc->serverGLXexts = QueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); } - psc->effectiveGLXexts = combine_strings(GLXClientExtensions, + psc->effectiveGLXexts = combine_strings(__glXGLXClientExtensions, psc->serverGLXexts); } @@ -1286,11 +1297,11 @@ const char *glXGetClientString( Display *dpy, int name ) { switch(name) { case GLX_VENDOR: - return (GLXClientVendorName); + return (__glXGLXClientVendorName); case GLX_VERSION: - return (GLXClientVersion); + return (__glXGLXClientVersion); case GLX_EXTENSIONS: - return (GLXClientExtensions); + return (__glXGLXClientExtensions); default: return NULL; } @@ -1363,10 +1374,10 @@ void __glXClientInfo ( Display *dpy, int opcode ) req->major = GLX_MAJOR_VERSION; req->minor = GLX_MINOR_VERSION; - size = strlen(GL_ClientExtensions) + 1; + size = strlen(__glXGLClientExtensions) + 1; req->length += (size + 3) >> 2; req->numbytes = size; - Data(dpy, GL_ClientExtensions, size); + Data(dpy, __glXGLClientExtensions, size); UnlockDisplay(dpy); SyncHandle(); diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c index 4e7f0dd60..9dfe5a1c2 100644 --- a/xc/lib/GL/glx/glxext.c +++ b/xc/lib/GL/glx/glxext.c @@ -1,38 +1,55 @@ /* $XFree86: xc/lib/GL/glx/glxext.c,v 1.9 2000/12/07 20:26:03 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.15 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/glxext.c,v 1.15 2001/01/08 16:21:36 nathanh Exp $ */ -/* - * Direct rendering support added by Precision Insight, Inc. - * - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * - */ +/* < + * Direct rendering support added by Precision Insight, Inc. < + * < + * Authors: < + * Kevin E. Martin <kevin@precisioninsight.com> < + * < + */ #include "packrender.h" +#include <stdio.h> #include <Xext.h> #include <extutil.h> #include <assert.h> -#include <stdio.h> #include "indirect_init.h" #include "glapi.h" #ifdef XTHREADS @@ -557,9 +574,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy) XAddToExtensionList(privList, private); if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) { -#if 0 __glXClientInfo(dpy, dpyPriv->majorOpcode); -#endif } __glXUnlock(); diff --git a/xc/lib/GL/glx/indirect.h b/xc/lib/GL/glx/indirect.h index 4e18e0cde..a88ece441 100644 --- a/xc/lib/GL/glx/indirect.h +++ b/xc/lib/GL/glx/indirect.h @@ -42,10 +42,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void __indirect_glAccum(GLenum op, GLfloat value); void __indirect_glAlphaFunc(GLenum func, GLclampf ref); GLboolean __indirect_glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences); +GLboolean __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint *textures, GLboolean *residences); void __indirect_glArrayElement(GLint i); void __indirect_glBegin(GLenum mode); void __indirect_glBindTexture(GLenum target, GLuint texture); void __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +void __indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +void __indirect_glBlendEquation(GLenum mode); void __indirect_glBlendFunc(GLenum sfactor, GLenum dfactor); void __indirect_glCallList(GLuint list); void __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid *lists); @@ -91,14 +94,30 @@ void __indirect_glColor4usv(const GLushort *v); void __indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void __indirect_glColorMaterial(GLenum face, GLenum mode); void __indirect_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table); +void __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +void __indirect_glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); +void __indirect_glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); +void __indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); +void __indirect_glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params); +void __indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params); +void __indirect_glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); +void __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +void __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +void __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +void __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); void __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); void __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); void __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); void __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); void __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +void __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); void __indirect_glCullFace(GLenum mode); void __indirect_glDeleteLists(GLuint list, GLsizei range); void __indirect_glDeleteTextures(GLsizei n, const GLuint *textures); +void __indirect_glDeleteTexturesEXT(GLsizei n, const GLuint *textures); void __indirect_glDepthFunc(GLenum func); void __indirect_glDepthMask(GLboolean flag); void __indirect_glDepthRange(GLclampd zNear, GLclampd zFar); @@ -108,6 +127,7 @@ void __indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count); void __indirect_glDrawBuffer(GLenum mode); void __indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); void __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); void __indirect_glEdgeFlag(GLboolean flag); void __indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer); void __indirect_glEdgeFlagv(const GLboolean *flag); @@ -138,11 +158,21 @@ void __indirect_glFrontFace(GLenum mode); void __indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); GLuint __indirect_glGenLists(GLsizei range); void __indirect_glGenTextures(GLsizei n, GLuint *textures); +void __indirect_glGenTexturesEXT(GLsizei n, GLuint *textures); void __indirect_glGetBooleanv(GLenum val, GLboolean *b); void __indirect_glGetClipPlane(GLenum plane, GLdouble *equation); +void __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table); +void __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params); +void __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); +void __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetDoublev(GLenum val, GLdouble *d); GLenum __indirect_glGetError(void); void __indirect_glGetFloatv(GLenum val, GLfloat *f); +void __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetIntegerv(GLenum val, GLint *i); void __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat *params); void __indirect_glGetLightiv(GLenum light, GLenum pname, GLint *params); @@ -151,12 +181,16 @@ void __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat *v); void __indirect_glGetMapiv(GLenum target, GLenum query, GLint *v); void __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); void __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint *params); +void __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetPixelMapfv(GLenum map, GLfloat *values); void __indirect_glGetPixelMapuiv(GLenum map, GLuint *values); void __indirect_glGetPixelMapusv(GLenum map, GLushort *values); void __indirect_glGetPointerv(GLenum pname, void **params); void __indirect_glGetPolygonStipple(GLubyte *mask); const GLubyte *__indirect_glGetString(GLenum name); +void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); void __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params); void __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params); @@ -168,6 +202,7 @@ void __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pnam void __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params); void __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glHint(GLenum target, GLenum mode); +void __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); void __indirect_glIndexMask(GLuint mask); void __indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer); void __indirect_glIndexd(GLdouble c); @@ -185,6 +220,7 @@ void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid GLboolean __indirect_glIsEnabled(GLenum cap); GLboolean __indirect_glIsList(GLuint list); GLboolean __indirect_glIsTexture(GLuint texture); +GLboolean __indirect_glIsTextureEXT(GLuint texture); void __indirect_glLightModelf(GLenum pname, GLfloat param); void __indirect_glLightModelfv(GLenum pname, const GLfloat *params); void __indirect_glLightModeli(GLenum pname, GLint param); @@ -214,6 +250,7 @@ void __indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params); void __indirect_glMateriali(GLenum face, GLenum pname, GLint param); void __indirect_glMaterialiv(GLenum face, GLenum pname, const GLint *params); void __indirect_glMatrixMode(GLenum mode); +void __indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink); void __indirect_glMultMatrixd(const GLdouble *m); void __indirect_glMultMatrixf(const GLfloat *m); void __indirect_glNewList(GLuint list, GLenum mode); @@ -286,12 +323,15 @@ void __indirect_glRectiv(const GLint *v1, const GLint *v2); void __indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2); void __indirect_glRectsv(const GLshort *v1, const GLshort *v2); GLint __indirect_glRenderMode(GLenum mode); +void __indirect_glResetHistogram(GLenum target); +void __indirect_glResetMinmax(GLenum target); void __indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); void __indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); void __indirect_glScaled(GLdouble x, GLdouble y, GLdouble z); void __indirect_glScalef(GLfloat x, GLfloat y, GLfloat z); void __indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height); void __indirect_glSelectBuffer(GLsizei numnames, GLuint *buffer); +void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); void __indirect_glShadeModel(GLenum mode); void __indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask); void __indirect_glStencilMask(GLuint mask); @@ -341,12 +381,14 @@ void __indirect_glTexGeni(GLenum coord, GLenum pname, GLint param); void __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint *params); void __indirect_glTexImage1D(GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexImage2D(GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param); void __indirect_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params); void __indirect_glTexParameteri(GLenum target, GLenum pname, GLint param); void __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint *params); void __indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z); void __indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z); void __indirect_glVertex2d(GLdouble x, GLdouble y); @@ -376,4 +418,41 @@ void __indirect_glVertex4sv(const GLshort *v); void __indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); void __indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + +void __indirect_glActiveTextureARB(GLenum texture); +void __indirect_glClientActiveTextureARB(GLenum texture); +void __indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s); +void __indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s); +void __indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord1iARB(GLenum target, GLint s); +void __indirect_glMultiTexCoord1ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord1sARB(GLenum target, GLshort s); +void __indirect_glMultiTexCoord1svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +void __indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +void __indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +void __indirect_glMultiTexCoord2ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +void __indirect_glMultiTexCoord2svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +void __indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +void __indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +void __indirect_glMultiTexCoord3ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +void __indirect_glMultiTexCoord3svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +void __indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +void __indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +void __indirect_glMultiTexCoord4ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +void __indirect_glMultiTexCoord4svARB(GLenum target, const GLshort *v); + + #endif /* _INDIRECT_H_ */ diff --git a/xc/lib/GL/glx/indirect_init.c b/xc/lib/GL/glx/indirect_init.c index 3d631bee6..89a53f0d1 100644 --- a/xc/lib/GL/glx/indirect_init.c +++ b/xc/lib/GL/glx/indirect_init.c @@ -140,6 +140,7 @@ __GLapi *__glXNewIndirectAPI(void) glAPI->DrawBuffer = __indirect_glDrawBuffer; glAPI->DrawElements = __indirect_glDrawElements; glAPI->DrawPixels = __indirect_glDrawPixels; + glAPI->DrawRangeElements = __indirect_glDrawRangeElements; glAPI->EdgeFlag = __indirect_glEdgeFlag; glAPI->EdgeFlagPointer = __indirect_glEdgeFlagPointer; glAPI->EdgeFlagv = __indirect_glEdgeFlagv; @@ -408,5 +409,83 @@ __GLapi *__glXNewIndirectAPI(void) glAPI->VertexPointer = __indirect_glVertexPointer; glAPI->Viewport = __indirect_glViewport; + /* 1.2 */ + glAPI->CopyTexSubImage3D = __indirect_glCopyTexSubImage3D; + glAPI->DrawRangeElements = __indirect_glDrawRangeElements; + glAPI->TexImage3D = __indirect_glTexImage3D; + glAPI->TexSubImage3D = __indirect_glTexSubImage3D; + + /* OpenGL 1.2 GL_ARB_imaging */ + glAPI->BlendColor = __indirect_glBlendColor; + glAPI->BlendEquation = __indirect_glBlendEquation; + glAPI->ColorSubTable = __indirect_glColorSubTable; + glAPI->ColorTable = __indirect_glColorTable; + glAPI->ColorTableParameterfv = __indirect_glColorTableParameterfv; + glAPI->ColorTableParameteriv = __indirect_glColorTableParameteriv; + glAPI->ConvolutionFilter1D = __indirect_glConvolutionFilter1D; + glAPI->ConvolutionFilter2D = __indirect_glConvolutionFilter2D; + glAPI->ConvolutionParameterf = __indirect_glConvolutionParameterf; + glAPI->ConvolutionParameterfv = __indirect_glConvolutionParameterfv; + glAPI->ConvolutionParameteri = __indirect_glConvolutionParameteri; + glAPI->ConvolutionParameteriv = __indirect_glConvolutionParameteriv; + glAPI->CopyColorSubTable = __indirect_glCopyColorSubTable; + glAPI->CopyColorTable = __indirect_glCopyColorTable; + glAPI->CopyConvolutionFilter1D = __indirect_glCopyConvolutionFilter1D; + glAPI->CopyConvolutionFilter2D = __indirect_glCopyConvolutionFilter2D; + glAPI->GetColorTable = __indirect_glGetColorTable; + glAPI->GetColorTableParameterfv = __indirect_glGetColorTableParameterfv; + glAPI->GetColorTableParameteriv = __indirect_glGetColorTableParameteriv; + glAPI->GetConvolutionFilter = __indirect_glGetConvolutionFilter; + glAPI->GetConvolutionParameterfv = __indirect_glGetConvolutionParameterfv; + glAPI->GetConvolutionParameteriv = __indirect_glGetConvolutionParameteriv; + glAPI->GetHistogram = __indirect_glGetHistogram; + glAPI->GetHistogramParameterfv = __indirect_glGetHistogramParameterfv; + glAPI->GetHistogramParameteriv = __indirect_glGetHistogramParameteriv; + glAPI->GetMinmax = __indirect_glGetMinmax; + glAPI->GetMinmaxParameterfv = __indirect_glGetMinmaxParameterfv; + glAPI->GetMinmaxParameteriv = __indirect_glGetMinmaxParameteriv; + glAPI->GetSeparableFilter = __indirect_glGetSeparableFilter; + glAPI->Histogram = __indirect_glHistogram; + glAPI->Minmax = __indirect_glMinmax; + glAPI->ResetHistogram = __indirect_glResetHistogram; + glAPI->ResetMinmax = __indirect_glResetMinmax; + glAPI->SeparableFilter2D = __indirect_glSeparableFilter2D; + + /* ARB 1. GL_ARB_multitexture */ + glAPI->ActiveTextureARB = __indirect_glActiveTextureARB; + glAPI->ClientActiveTextureARB = __indirect_glClientActiveTextureARB; + glAPI->MultiTexCoord1dARB = __indirect_glMultiTexCoord1dARB; + glAPI->MultiTexCoord1dvARB = __indirect_glMultiTexCoord1dvARB; + glAPI->MultiTexCoord1fARB = __indirect_glMultiTexCoord1fARB; + glAPI->MultiTexCoord1fvARB = __indirect_glMultiTexCoord1fvARB; + glAPI->MultiTexCoord1iARB = __indirect_glMultiTexCoord1iARB; + glAPI->MultiTexCoord1ivARB = __indirect_glMultiTexCoord1ivARB; + glAPI->MultiTexCoord1sARB = __indirect_glMultiTexCoord1sARB; + glAPI->MultiTexCoord1svARB = __indirect_glMultiTexCoord1svARB; + glAPI->MultiTexCoord2dARB = __indirect_glMultiTexCoord2dARB; + glAPI->MultiTexCoord2dvARB = __indirect_glMultiTexCoord2dvARB; + glAPI->MultiTexCoord2fARB = __indirect_glMultiTexCoord2fARB; + glAPI->MultiTexCoord2fvARB = __indirect_glMultiTexCoord2fvARB; + glAPI->MultiTexCoord2iARB = __indirect_glMultiTexCoord2iARB; + glAPI->MultiTexCoord2ivARB = __indirect_glMultiTexCoord2ivARB; + glAPI->MultiTexCoord2sARB = __indirect_glMultiTexCoord2sARB; + glAPI->MultiTexCoord2svARB = __indirect_glMultiTexCoord2svARB; + glAPI->MultiTexCoord3dARB = __indirect_glMultiTexCoord3dARB; + glAPI->MultiTexCoord3dvARB = __indirect_glMultiTexCoord3dvARB; + glAPI->MultiTexCoord3fARB = __indirect_glMultiTexCoord3fARB; + glAPI->MultiTexCoord3fvARB = __indirect_glMultiTexCoord3fvARB; + glAPI->MultiTexCoord3iARB = __indirect_glMultiTexCoord3iARB; + glAPI->MultiTexCoord3ivARB = __indirect_glMultiTexCoord3ivARB; + glAPI->MultiTexCoord3sARB = __indirect_glMultiTexCoord3sARB; + glAPI->MultiTexCoord3svARB = __indirect_glMultiTexCoord3svARB; + glAPI->MultiTexCoord4dARB = __indirect_glMultiTexCoord4dARB; + glAPI->MultiTexCoord4dvARB = __indirect_glMultiTexCoord4dvARB; + glAPI->MultiTexCoord4fARB = __indirect_glMultiTexCoord4fARB; + glAPI->MultiTexCoord4fvARB = __indirect_glMultiTexCoord4fvARB; + glAPI->MultiTexCoord4iARB = __indirect_glMultiTexCoord4iARB; + glAPI->MultiTexCoord4ivARB = __indirect_glMultiTexCoord4ivARB; + glAPI->MultiTexCoord4sARB = __indirect_glMultiTexCoord4sARB; + glAPI->MultiTexCoord4svARB = __indirect_glMultiTexCoord4svARB; + return glAPI; } diff --git a/xc/lib/GL/glx/packrender.h b/xc/lib/GL/glx/packrender.h index cc699ada5..7806ea958 100644 --- a/xc/lib/GL/glx/packrender.h +++ b/xc/lib/GL/glx/packrender.h @@ -1,26 +1,41 @@ #ifndef __GLX_packrender_h__ #define __GLX_packrender_h__ -/* $XFree86: xc/lib/GL/glx/packrender.h,v 1.5 2000/02/18 16:23:10 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.6 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/packrender.h,v 1.6 2001/01/08 16:21:36 nathanh Exp $ */ #define NEED_GL_FUNCS_WRAPPED @@ -54,9 +69,9 @@ #define __GLX_LOAD_VARIABLES() \ gc = __glXGetCurrentContext(); \ pc = gc->pc; \ - (void) pixelHeaderPC; \ + (void) cmdlen; \ (void) compsize; \ - (void) cmdlen + (void) pixelHeaderPC /* ** Variable sized command support macro. This macro is used by calls @@ -95,6 +110,24 @@ pixelHeaderPC = pc; \ pc += __GLX_PIXEL_HDR_SIZE +#define __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(opcode,size) \ + if (pc + (size) > gc->bufEnd) { \ + pc = __glXFlushRenderBuffer(gc, pc); \ + } \ + __GLX_PUT_SHORT(0,size); \ + __GLX_PUT_SHORT(2,opcode); \ + pc += __GLX_RENDER_HDR_SIZE; \ + pixelHeaderPC = pc; \ + pc += __GLX_PIXEL_3D_HDR_SIZE + +#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(opcode,size) \ + pc = __glXFlushRenderBuffer(gc, pc); \ + __GLX_PUT_LONG(0,size); \ + __GLX_PUT_LONG(4,opcode); \ + pc += __GLX_RENDER_LARGE_HDR_SIZE; \ + pixelHeaderPC = pc; \ + pc += __GLX_PIXEL_3D_HDR_SIZE + /* ** Fixed size command support macro. This macro is used by calls that ** are never larger than __GLX_SMALL_RENDER_CMD_SIZE. Because they diff --git a/xc/lib/GL/glx/packsingle.h b/xc/lib/GL/glx/packsingle.h index f3195a274..2acb0946b 100644 --- a/xc/lib/GL/glx/packsingle.h +++ b/xc/lib/GL/glx/packsingle.h @@ -1,26 +1,41 @@ #ifndef __GLX_packsingle_h__ #define __GLX_packsingle_h__ -/* $XFree86: xc/lib/GL/glx/packsingle.h,v 1.4 2000/08/28 16:04:48 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.5 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/packsingle.h,v 1.5 2001/01/08 16:21:36 nathanh Exp $ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/packvendpriv.h b/xc/lib/GL/glx/packvendpriv.h index aa3cf8146..e8121c66a 100644 --- a/xc/lib/GL/glx/packvendpriv.h +++ b/xc/lib/GL/glx/packvendpriv.h @@ -1,26 +1,41 @@ #ifndef __GLX_packvendpriv_h__ #define __GLX_packvendpriv_h__ -/* $XFree86: xc/lib/GL/glx/packvendpriv.h,v 1.3 2000/02/08 17:18:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.4 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/packvendpriv.h,v 1.4 2001/01/08 16:21:36 nathanh Exp $ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/pixel.c b/xc/lib/GL/glx/pixel.c index a1dd3637c..728c1817a 100644 --- a/xc/lib/GL/glx/pixel.c +++ b/xc/lib/GL/glx/pixel.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/pixel.c,v 1.3 2000/02/08 17:18:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.4 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/pixel.c,v 1.4 2001/01/08 16:21:36 nathanh Exp $ */ #include "packrender.h" @@ -68,14 +83,38 @@ static GLubyte HighBitsMask[9] = { /* ** Return the number of elements per group of a specified format */ -static GLint ElementsPerGroup(GLenum format) +static GLint ElementsPerGroup(GLenum format, GLenum type) { + /* + ** To make row length computation valid for image extraction, + ** packed pixel types assume elements per group equals one. + */ + switch(type) { + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return 1; + default: + break; + } + switch(format) { case GL_RGB: + case GL_BGR: return 3; case GL_LUMINANCE_ALPHA: return 2; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: return 4; case GL_COLOR_INDEX: @@ -101,13 +140,25 @@ static GLint BytesPerElement(GLenum type) switch(type) { case GL_UNSIGNED_SHORT: case GL_SHORT: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: return 2; case GL_UNSIGNED_BYTE: case GL_BYTE: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: return 1; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: return 4; default: return 0; @@ -118,24 +169,25 @@ static GLint BytesPerElement(GLenum type) ** Compute memory required for internal packed array of data of given type ** and format. */ -GLint __glImageSize(GLsizei width, GLsizei height, GLenum format, GLenum type) +GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type) { int bytes_per_row; int components; - if (width < 0 || height < 0) { + if (width < 0 || height < 0 || depth < 0) { return 0; } /* ** Zero is returned if either format or type are invalid. */ - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (type == GL_BITMAP) { bytes_per_row = (width + 7) >> 3; } else { bytes_per_row = BytesPerElement(type) * width; } - return bytes_per_row * height * components; + return bytes_per_row * height * depth * components; } /* @@ -148,6 +200,7 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, GLubyte *destImage) { GLint rowLength = gc->state.storeUnpack.rowLength; + GLint imageHeight = gc->state.storeUnpack.imageHeight; GLint alignment = gc->state.storeUnpack.alignment; GLint skipPixels = gc->state.storeUnpack.skipPixels; GLint skipRows = gc->state.storeUnpack.skipRows; @@ -162,7 +215,7 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, } else { groupsPerRow = width; } - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,GL_BITMAP); rowSize = (groupsPerRow * components + 7) >> 3; padding = (rowSize % alignment); if (padding) { @@ -213,35 +266,43 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, start += rowSize; } } + /* ** Extract array from user's data applying all pixel store modes. ** The internal packed array format used has LSB_FIRST = FALSE and ** ALIGNMENT = 1. */ -void __glFillImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, - GLenum type, const GLvoid *userdata, GLubyte *newimage, - GLubyte *modes) +void __glFillImage(__GLXcontext *gc, GLint dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, + const GLvoid *userdata, GLubyte *newimage, GLubyte *modes) { GLint rowLength = gc->state.storeUnpack.rowLength; + GLint imageHeight = gc->state.storeUnpack.imageHeight; + GLint imageDepth = gc->state.storeUnpack.imageDepth; GLint alignment = gc->state.storeUnpack.alignment; GLint skipPixels = gc->state.storeUnpack.skipPixels; GLint skipRows = gc->state.storeUnpack.skipRows; + GLint skipImages = gc->state.storeUnpack.skipImages; GLint swapBytes = gc->state.storeUnpack.swapEndian; GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize; - GLint elementsPerRow, i, j, k; - const GLubyte *start, *iter; + GLint elementsPerRow, imageSize, rowsPerImage, h, i, j, k; + const GLubyte *start, *iter, *itera, *iterb, *iterc; GLubyte *iter2; if (type == GL_BITMAP) { - /* All formats except GL_BITMAP fall out trivially */ FillBitmap(gc, width, height, format, userdata, newimage); } else { - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = width; } + if (imageHeight > 0) { + rowsPerImage = imageHeight; + } else { + rowsPerImage = height; + } elementSize = BytesPerElement(type); groupSize = elementSize * components; @@ -252,50 +313,77 @@ void __glFillImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, if (padding) { rowSize += alignment - padding; } - start = ((const GLubyte*) userdata) + skipRows * rowSize - + skipPixels * groupSize; + imageSize = rowSize * rowsPerImage; + start = ((const GLubyte*) userdata) + skipImages * imageSize + + skipRows * rowSize + skipPixels * groupSize; iter2 = newimage; elementsPerRow = width * components; if (swapBytes) { - for (i = 0; i < height; i++) { - iter = start; - for (j = 0; j < elementsPerRow; j++) { - for (k = 1; k <= elementSize; k++) { - iter2[k-1] = iter[elementSize - k]; + itera = start; + for (h = 0; h < depth; h++) { + iterb = itera; + for (i = 0; i < height; i++) { + iterc = iterb; + for (j = 0; j < elementsPerRow; j++) { + for (k = 1; k <= elementSize; k++) { + iter2[k-1] = iterc[elementSize - k]; + } + iter2 += elementSize; + iterc += elementSize; } - iter2 += elementSize; - iter += elementSize; + iterb += rowSize; } - start += rowSize; + itera += imageSize; } } else { - if (rowSize == elementsPerRow * elementSize) { - /* Ha! This is mondo easy! */ - __GLX_MEM_COPY(iter2, start, - elementsPerRow * elementSize * height); - } else { - iter = start; - for (i = 0; i < height; i++) { - __GLX_MEM_COPY(iter2, iter, elementsPerRow * elementSize); - iter2 += elementsPerRow * elementSize; - iter += rowSize; + itera = start; + for (h = 0; h < depth; h++) { + if (rowSize == elementsPerRow * elementSize) { + /* Ha! This is mondo easy! */ + __GLX_MEM_COPY(iter2, itera, + elementsPerRow * elementSize * height); + iter2 += elementsPerRow * elementSize * height; + } else { + iter = itera; + for (i = 0; i < height; i++) { + __GLX_MEM_COPY(iter2, iter, elementsPerRow*elementSize); + iter2 += elementsPerRow * elementSize; + iter += rowSize; + } } - } + itera += imageSize; + } } } /* Setup store modes that describe what we just did */ if (modes) { - GLubyte *pc = modes; - __GLX_PUT_CHAR(0,GL_FALSE); - __GLX_PUT_CHAR(1,GL_FALSE); - __GLX_PUT_CHAR(2,0); - __GLX_PUT_CHAR(3,0); - __GLX_PUT_LONG(4,0); - __GLX_PUT_LONG(8,0); - __GLX_PUT_LONG(12,0); - __GLX_PUT_LONG(16,1); + if (dim == 3) { + GLubyte *pc = modes; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } else { + GLubyte *pc = modes; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } } } @@ -319,7 +407,7 @@ static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height, GLint writeMask, i; GLubyte writeByte; - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,GL_BITMAP); if (rowLength > 0) { groupsPerRow = rowLength; } else { @@ -413,26 +501,37 @@ static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height, ** SWAP_BYTES = the current pixel storage pack mode, and ALIGNMENT = 4. ** Named __glEmptyImage() because it is the opposite of __glFillImage(). */ -void __glEmptyImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, - GLenum type, const GLubyte *sourceImage, GLvoid *userdata) +/* ARGSUSED */ +void __glEmptyImage(__GLXcontext *gc, GLint dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, + const GLubyte *sourceImage, GLvoid *userdata) { GLint rowLength = gc->state.storePack.rowLength; + GLint imageHeight = gc->state.storePack.imageHeight; + GLint imageDepth = gc->state.storePack.imageDepth; GLint alignment = gc->state.storePack.alignment; GLint skipPixels = gc->state.storePack.skipPixels; GLint skipRows = gc->state.storePack.skipRows; + GLint skipImages = gc->state.storePack.skipImages; GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize; - GLint elementsPerRow, sourceRowSize, sourcePadding, i; - GLubyte *start, *iter; + GLint elementsPerRow, sourceRowSize, sourcePadding, g, h, i; + GLint imageSize, rowsPerImage; + GLubyte *start, *iter, *itera; if (type == GL_BITMAP) { EmptyBitmap(gc, width, height, format, sourceImage, userdata); } else { - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = width; } + if (imageHeight > 0) { + rowsPerImage = imageHeight; + } else { + rowsPerImage = height; + } elementSize = BytesPerElement(type); groupSize = elementSize * components; rowSize = groupsPerRow * groupSize; @@ -445,22 +544,28 @@ void __glEmptyImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, if (sourcePadding) { sourceRowSize += 4 - sourcePadding; } - start = ((GLubyte*) userdata) + skipRows * rowSize - + skipPixels * groupSize; + imageSize = sourceRowSize * rowsPerImage; + start = ((GLubyte*) userdata) + skipImages * imageSize + + skipRows * rowSize + skipPixels * groupSize; elementsPerRow = width * components; - if ((rowSize == sourceRowSize) && (sourcePadding == 0)) { - /* Ha! This is mondo easy! */ - __GLX_MEM_COPY(start, sourceImage, - elementsPerRow * elementSize * height); - } else { - iter = start; - for (i = 0; i < height; i++) { - __GLX_MEM_COPY(iter, sourceImage, - elementsPerRow * elementSize); - sourceImage += sourceRowSize; - iter += rowSize; + itera = start; + for (h = 0; h < depth; h++) { + if ((rowSize == sourceRowSize) && (sourcePadding == 0)) { + /* Ha! This is mondo easy! */ + __GLX_MEM_COPY(itera, sourceImage, + elementsPerRow * elementSize * height); + sourceImage += elementsPerRow * elementSize * height; + } else { + iter = itera; + for (i = 0; i < height; i++) { + __GLX_MEM_COPY(iter, sourceImage, + elementsPerRow * elementSize); + sourceImage += sourceRowSize; + iter += rowSize; + } } + itera += imageSize; } } } diff --git a/xc/lib/GL/glx/pixelstore.c b/xc/lib/GL/glx/pixelstore.c index 9dcef2057..0fc4faf76 100644 --- a/xc/lib/GL/glx/pixelstore.c +++ b/xc/lib/GL/glx/pixelstore.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/pixelstore.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/pixelstore.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ #include "packsingle.h" @@ -42,6 +57,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storePack.rowLength = a; break; + case GL_PACK_IMAGE_HEIGHT: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.imageHeight = a; + break; case GL_PACK_SKIP_ROWS: a = (GLuint) (param + 0.5); if (((GLint) a) < 0) { @@ -58,6 +81,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storePack.skipPixels = a; break; + case GL_PACK_SKIP_IMAGES: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.skipImages = a; + break; case GL_PACK_ALIGNMENT: a = (GLint) (param + 0.5); switch (a) { @@ -84,6 +115,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storeUnpack.rowLength = a; break; + case GL_UNPACK_IMAGE_HEIGHT: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.imageHeight = a; + break; case GL_UNPACK_SKIP_ROWS: a = (GLuint) (param + 0.5); if (((GLint) a) < 0) { @@ -100,6 +139,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storeUnpack.skipPixels = a; break; + case GL_UNPACK_SKIP_IMAGES: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.skipImages = a; + break; case GL_UNPACK_ALIGNMENT: a = (GLint) (param + 0.5); switch (a) { @@ -143,6 +190,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storePack.rowLength = param; break; + case GL_PACK_IMAGE_HEIGHT: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.imageHeight = param; + break; case GL_PACK_SKIP_ROWS: if (param < 0) { __glXSetError(gc, GL_INVALID_VALUE); @@ -157,6 +211,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storePack.skipPixels = param; break; + case GL_PACK_SKIP_IMAGES: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.skipImages = param; + break; case GL_PACK_ALIGNMENT: switch (param) { case 1: case 2: case 4: case 8: @@ -181,6 +242,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storeUnpack.rowLength = param; break; + case GL_UNPACK_IMAGE_HEIGHT: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.imageHeight = param; + break; case GL_UNPACK_SKIP_ROWS: if (param < 0) { __glXSetError(gc, GL_INVALID_VALUE); @@ -195,6 +263,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storeUnpack.skipPixels = param; break; + case GL_UNPACK_SKIP_IMAGES: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.skipImages = param; + break; case GL_UNPACK_ALIGNMENT: switch (param) { case 1: case 2: case 4: case 8: diff --git a/xc/lib/GL/glx/render2.c b/xc/lib/GL/glx/render2.c index 099bd9747..95a271ba5 100644 --- a/xc/lib/GL/glx/render2.c +++ b/xc/lib/GL/glx/render2.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/render2.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/render2.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ #include "packrender.h" @@ -412,24 +427,26 @@ void glEnable(GLenum cap) if (!gc->currentDpy) return; switch (cap) { - case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_TRUE; +#if 0 + case GL_VERTEX_ARRAY_EXT: + gc->state.vertArray.vertex.enable = GL_TRUE; return; - case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_TRUE; + case GL_NORMAL_ARRAY_EXT: + gc->state.vertArray.normal.enable = GL_TRUE; return; - case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_TRUE; + case GL_COLOR_ARRAY_EXT: + gc->state.vertArray.color.enable = GL_TRUE; return; - case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_TRUE; + case GL_INDEX_ARRAY_EXT: + gc->state.vertArray.index.enable = GL_TRUE; return; - case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_TRUE; + case GL_TEXTURE_COORD_ARRAY_EXT: + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_TRUE; return; - case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_TRUE; + case GL_EDGE_FLAG_ARRAY_EXT: + gc->state.vertArray.edgeFlag.enable = GL_TRUE; return; +#endif } __GLX_BEGIN(X_GLrop_Enable,8); __GLX_PUT_LONG(4,cap); @@ -444,24 +461,26 @@ void glDisable(GLenum cap) if (!gc->currentDpy) return; switch (cap) { - case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_FALSE; +#if 0 + case GL_VERTEX_ARRAY_EXT: + gc->state.vertArray.vertex.enable = GL_FALSE; return; - case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_FALSE; + case GL_NORMAL_ARRAY_EXT: + gc->state.vertArray.normal.enable = GL_FALSE; return; - case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_FALSE; + case GL_COLOR_ARRAY_EXT: + gc->state.vertArray.color.enable = GL_FALSE; return; - case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_FALSE; + case GL_INDEX_ARRAY_EXT: + gc->state.vertArray.index.enable = GL_FALSE; return; - case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_FALSE; + case GL_TEXTURE_COORD_ARRAY_EXT: + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_FALSE; return; - case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_FALSE; + case GL_EDGE_FLAG_ARRAY_EXT: + gc->state.vertArray.edgeFlag.enable = GL_FALSE; return; +#endif } __GLX_BEGIN(X_GLrop_Disable,8); __GLX_PUT_LONG(4,cap); diff --git a/xc/lib/GL/glx/renderpix.c b/xc/lib/GL/glx/renderpix.c index e6b34567d..cb3f72a9b 100644 --- a/xc/lib/GL/glx/renderpix.c +++ b/xc/lib/GL/glx/renderpix.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/renderpix.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/renderpix.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ #include "packrender.h" @@ -40,8 +55,8 @@ ** Send a large image to the server. If necessary, a buffer is allocated ** to hold the unpacked data that is copied from the clients memory. */ -static void SendLargeImage(__GLXcontext *gc, - GLint compsize, GLint width, GLint height, +static void SendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim, + GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *src, GLubyte *pc, GLubyte *modes) { @@ -54,7 +69,8 @@ static void SendLargeImage(__GLXcontext *gc, } /* Apply pixel store unpack modes to copy data into buf */ - (*gc->fillImage)(gc, width, height, format, type, src, buf, modes); + (*gc->fillImage)(gc, dim, width, height, depth, format, type, src, buf, + modes); /* Send large command */ __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); @@ -70,10 +86,10 @@ static void SendLargeImage(__GLXcontext *gc, /* ** Send a large null image to the server. To be backwards compatible, ** data must be sent to the server even when the application has passed -** a null pointer into glTexImage1D or glTexImage2D. +** a null pointer into glTexImage1D, glTexImage2D or glTexImage3D. */ -static void SendLargeNULLImage(__GLXcontext *gc, - GLint compsize, GLint width, GLint height, +static void SendLargeNULLImage(__GLXcontext *gc, GLint compsize, + GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *src, GLubyte *pc, GLubyte *modes) { @@ -98,7 +114,7 @@ void glPolygonStipple(const GLubyte *mask) { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(32, 32, GL_COLOR_INDEX, GL_BITMAP); + compsize = __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP); cmdlen = __GLX_PAD(__GLX_POLYGONSTIPPLE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -107,7 +123,7 @@ void glPolygonStipple(const GLubyte *mask) pc += __GLX_RENDER_HDR_SIZE; pixelHeaderPC = pc; pc += __GLX_PIXEL_HDR_SIZE; - (*gc->fillImage)(gc, 32, 32, GL_COLOR_INDEX, GL_BITMAP, + (*gc->fillImage)(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask, pc, pixelHeaderPC); __GLX_END(__GLX_PAD(compsize)); } @@ -117,7 +133,7 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(width, height, GL_COLOR_INDEX, GL_BITMAP); + compsize = __glImageSize(width, height, 1, GL_COLOR_INDEX, GL_BITMAP); cmdlen = __GLX_PAD(__GLX_BITMAP_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -133,8 +149,8 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, __GLX_PUT_FLOAT(20,ymove); pc += __GLX_BITMAP_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, GL_COLOR_INDEX, GL_BITMAP, - bitmap, pc, pixelHeaderPC); + (*gc->fillImage)(gc, 2, width, height, 1, GL_COLOR_INDEX, + GL_BITMAP, bitmap, pc, pixelHeaderPC); } else { /* Setup default store modes */ GLubyte *pc = pixelHeaderPC; @@ -158,7 +174,7 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, __GLX_PUT_FLOAT(16,xmove); __GLX_PUT_FLOAT(20,ymove); pc += __GLX_BITMAP_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, GL_COLOR_INDEX, + SendLargeImage(gc, compsize, 2, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, bitmap, pc, pixelHeaderPC); } } @@ -172,7 +188,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, if (target == GL_PROXY_TEXTURE_1D) { compsize = 0; } else { - compsize = __glImageSize(width, 1, format, type); + compsize = __glImageSize(width, 1, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); @@ -190,7 +206,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (compsize > 0 && image != NULL) { - (*gc->fillImage)(gc, width, 1, format, type, + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -218,7 +234,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (image != NULL) { - SendLargeImage(gc, compsize, width, 1, format, + SendLargeImage(gc, compsize, 1, width, 1, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -233,7 +249,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(12,0); __GLX_PUT_LONG(16,1); } - SendLargeNULLImage(gc, compsize, width, 1, format, + SendLargeNULLImage(gc, compsize, width, 1, 1, format, type, image, pc, pixelHeaderPC); } } @@ -248,7 +264,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, if (target == GL_PROXY_TEXTURE_2D) { compsize = 0; } else { - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); @@ -267,7 +283,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (compsize > 0 && image != NULL) { - (*gc->fillImage)(gc, width, height, format, type, + (*gc->fillImage)(gc, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -295,7 +311,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (image != NULL) { - SendLargeImage(gc, compsize, width, height, format, + SendLargeImage(gc, compsize, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -310,7 +326,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(12,0); __GLX_PUT_LONG(16,1); } - SendLargeNULLImage(gc, compsize, width, height, format, + SendLargeNULLImage(gc, compsize, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -321,7 +337,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); cmdlen = __GLX_PAD(__GLX_DRAWPIXELS_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -335,7 +351,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, __GLX_PUT_LONG(12,type); pc += __GLX_DRAWPIXELS_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, format, type, + (*gc->fillImage)(gc, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -358,7 +374,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, __GLX_PUT_LONG(8,format); __GLX_PUT_LONG(12,type); pc += __GLX_DRAWPIXELS_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, format, + SendLargeImage(gc, compsize, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -366,14 +382,14 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, - const GLvoid *image) + const GLvoid *image, GLint dim) { __GLX_DECLARE_VARIABLES(); if (image == NULL) { compsize = 0; } else { - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_CMD_HDR_SIZE + compsize); @@ -398,8 +414,8 @@ static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, } pc += __GLX_TEXSUBIMAGE_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, format, type, image, - pc, pixelHeaderPC); + (*gc->fillImage)(gc, dim, width, height, 1, format, type, image, + pc, pixelHeaderPC); } else { /* Setup default store modes */ GLubyte *pc = pixelHeaderPC; @@ -430,7 +446,7 @@ static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, __GLX_PUT_LONG(32,GL_FALSE); } pc += __GLX_TEXSUBIMAGE_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, + SendLargeImage(gc, compsize, dim, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -440,7 +456,7 @@ void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, const GLvoid *image) { __glx_TexSubImage1D2D(X_GLrop_TexSubImage1D, target, level, xoffset, - 0, width, 1, format, type, image); + 0, width, 1, format, type, image, 1); } void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, @@ -448,6 +464,442 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLenum format, GLenum type, const GLvoid *image) { __glx_TexSubImage1D2D(X_GLrop_TexSubImage2D, target, level, xoffset, - yoffset, width, height, format, type, image); + yoffset, width, height, format, type, image, 2); +} + +void glColorTable(GLenum target, GLenum internalformat, GLsizei width, + GLenum format, GLenum type, const GLvoid *table) +{ + __GLX_DECLARE_VARIABLES(); + + switch (target) { + case GL_PROXY_TEXTURE_1D: + case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_3D: + case GL_PROXY_COLOR_TABLE: + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + compsize = 0; + break; + default: + compsize = __glImageSize(width, 1, 1, format, type); + break; + } + cmdlen = __GLX_PAD(__GLX_COLOR_TABLE_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) { + return; + } + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorTable, (short)cmdlen); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, (long)internalformat); + __GLX_PUT_LONG(8, width); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_TABLE_HDR_SIZE; + if (compsize > 0 && table != NULL) { + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, table, pc, + pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0, GL_FALSE); + __GLX_PUT_CHAR(1, GL_FALSE); + __GLX_PUT_CHAR(2, 0); + __GLX_PUT_CHAR(3, 0); + __GLX_PUT_LONG(4, 0); + __GLX_PUT_LONG(8, 0); + __GLX_PUT_LONG(12, 0); + __GLX_PUT_LONG(16, 1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorTable, cmdlen+4); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, (long)internalformat); + __GLX_PUT_LONG(8, width); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_TABLE_HDR_SIZE; + SendLargeImage(gc, compsize, 1, width, 1, 1, format, + type, table, pc, pixelHeaderPC); + } +} + +void glColorSubTable(GLenum target, GLsizei start, GLsizei count, + GLenum format, GLenum type, const GLvoid *table) +{ + __GLX_DECLARE_VARIABLES(); + + compsize = __glImageSize(count, 1, 1, format, type); + cmdlen = __GLX_PAD(__GLX_COLOR_SUBTABLE_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) { + return; + } + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorSubTable, (short)cmdlen); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, start); + __GLX_PUT_LONG(8, count); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_SUBTABLE_HDR_SIZE; + if (compsize > 0 && table != NULL) { + (*gc->fillImage)(gc, 1, start+count, 1, 1, format, type, table, pc, + pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0, GL_FALSE); + __GLX_PUT_CHAR(1, GL_FALSE); + __GLX_PUT_CHAR(2, 0); + __GLX_PUT_CHAR(3, 0); + __GLX_PUT_LONG(4, 0); + __GLX_PUT_LONG(8, 0); + __GLX_PUT_LONG(12, 0); + __GLX_PUT_LONG(16, 1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorSubTable, cmdlen+4); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, start); + __GLX_PUT_LONG(8, count); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_SUBTABLE_HDR_SIZE; + SendLargeImage(gc, compsize, 1, start+count, 1, 1, format, + type, table, pc, pixelHeaderPC); + } +} + +static void __glx_ConvolutionFilter1D2D(GLshort opcode, GLint dim, + GLenum target, + GLenum internalformat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + compsize = __glImageSize(width, height, 1, format, type); + cmdlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode, cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += __GLX_CONV_FILT_HDR_SIZE; + if (compsize > 0) { + (*gc->fillImage)(gc, dim, width, height, 1, format, type, + image, pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += __GLX_CONV_FILT_HDR_SIZE; + SendLargeImage(gc, compsize, dim, width, height, 1, format, + type, image, pc, pixelHeaderPC); + } +} + +void glConvolutionFilter1D(GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *image) +{ + __glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter1D, 1, target, + internalformat, width, 1, format, type, + image); +} + +void glConvolutionFilter2D(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image) +{ + __glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter2D, 2, target, + internalformat, width, height, format, type, + image); +} + +void glSeparableFilter2D(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, + const GLvoid *column) +{ + __GLX_DECLARE_VARIABLES(); + GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len; + + compsize = __glImageSize(width, 1, 1, format, type); + compsize2 = __glImageSize(height, 1, 1, format, type); + totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); + hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE); + image1len = __GLX_PAD(compsize); + image2len = __GLX_PAD(compsize2); + cmdlen = totalhdrlen + image1len + image2len; + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_SeparableFilter2D, cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += hdrlen; + if (compsize > 0) { + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, + row, pc, pixelHeaderPC); + pc += image1len; + } + if (compsize2 > 0) { + (*gc->fillImage)(gc, 1, height, 1, 1, format, type, + column, pc, NULL); + pc += image2len; + } + if ((compsize == 0) && (compsize2 == 0)) { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } + __GLX_END(0); + } else { + GLint bufsize; + + bufsize = image1len + image2len; + + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += hdrlen; + + if (!gc->fastImageUnpack) { + /* Allocate a temporary holding buffer */ + GLubyte *buf = (GLubyte *) Xmalloc(bufsize); + if (!buf) { + __glXSetError(gc, GL_OUT_OF_MEMORY); + return; + } + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, row, buf, pixelHeaderPC); + + (*gc->fillImage)(gc, 1, height, 1, 1, format, type, column, + buf + image1len, pixelHeaderPC); + + /* Send large command */ + __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), buf, bufsize); + /* Free buffer */ + Xfree((char*) buf); + } else { + /* Just send the data straight as is */ + __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), pc, bufsize); + } + } +} + +void glTexImage3D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLsizei depth, GLint border, + GLenum format, GLenum type, const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + if ((target == GL_PROXY_TEXTURE_3D) || (image == NULL)) { + compsize = 0; + } else { + compsize = __glImageSize(width, height, depth, format, type); + } + cmdlen = __GLX_PAD(__GLX_TEXIMAGE_3D_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,width); + __GLX_PUT_LONG(16,height); + __GLX_PUT_LONG(20,depth); + __GLX_PUT_LONG(24,0); /* size4d */ + __GLX_PUT_LONG(28,border); + __GLX_PUT_LONG(32,format); + __GLX_PUT_LONG(36,type); + if (image == NULL) { + __GLX_PUT_LONG(40,GL_TRUE); + } else { + __GLX_PUT_LONG(40,GL_FALSE); + } + pc += __GLX_TEXIMAGE_3D_HDR_SIZE; + if (compsize > 0 && image != NULL) { + (*gc->fillImage)(gc, 3, width, height, depth, format, type, + image, pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,width); + __GLX_PUT_LONG(16,height); + __GLX_PUT_LONG(20,depth); + __GLX_PUT_LONG(24,0); /* size4d */ + __GLX_PUT_LONG(28,border); + __GLX_PUT_LONG(32,format); + __GLX_PUT_LONG(36,type); + if (image == NULL) { + __GLX_PUT_LONG(40,GL_TRUE); + } else { + __GLX_PUT_LONG(40,GL_FALSE); + } + pc += __GLX_TEXIMAGE_3D_HDR_SIZE; + SendLargeImage(gc, compsize, 3, width, height, depth, format, + type, image, pc, pixelHeaderPC); + } } +void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, + GLsizei depth, GLenum format, GLenum type, + const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + if (image == NULL) { + compsize = 0; + } else { + compsize = __glImageSize(width, height, depth, format, type); + } + cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D,cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,xoffset); + __GLX_PUT_LONG(12,yoffset); + __GLX_PUT_LONG(16,zoffset); + __GLX_PUT_LONG(20,0); /* woffset */ + __GLX_PUT_LONG(24,width); + __GLX_PUT_LONG(28,height); + __GLX_PUT_LONG(32,depth); + __GLX_PUT_LONG(36,0); /* size4d */ + __GLX_PUT_LONG(40,format); + __GLX_PUT_LONG(44,type); + if (image == NULL) { + __GLX_PUT_LONG(48,GL_TRUE); + } else { + __GLX_PUT_LONG(48,GL_FALSE); + } + pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE; + if (compsize > 0) { + (*gc->fillImage)(gc, 3, width, height, depth, format, type, image, + pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D, + cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,xoffset); + __GLX_PUT_LONG(12,yoffset); + __GLX_PUT_LONG(16,zoffset); + __GLX_PUT_LONG(20,0); /* woffset */ + __GLX_PUT_LONG(24,width); + __GLX_PUT_LONG(28,height); + __GLX_PUT_LONG(32,depth); + __GLX_PUT_LONG(36,0); /* size4d */ + __GLX_PUT_LONG(40,format); + __GLX_PUT_LONG(44,type); + if (image == NULL) { + __GLX_PUT_LONG(48,GL_TRUE); + } else { + __GLX_PUT_LONG(48,GL_FALSE); + } + pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE; + SendLargeImage(gc, compsize, 3, width, height, depth, format, type, + image, pc, pixelHeaderPC); + } +} diff --git a/xc/lib/GL/glx/single2.c b/xc/lib/GL/glx/single2.c index 2d2998729..29f87a721 100644 --- a/xc/lib/GL/glx/single2.c +++ b/xc/lib/GL/glx/single2.c @@ -1,27 +1,43 @@ -/* $XFree86: xc/lib/GL/glx/single2.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/single2.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ -#include "packsingle.h" +#define NEED_GL_FUNCS_WRAPPED #include "glxclient.h" +#include "packsingle.h" GLenum glGetError(void) { @@ -86,12 +102,18 @@ void glGetBooleanv(GLenum val, GLboolean *b) case GL_PACK_ROW_LENGTH: *b = (GLboolean)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *b = (GLboolean)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *b = (GLboolean)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *b = (GLboolean)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *b = (GLboolean)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *b = (GLboolean)gc->state.storePack.alignment; break; @@ -104,12 +126,18 @@ void glGetBooleanv(GLenum val, GLboolean *b) case GL_UNPACK_ROW_LENGTH: *b = (GLboolean)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *b = (GLboolean)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *b = (GLboolean)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *b = (GLboolean)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *b = (GLboolean)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *b = (GLboolean)gc->state.storeUnpack.alignment; break; @@ -120,68 +148,77 @@ void glGetBooleanv(GLenum val, GLboolean *b) *b = (GLboolean)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *b = (GLboolean)gc->state.vertArray.vertexEnable; + *b = (GLboolean)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.vertexSize; + *b = (GLboolean)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.vertexType; + *b = (GLboolean)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.vertexStride; + *b = (GLboolean)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *b = (GLboolean)gc->state.vertArray.normalEnable; + *b = (GLboolean)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.normalType; + *b = (GLboolean)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.normalStride; + *b = (GLboolean)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *b = (GLboolean)gc->state.vertArray.colorEnable; + *b = (GLboolean)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.colorSize; + *b = (GLboolean)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.colorType; + *b = (GLboolean)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.colorStride; + *b = (GLboolean)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *b = (GLboolean)gc->state.vertArray.indexEnable; + *b = (GLboolean)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.indexType; + *b = (GLboolean)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.indexStride; + *b = (GLboolean)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *b = (GLboolean)gc->state.vertArray.texCoordEnable; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.texCoordSize; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.texCoordType; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.texCoordStride; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *b = (GLboolean)gc->state.vertArray.edgeFlagEnable; + *b = (GLboolean)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.edgeFlagStride; + *b = (GLboolean)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *b = (GLboolean)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *b = (GLboolean)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *b = (GLboolean)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *b = (GLboolean)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -223,12 +260,18 @@ void glGetDoublev(GLenum val, GLdouble *d) case GL_PACK_ROW_LENGTH: *d = (GLdouble)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *d = (GLdouble)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *d = (GLdouble)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *d = (GLdouble)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *d = (GLdouble)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *d = (GLdouble)gc->state.storePack.alignment; break; @@ -241,12 +284,18 @@ void glGetDoublev(GLenum val, GLdouble *d) case GL_UNPACK_ROW_LENGTH: *d = (GLdouble)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *d = (GLdouble)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *d = (GLdouble)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *d = (GLdouble)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *d = (GLdouble)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *d = (GLdouble)gc->state.storeUnpack.alignment; break; @@ -257,68 +306,77 @@ void glGetDoublev(GLenum val, GLdouble *d) *d = (GLdouble)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *d = (GLdouble)gc->state.vertArray.vertexEnable; + *d = (GLdouble)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.vertexSize; + *d = (GLdouble)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.vertexType; + *d = (GLdouble)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.vertexStride; + *d = (GLdouble)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *d = (GLdouble)gc->state.vertArray.normalEnable; + *d = (GLdouble)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.normalType; + *d = (GLdouble)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.normalStride; + *d = (GLdouble)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *d = (GLdouble)gc->state.vertArray.colorEnable; + *d = (GLdouble)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.colorSize; + *d = (GLdouble)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.colorType; + *d = (GLdouble)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.colorStride; + *d = (GLdouble)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *d = (GLdouble)gc->state.vertArray.indexEnable; + *d = (GLdouble)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.indexType; + *d = (GLdouble)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.indexStride; + *d = (GLdouble)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *d = (GLdouble)gc->state.vertArray.texCoordEnable; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.texCoordSize; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.texCoordType; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.texCoordStride; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *d = (GLdouble)gc->state.vertArray.edgeFlagEnable; + *d = (GLdouble)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.edgeFlagStride; + *d = (GLdouble)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *d = (GLdouble)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *d = (GLdouble)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *d = (GLdouble)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *d = (GLdouble)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -360,12 +418,18 @@ void glGetFloatv(GLenum val, GLfloat *f) case GL_PACK_ROW_LENGTH: *f = (GLfloat)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *f = (GLfloat)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *f = (GLfloat)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *f = (GLfloat)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *f = (GLfloat)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *f = (GLfloat)gc->state.storePack.alignment; break; @@ -378,12 +442,18 @@ void glGetFloatv(GLenum val, GLfloat *f) case GL_UNPACK_ROW_LENGTH: *f = (GLfloat)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *f = (GLfloat)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *f = (GLfloat)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *f = (GLfloat)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *f = (GLfloat)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *f = (GLfloat)gc->state.storeUnpack.alignment; break; @@ -394,68 +464,77 @@ void glGetFloatv(GLenum val, GLfloat *f) *f = (GLfloat)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *f = (GLfloat)gc->state.vertArray.vertexEnable; + *f = (GLfloat)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.vertexSize; + *f = (GLfloat)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.vertexType; + *f = (GLfloat)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.vertexStride; + *f = (GLfloat)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *f = (GLfloat)gc->state.vertArray.normalEnable; + *f = (GLfloat)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.normalType; + *f = (GLfloat)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.normalStride; + *f = (GLfloat)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *f = (GLfloat)gc->state.vertArray.colorEnable; + *f = (GLfloat)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.colorSize; + *f = (GLfloat)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.colorType; + *f = (GLfloat)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.colorStride; + *f = (GLfloat)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *f = (GLfloat)gc->state.vertArray.indexEnable; + *f = (GLfloat)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.indexType; + *f = (GLfloat)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.indexStride; + *f = (GLfloat)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *f = (GLfloat)gc->state.vertArray.texCoordEnable; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.texCoordSize; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.texCoordType; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.texCoordStride; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *f = (GLfloat)gc->state.vertArray.edgeFlagEnable; + *f = (GLfloat)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.edgeFlagStride; + *f = (GLfloat)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *f = (GLfloat)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *f = (GLfloat)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *f = (GLfloat)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *f = (GLfloat)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -480,7 +559,7 @@ void glGetIntegerv(GLenum val, GLint *i) __GLX_SINGLE_PUT_LONG(0,val); __GLX_SINGLE_READ_XREPLY(); __GLX_SINGLE_GET_SIZE(compsize); - + if (compsize == 0) { /* ** Error occured; don't modify user's buffer. @@ -497,12 +576,18 @@ void glGetIntegerv(GLenum val, GLint *i) case GL_PACK_ROW_LENGTH: *i = (GLint)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *i = (GLint)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *i = (GLint)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *i = (GLint)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *i = (GLint)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *i = (GLint)gc->state.storePack.alignment; break; @@ -515,12 +600,18 @@ void glGetIntegerv(GLenum val, GLint *i) case GL_UNPACK_ROW_LENGTH: *i = (GLint)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *i = (GLint)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *i = (GLint)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *i = (GLint)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *i = (GLint)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *i = (GLint)gc->state.storeUnpack.alignment; break; @@ -531,68 +622,77 @@ void glGetIntegerv(GLenum val, GLint *i) *i = (GLint)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *i = (GLint)gc->state.vertArray.vertexEnable; + *i = (GLint)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.vertexSize; + *i = (GLint)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.vertexType; + *i = (GLint)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.vertexStride; + *i = (GLint)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *i = (GLint)gc->state.vertArray.normalEnable; + *i = (GLint)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.normalType; + *i = (GLint)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.normalStride; + *i = (GLint)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *i = (GLint)gc->state.vertArray.colorEnable; + *i = (GLint)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.colorSize; + *i = (GLint)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.colorType; + *i = (GLint)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.colorStride; + *i = (GLint)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *i = (GLint)gc->state.vertArray.indexEnable; + *i = (GLint)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.indexType; + *i = (GLint)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.indexStride; + *i = (GLint)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *i = (GLint)gc->state.vertArray.texCoordEnable; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.texCoordSize; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.texCoordType; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.texCoordStride; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *i = (GLint)gc->state.vertArray.edgeFlagEnable; + *i = (GLint)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.edgeFlagStride; + *i = (GLint)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *i = (GLint)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *i = (GLint)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *i = (GLint)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *i = (GLint)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -778,17 +878,17 @@ GLboolean glIsEnabled(GLenum cap) switch(cap) { case GL_VERTEX_ARRAY: - return gc->state.vertArray.vertexEnable; + return gc->state.vertArray.vertex.enable; case GL_NORMAL_ARRAY: - return gc->state.vertArray.normalEnable; + return gc->state.vertArray.normal.enable; case GL_COLOR_ARRAY: - return gc->state.vertArray.colorEnable; + return gc->state.vertArray.color.enable; case GL_INDEX_ARRAY: - return gc->state.vertArray.indexEnable; + return gc->state.vertArray.index.enable; case GL_TEXTURE_COORD_ARRAY: - return gc->state.vertArray.texCoordEnable; + return gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; case GL_EDGE_FLAG_ARRAY: - return gc->state.vertArray.edgeFlagEnable; + return gc->state.vertArray.edgeFlag.enable; } __GLX_SINGLE_LOAD_VARIABLES(); @@ -809,32 +909,32 @@ void glGetPointerv(GLenum pname, void **params) switch(pname) { case GL_VERTEX_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.vertexPtr; + *params = (void *)gc->state.vertArray.vertex.ptr; return; case GL_NORMAL_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.normalPtr; + *params = (void *)gc->state.vertArray.normal.ptr; return; case GL_COLOR_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.colorPtr; + *params = (void *)gc->state.vertArray.color.ptr; return; case GL_INDEX_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.indexPtr; + *params = (void *)gc->state.vertArray.index.ptr; return; case GL_TEXTURE_COORD_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.texCoordPtr; + *params = (void *)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].ptr; return; case GL_EDGE_FLAG_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.edgeFlagPtr; - return; + *params = (void *)gc->state.vertArray.edgeFlag.ptr; + return; case GL_FEEDBACK_BUFFER_POINTER: - *params = (void *)gc->feedbackBuf; - return; + *params = (void *)gc->feedbackBuf; + return; case GL_SELECTION_BUFFER_POINTER: - *params = (void *)gc->selectBuf; - return; + *params = (void *)gc->selectBuf; + return; default: __glXSetError(gc, GL_INVALID_ENUM); - return; + return; } } diff --git a/xc/lib/GL/glx/singlepix.c b/xc/lib/GL/glx/singlepix.c index 82edb3904..91253b382 100644 --- a/xc/lib/GL/glx/singlepix.c +++ b/xc/lib/GL/glx/singlepix.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/singlepix.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/singlepix.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ #include "packsingle.h" @@ -58,7 +73,7 @@ void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, ** to put data back into client memory */ __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize); - __glEmptyImage(gc, width, height, format, type, buf, pixels); + __glEmptyImage(gc, 2, width, height, 1, format, type, buf, pixels); Xfree((char*) buf); } } else { @@ -97,7 +112,7 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, _XEatData(dpy, compsize); __glXSetError(gc, GL_OUT_OF_MEMORY); } else { - GLint width, height; + GLint width, height, depth; /* ** Fetch data into holding buffer. Apply pixel store pack modes @@ -105,8 +120,10 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, */ width = reply.width; height = reply.height; + depth = reply.depth; __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize); - __glEmptyImage(gc, width, height, format, type, buf, texels); + __glEmptyImage(gc, 2, width, height, depth, format, type, buf, + texels); Xfree((char*) buf); } } else { @@ -131,7 +148,255 @@ void glGetPolygonStipple(GLubyte *mask) __GLX_SINGLE_READ_XREPLY(); if (reply.length == 32) { __GLX_SINGLE_GET_CHAR_ARRAY(buf,128); - __glEmptyImage(gc, 32, 32, GL_COLOR_INDEX, GL_BITMAP, buf, mask); + __glEmptyImage(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, buf, mask); + } + __GLX_SINGLE_END(); +} + +void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetColorTableReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTable,__GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = (int)reply.width; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, table); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, + GLvoid *image) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetConvolutionFilterReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionFilter, __GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,format); + __GLX_SINGLE_PUT_LONG(8,type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*) Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width, height; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = reply.width; + height = reply.height; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),compsize); + __glEmptyImage(gc, 2, width, height, 1, format, type, buf, image); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, + GLvoid *row, GLvoid *column, GLvoid *span) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetSeparableFilterReply reply; + GLubyte *rowBuf, *colBuf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,format); + __GLX_SINGLE_PUT_LONG(8,type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = reply.length << 2; + + if (compsize != 0) { + GLint width, height; + GLint widthsize, heightsize; + + width = reply.width; + height = reply.height; + + widthsize = __glImageSize(width,1,1,format, type); + heightsize = __glImageSize(height,1,1,format, type); + + /* Allocate a holding buffer to transform the data from */ + rowBuf = (GLubyte*) Xmalloc(widthsize); + if (!rowBuf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + UnlockDisplay(dpy); + SyncHandle(); + return; + } else { + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)rowBuf),widthsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row); + Xfree((char*) rowBuf); + } + colBuf = (GLubyte*) Xmalloc(heightsize); + if (!colBuf) { + /* Throw data away */ + _XEatData(dpy, compsize - __GLX_PAD(widthsize)); + __glXSetError(gc, GL_OUT_OF_MEMORY); + UnlockDisplay(dpy); + SyncHandle(); + return; + } else { + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)colBuf),heightsize); + __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column); + Xfree((char*) colBuf); + } + } else { + /* + ** don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); + +} + +void glGetHistogram(GLenum target, GLboolean reset, GLenum format, + GLenum type, GLvoid *values) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetHistogramReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogram,__GLX_PAD(14)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_PUT_CHAR(13,reset); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = (int)reply.width; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, values); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, + GLvoid *values) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetMinmaxReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmax,__GLX_PAD(14)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_PUT_CHAR(13,reset); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, 2, 1, 1, format, type, buf, values); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ } __GLX_SINGLE_END(); } diff --git a/xc/lib/GL/glx/size.h b/xc/lib/GL/glx/size.h index 1005d298a..ecd167075 100644 --- a/xc/lib/GL/glx/size.h +++ b/xc/lib/GL/glx/size.h @@ -1,26 +1,41 @@ #ifndef _size_h_ #define _size_h_ -/* $XFree86: xc/lib/GL/glx/size.h,v 1.2 1999/06/14 07:23:40 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/size.h,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ /* @@ -29,6 +44,10 @@ */ extern GLint __glBitmap_size(GLsizei w, GLsizei h); extern GLint __glCallLists_size(GLsizei n, GLenum type); +extern GLint __glColorTableParameterfv_size(GLenum pname); +extern GLint __glColorTableParameteriv_size(GLenum pname); +extern GLint __glConvolutionParameterfv_size(GLenum pname); +extern GLint __glConvolutionParameteriv_size(GLenum pname); extern GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h); extern GLint __glFogfv_size(GLenum pname); extern GLint __glFogiv_size(GLenum pname); @@ -44,8 +63,8 @@ extern GLint __glTexGendv_size(GLenum e); extern GLint __glTexGenfv_size(GLenum e); extern GLint __glTexGeniv_size(GLenum pname); extern GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w); -extern GLint __glTexImage2D_size(GLenum format, GLenum type, - GLsizei w, GLsizei h); +extern GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h); +extern GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d); extern GLint __glTexParameterfv_size(GLenum e); extern GLint __glTexParameteriv_size(GLenum e); diff --git a/xc/lib/GL/glx/vertarr.c b/xc/lib/GL/glx/vertarr.c index e62e52663..e16ab0aeb 100644 --- a/xc/lib/GL/glx/vertarr.c +++ b/xc/lib/GL/glx/vertarr.c @@ -1,133 +1,162 @@ -/* $XFree86: xc/lib/GL/glx/vertarr.c,v 1.2 1999/06/14 07:23:40 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/vertarr.c,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ -#include "packrender.h" +#define NEED_GL_FUNCS_WRAPPED #include "glxclient.h" +#include "packrender.h" #include <string.h> +#include <limits.h> /* INT_MAX */ /* macros for setting function pointers */ #define __GL_VERTEX_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 2) \ - va->vertexCall = (void (*)(const char *))glVertex2##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex2##let##v; \ else if (size == 3) \ - va->vertexCall = (void (*)(const char *))glVertex3##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex3##let##v; \ else if (size == 4) \ - va->vertexCall = (void (*)(const char *))glVertex4##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex4##let##v; \ break #define __GL_NORMAL_FUNC(NAME, let) \ case GL_##NAME: \ - va->normalCall = (void (*)(const char *))glNormal3##let##v; \ + normalPointer->proc = (void (*)(const void *))glNormal3##let##v; \ break #define __GL_COLOR_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 3) \ - va->colorCall = (void (*)(const char *))glColor3##let##v; \ + colorPointer->proc = (void (*)(const void *))glColor3##let##v; \ else if (size == 4)\ - va->colorCall = (void (*)(const char *))glColor4##let##v; \ + colorPointer->proc = (void (*)(const void *))glColor4##let##v; \ break #define __GL_INDEX_FUNC(NAME, let) \ case GL_##NAME: \ - va->indexCall = (void (*)(const char *))glIndex##let##v; \ + indexPointer->proc = (void (*)(const void *))glIndex##let##v; \ break #define __GL_TEXTURE_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 1) \ - va->texCoordCall = (void (*)(const char *))glTexCoord1##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord1##let##v; \ else if (size == 2) \ - va->texCoordCall = (void (*)(const char *))glTexCoord2##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord2##let##v; \ else if (size == 3) \ - va->texCoordCall = (void (*)(const char *))glTexCoord3##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord3##let##v; \ else if (size == 4) \ - va->texCoordCall = (void (*)(const char *))glTexCoord4##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord4##let##v; \ break static GLuint __glXTypeSize(GLenum enm) { - switch (enm) { - case __GL_BOOLEAN_ARRAY: return sizeof(GLboolean); - case GL_BYTE: return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: return sizeof(GLubyte); - case GL_SHORT: return sizeof(GLshort); - case GL_UNSIGNED_SHORT: return sizeof(GLushort); - case GL_INT: return sizeof(GLint); - case GL_UNSIGNED_INT: return sizeof(GLint); - case GL_FLOAT: return sizeof(GLfloat); - case GL_DOUBLE: return sizeof(GLdouble); - default: return 0; - } + switch (enm) { + case __GL_BOOLEAN_ARRAY: return sizeof(GLboolean); + case GL_BYTE: return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: return sizeof(GLubyte); + case GL_SHORT: return sizeof(GLshort); + case GL_UNSIGNED_SHORT: return sizeof(GLushort); + case GL_INT: return sizeof(GLint); + case GL_UNSIGNED_INT: return sizeof(GLint); + case GL_FLOAT: return sizeof(GLfloat); + case GL_DOUBLE: return sizeof(GLdouble); + default: return 0; + } } void __glXInitVertexArrayState(__GLXcontext *gc) { __GLXvertArrayState *va = &gc->state.vertArray; + GLint i; + + va->vertex.enable = GL_FALSE; + va->vertex.proc = NULL; + va->vertex.skip = 0; + va->vertex.ptr = 0; + va->vertex.size = 4; + va->vertex.type = GL_FLOAT; + va->vertex.stride = 0; + + va->normal.enable = GL_FALSE; + va->normal.proc = NULL; + va->normal.skip = 0; + va->normal.ptr = 0; + va->normal.size = 3; + va->normal.type = GL_FLOAT; + va->normal.stride = 0; + + va->color.enable = GL_FALSE; + va->color.proc = NULL; + va->color.skip = 0; + va->color.ptr = 0; + va->color.size = 4; + va->color.type = GL_FLOAT; + va->color.stride = 0; + + va->index.enable = GL_FALSE; + va->index.proc = NULL; + va->index.skip = 0; + va->index.ptr = 0; + va->index.size = 1; + va->index.type = GL_FLOAT; + va->index.stride = 0; + + for (i=0; i<__GLX_MAX_TEXTURE_UNITS; ++i) { + __GLXvertexArrayPointerState *texCoord = &va->texCoord[i]; + + texCoord->enable = GL_FALSE; + texCoord->proc = NULL; + texCoord->skip = 0; + texCoord->ptr = 0; + texCoord->size = 4; + texCoord->type = GL_FLOAT; + texCoord->stride = 0; + } - va->vertexEnable = GL_FALSE; - va->vertexCall = NULL; - va->vertexSkip = 0; - va->vertexPtr = 0; - va->vertexSize = 4; - va->vertexType = GL_FLOAT; - va->vertexStride = 0; - - va->normalEnable = GL_FALSE; - va->normalCall = NULL; - va->normalSkip = 0; - va->normalPtr = 0; - va->normalType = GL_FLOAT; - va->normalStride = 0; - - va->colorEnable = GL_FALSE; - va->colorCall = NULL; - va->colorSkip = 0; - va->colorPtr = 0; - va->colorSize = 4; - va->colorType = GL_FLOAT; - va->colorStride = 0; - - va->indexEnable = GL_FALSE; - va->indexCall = NULL; - va->indexSkip = 0; - va->indexPtr = 0; - va->indexType = GL_FLOAT; - va->indexStride = 0; - - va->texCoordEnable = GL_FALSE; - va->texCoordCall = NULL; - va->texCoordSkip = 0; - va->texCoordPtr = 0; - va->texCoordSize = 4; - va->texCoordType = GL_FLOAT; - va->texCoordStride = 0; - - va->edgeFlagEnable = GL_FALSE; - va->edgeFlagCall = NULL; - va->edgeFlagSkip = 0; - va->edgeFlagPtr = 0; - va->edgeFlagStride = 0; + va->edgeFlag.enable = GL_FALSE; + va->edgeFlag.proc = NULL; + va->edgeFlag.skip = 0; + va->edgeFlag.ptr = 0; + va->edgeFlag.size = 1; + va->edgeFlag.type = GL_UNSIGNED_BYTE; + va->edgeFlag.stride = 0; + + va->maxElementsVertices = INT_MAX; + va->maxElementsIndices = INT_MAX; } /*****************************************************************************/ @@ -136,7 +165,7 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *vertexPointer = &gc->state.vertArray.vertex; /* Check arguments */ if (size < 2 || size > 4 || stride < 0) { @@ -144,7 +173,7 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_VERTEX_FUNC(SHORT, s); __GL_VERTEX_FUNC(INT, i); @@ -155,23 +184,23 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, return; } - va->vertexSize = size; - va->vertexType = type; - va->vertexStride = stride; - va->vertexPtr = pointer; + vertexPointer->size = size; + vertexPointer->type = type; + vertexPointer->stride = stride; + vertexPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->vertexSkip = __glXTypeSize(type) * size; + vertexPointer->skip = __glXTypeSize(type) * size; } else { - va->vertexSkip = stride; + vertexPointer->skip = stride; } } void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *normalPointer = &gc->state.vertArray.normal; /* Check arguments */ if (stride < 0) { @@ -179,7 +208,7 @@ void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_NORMAL_FUNC(BYTE, b); __GL_NORMAL_FUNC(SHORT, s); @@ -191,15 +220,15 @@ void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - va->normalType = type; - va->normalStride = stride; - va->normalPtr = pointer; + normalPointer->type = type; + normalPointer->stride = stride; + normalPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->normalSkip = 3 * __glXTypeSize(type); + normalPointer->skip = 3 * __glXTypeSize(type); } else { - va->normalSkip = stride; + normalPointer->skip = stride; } } @@ -207,7 +236,7 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *colorPointer = &gc->state.vertArray.color; /* Check arguments */ if (stride < 0) { @@ -215,7 +244,7 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_COLOR_FUNC(BYTE, b); __GL_COLOR_FUNC(UNSIGNED_BYTE, ub); @@ -229,23 +258,24 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, __glXSetError(gc, GL_INVALID_ENUM); return; } - va->colorSize = size; - va->colorType = type; - va->colorStride = stride; - va->colorPtr = pointer; + + colorPointer->size = size; + colorPointer->type = type; + colorPointer->stride = stride; + colorPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->colorSkip = size * __glXTypeSize(type); + colorPointer->skip = size * __glXTypeSize(type); } else { - va->colorSkip = stride; + colorPointer->skip = stride; } } void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *indexPointer = &gc->state.vertArray.index; /* Check arguments */ if (stride < 0) { @@ -253,7 +283,7 @@ void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_INDEX_FUNC(UNSIGNED_BYTE, ub); __GL_INDEX_FUNC(SHORT, s); @@ -265,15 +295,15 @@ void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - va->indexType = type; - va->indexStride = stride; - va->indexPtr = pointer; + indexPointer->type = type; + indexPointer->stride = stride; + indexPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->indexSkip = __glXTypeSize(type); + indexPointer->skip = __glXTypeSize(type); } else { - va->indexSkip = stride; + indexPointer->skip = stride; } } @@ -281,7 +311,8 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *texCoordPointer = + &gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture]; /* Check arguments */ if (size < 1 || size > 4 || stride < 0) { @@ -289,7 +320,7 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_TEXTURE_FUNC(SHORT, s); __GL_TEXTURE_FUNC(INT, i); @@ -300,23 +331,23 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - va->texCoordSize = size; - va->texCoordType = type; - va->texCoordStride = stride; - va->texCoordPtr = pointer; + texCoordPointer->size = size; + texCoordPointer->type = type; + texCoordPointer->stride = stride; + texCoordPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->texCoordSkip = __glXTypeSize(type) * size; + texCoordPointer->skip = __glXTypeSize(type) * size; } else { - va->texCoordSkip = stride; + texCoordPointer->skip = stride; } } void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *edgeFlagPointer = &gc->state.vertArray.edgeFlag; /* Check arguments */ if (stride < 0) { @@ -324,19 +355,19 @@ void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer) return; } - va->edgeFlagStride = stride; - va->edgeFlagPtr = pointer; + /* Choose appropriate api proc */ + edgeFlagPointer->proc = (void (*)(const void *))glEdgeFlagv; + + edgeFlagPointer->stride = stride; + edgeFlagPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->edgeFlagSkip = sizeof(GLboolean); + edgeFlagPointer->skip = sizeof(GLboolean); } else { - va->edgeFlagSkip = stride; + edgeFlagPointer->skip = stride; } - /* Choose appropriate api call */ - va->edgeFlagCall = glEdgeFlagv; - } void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) @@ -506,29 +537,32 @@ void glArrayElement(GLint i) { __GLXcontext *gc = __glXGetCurrentContext(); __GLXvertArrayState *va = &gc->state.vertArray; + GLint j; - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(va->edgeFlagPtr+i*va->edgeFlagSkip); + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(va->edgeFlag.ptr+i*va->edgeFlag.skip); } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(va->texCoordPtr+i*va->texCoordSkip); + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(va->texCoord[j].ptr+i*va->texCoord[j].skip); + } } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(va->colorPtr+i*va->colorSkip); + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(va->color.ptr+i*va->color.skip); } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(va->indexPtr+i*va->indexSkip); + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(va->index.ptr+i*va->index.skip); } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(va->normalPtr+i*va->normalSkip); + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(va->normal.ptr+i*va->normal.skip); } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(va->vertexPtr+i*va->vertexSkip); + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(va->vertex.ptr+i*va->vertex.skip); } } @@ -537,9 +571,9 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) __GLXcontext *gc = __glXGetCurrentContext(); __GLXvertArrayState *va = &gc->state.vertArray; const char *vaPtr = NULL, *naPtr = NULL, *caPtr = NULL, - *iaPtr = NULL, *tcaPtr = NULL; + *iaPtr = NULL, *tcaPtr[__GLX_MAX_TEXTURE_UNITS]; const GLboolean *efaPtr = NULL; - GLint i; + GLint i, j; switch(mode) { case GL_POINTS: @@ -566,44 +600,48 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) /* ** Set up pointers for quick array traversal. */ - if (va->normalEnable == GL_TRUE) - naPtr = va->normalPtr + first * va->normalSkip; - if (va->colorEnable == GL_TRUE) - caPtr = va->colorPtr + first * va->colorSkip; - if (va->indexEnable == GL_TRUE) - iaPtr = va->indexPtr + first * va->indexSkip; - if (va->texCoordEnable == GL_TRUE) - tcaPtr = va->texCoordPtr + first * va->texCoordSkip; - if (va->edgeFlagEnable == GL_TRUE) - efaPtr = va->edgeFlagPtr + first * va->edgeFlagSkip; - if (va->vertexEnable == GL_TRUE) - vaPtr = va->vertexPtr + first * va->vertexSkip; + if (va->normal.enable == GL_TRUE) + naPtr = va->normal.ptr + first * va->normal.skip; + if (va->color.enable == GL_TRUE) + caPtr = va->color.ptr + first * va->color.skip; + if (va->index.enable == GL_TRUE) + iaPtr = va->index.ptr + first * va->index.skip; + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) + tcaPtr[j] = va->texCoord[j].ptr + first * va->texCoord[j].skip; + } + if (va->edgeFlag.enable == GL_TRUE) + efaPtr = va->edgeFlag.ptr + first * va->edgeFlag.skip; + if (va->vertex.enable == GL_TRUE) + vaPtr = va->vertex.ptr + first * va->vertex.skip; glBegin(mode); for (i = 0; i < count; i++) { - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(efaPtr); - efaPtr += va->edgeFlagSkip; + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(efaPtr); + efaPtr += va->edgeFlag.skip; } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(tcaPtr); - tcaPtr += va->texCoordSkip; - } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(caPtr); - caPtr += va->colorSkip; + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(tcaPtr[j]); + tcaPtr[j] += va->texCoord[j].skip; + } + } + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(caPtr); + caPtr += va->color.skip; } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(iaPtr); - iaPtr += va->indexSkip; + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(iaPtr); + iaPtr += va->index.skip; } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(naPtr); - naPtr += va->normalSkip; + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(naPtr); + naPtr += va->normal.skip; } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(vaPtr); - vaPtr += va->vertexSkip; + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(vaPtr); + vaPtr += va->vertex.skip; } } glEnd(); @@ -617,7 +655,7 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLubyte *iPtr1 = NULL; const GLushort *iPtr2 = NULL; const GLuint *iPtr3 = NULL; - GLint i, offset = 0; + GLint i, j, offset = 0; switch (mode) { case GL_POINTS: @@ -669,24 +707,53 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, offset = (GLint)(*iPtr3++); break; } - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(va->edgeFlagPtr+(offset*va->edgeFlagSkip)); - } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(va->texCoordPtr+(offset*va->texCoordSkip)); + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(va->edgeFlag.ptr+(offset*va->edgeFlag.skip)); } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(va->colorPtr+(offset*va->colorSkip)); + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(va->texCoord[j].ptr+ + (offset*va->texCoord[j].skip)); + } + } + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(va->color.ptr+(offset*va->color.skip)); } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(va->indexPtr+(offset*va->indexSkip)); + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(va->index.ptr+(offset*va->index.skip)); } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(va->normalPtr+(offset*va->normalSkip)); + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(va->normal.ptr+(offset*va->normal.skip)); } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(va->vertexPtr+(offset*va->vertexSkip)); + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(va->vertex.ptr+(offset*va->vertex.skip)); } } glEnd(); } + +void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + __GLXcontext *gc = __glXGetCurrentContext(); + + if (end < start) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + + glDrawElements(mode,count,type,indices); +} + +void glClientActiveTextureARB(GLenum texture) +{ + __GLXcontext *gc = __glXGetCurrentContext(); + GLint unit = (GLint) texture - GL_TEXTURE0_ARB; + + if (unit < 0 || __GLX_MAX_TEXTURE_UNITS <= unit) { + __glXSetError(gc, GL_INVALID_ENUM); + return; + } + gc->state.vertArray.activeTexture = unit; +} diff --git a/xc/lib/GL/include/GL/internal/glcore.h b/xc/lib/GL/include/GL/internal/glcore.h index 08de67219..38410aabb 100644 --- a/xc/lib/GL/include/GL/internal/glcore.h +++ b/xc/lib/GL/include/GL/internal/glcore.h @@ -1,32 +1,52 @@ #ifndef __gl_core_h_ #define __gl_core_h_ -/* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.5 1999/06/14 07:23:42 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:36 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/include/GL/internal/Attic/glcore.h,v 1.2 2001/01/08 16:21:36 nathanh Exp $ */ #ifndef XFree86LOADER #include <sys/types.h> #endif +#ifdef CAPI +#undef CAPI +#endif +#define CAPI + #define GL_CORE_SGI 1 #define GL_CORE_MESA 2 @@ -202,13 +222,13 @@ struct __GLdrawableBufferRec { void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLuint val, GLint x, GLint y, GLint w, GLint h); void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - void *other; /* exported */ void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); void *private; /* private */ + void *other; /* implementation private data */ __GLbufMainInitFn mainInit; __GLbufFallbackInitFn fallbackInit; }; @@ -260,7 +280,7 @@ struct __GLdrawablePrivateRec { __GLdrawableBuffer accumBuffer; __GLdrawableBuffer depthBuffer; __GLdrawableBuffer stencilBuffer; -#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) +#if __GL_NUMBER_OF_AUX_BUFFERS > 0 __GLdrawableBuffer *auxBuffer; #endif @@ -295,12 +315,12 @@ struct __GLdrawablePrivateRec { void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); void (*unlockDP)(__GLdrawablePrivate *glPriv); - - void *other; - /* exported */ - void (*freePrivate)(__GLdrawablePrivate *); void *private; + void (*freePrivate)(__GLdrawablePrivate *); + + /* client data */ + void *other; }; /* @@ -330,7 +350,7 @@ struct __GLdrawablePrivateRec { */ typedef struct __GLimportsRec { /* Memory management */ - void *(*malloc)(__GLcontext *gc, size_t size); + void * (*malloc)(__GLcontext *gc, size_t size); void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize); void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize); void (*free)(__GLcontext *gc, void *addr); @@ -340,11 +360,12 @@ typedef struct __GLimportsRec { void (*fatal)(__GLcontext *gc, char *fmt); /* other system calls */ - char *(*getenv)(__GLcontext *gc, const char *var); - int (*sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); - void *(*fopen)(__GLcontext *gc, const char *path, const char *mode); - int (*fclose)(__GLcontext *gc, void *stream); - int (*fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); + char *(CAPI *getenv)(__GLcontext *gc, const char *var); + int (CAPI *atoi)(__GLcontext *gc, const char *str); + int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); + void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode); + int (CAPI *fclose)(__GLcontext *gc, void *stream); + int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); /* Drawing surface management */ __GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc); diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c index 3254bf877..c0beefefd 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.c +++ b/xc/lib/GL/mesa/dri/dri_mesa.c @@ -283,9 +283,15 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn, #endif } + /* XXX this is disabled so that if we call SwapBuffers on an unbound + * window we can determine the last context bound to the window and + * use that context's lock. (BrianP, 2-Dec-2000) + */ +#if 0 /* Unbind the drawable */ pcp->driDrawablePriv = NULL; pdp->driContextPriv = &psp->dummyContextPriv; +#endif return GL_TRUE; } @@ -634,6 +640,7 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, psp->dummyContextPriv.driScreenPriv = psp; psp->dummyContextPriv.mesaContext = NULL; psp->dummyContextPriv.driDrawablePriv = NULL; + psp->dummyContextPriv.driverPrivate = NULL; /* No other fields should be used! */ } @@ -672,6 +679,7 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, else { gl_destroy_context(pcp->mesaContext); pcp->mesaContext = NULL; + pcp->driverPrivate = NULL; } } } diff --git a/xc/lib/GL/mesa/src/drv/common/depthtmp.h b/xc/lib/GL/mesa/src/drv/common/depthtmp.h index 0c10eae19..971401413 100644 --- a/xc/lib/GL/mesa/src/drv/common/depthtmp.h +++ b/xc/lib/GL/mesa/src/drv/common/depthtmp.h @@ -4,6 +4,7 @@ #define DBG 0 #endif + #ifndef HAVE_HW_DEPTH_SPANS #define HAVE_HW_DEPTH_SPANS 0 #endif @@ -11,13 +12,19 @@ #define HAVE_HW_DEPTH_PIXELS 0 #endif +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif static void TAG(WriteDepthSpan)( GLcontext *ctx, - GLuint n, GLint x, GLint y, + GLuint n, GLint x, GLint y, const GLdepth *depth, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -54,7 +61,7 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteDepthPixels)( GLcontext *ctx, @@ -64,7 +71,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, const GLdepth depth[], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_DEPTH_VARS; @@ -89,7 +96,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -99,7 +106,7 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth depth[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint x1, n1; LOCAL_DEPTH_VARS; @@ -123,14 +130,14 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_READ_UNLOCK(); } static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLdepth depth[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_DEPTH_VARS; @@ -153,9 +160,10 @@ static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_READ_UNLOCK(); } + #if HAVE_HW_DEPTH_SPANS #undef WRITE_DEPTH_SPAN #undef WRITE_DEPTH_PIXELS diff --git a/xc/lib/GL/mesa/src/drv/common/spantmp.h b/xc/lib/GL/mesa/src/drv/common/spantmp.h index 1e69d7b7f..4cac09bd0 100644 --- a/xc/lib/GL/mesa/src/drv/common/spantmp.h +++ b/xc/lib/GL/mesa/src/drv/common/spantmp.h @@ -2,21 +2,45 @@ #define DBG 0 #endif -static void TAG(WriteRGBASpan)( const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif + +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif + +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_CLIPLOOP +#define HW_READ_CLIPLOOP() HW_CLIPLOOP() +#endif + +#ifndef HW_WRITE_CLIPLOOP +#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() +#endif + + +static void TAG(WriteRGBASpan)( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; LOCAL_VARS; - - y = Y_FLIP(y); + y = Y_FLIP(y); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); @@ -26,31 +50,31 @@ static void TAG(WriteRGBASpan)( const GLcontext *ctx, if (mask) { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) - WRITE_RGBA( x1, y, - rgba[i][0], rgba[i][1], + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } else { - for (;i<n1;i++,x1++) - WRITE_RGBA( x1, y, - rgba[i][0], rgba[i][1], + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteRGBSpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], + const GLubyte rgb[][3], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -58,7 +82,7 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx, y = Y_FLIP(y); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); @@ -68,59 +92,59 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx, if (mask) { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } else { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteRGBAPixels)( const GLcontext *ctx, - GLuint n, - const GLint x[], + GLuint n, + const GLint x[], const GLint y[], - const GLubyte rgba[][4], + const GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_VARS; if (DBG) fprintf(stderr, "WriteRGBAPixels\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { for (i=0;i<n;i++) { if (mask[i]) { const int fy = Y_FLIP(y[i]); if (CLIPPIXEL(x[i],fy)) - WRITE_RGBA( x[i], fy, - rgba[i][0], rgba[i][1], + WRITE_RGBA( x[i], fy, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } -static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, - GLuint n, GLint x, GLint y, +static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, + GLuint n, GLint x, GLint y, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -131,26 +155,26 @@ static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) WRITE_PIXEL( x1, y, p ); } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, - GLuint n, + GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_VARS; @@ -158,7 +182,7 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { for (i=0;i<n;i++) if (mask[i]) { @@ -168,20 +192,16 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, } } HW_ENDCLIPLOOP(); - } - HW_UNLOCK(); + } + HW_WRITE_UNLOCK(); } - -/* - * Read a horizontal span of color pixels. - */ static void TAG(ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]) { - HW_LOCK() + HW_READ_LOCK() { GLint x1,n1; LOCAL_VARS; @@ -190,30 +210,31 @@ static void TAG(ReadRGBASpan)( const GLcontext *ctx, if (DBG) fprintf(stderr, "ReadRGBASpan\n"); - HW_CLIPLOOP() + HW_READ_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); - for (;i<n1;i++) - READ_RGBA( rgba[i], (x1+i), y ); + for (;n1>0;i++,x1++,n1--) + READ_RGBA( rgba[i], x1, y ); } - HW_ENDCLIPLOOP(); + HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } + static void TAG(ReadRGBAPixels)( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_VARS; if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); - - HW_CLIPLOOP() + + HW_READ_CLIPLOOP() { for (i=0;i<n;i++) if (mask[i]) { @@ -224,7 +245,7 @@ static void TAG(ReadRGBAPixels)( const GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } diff --git a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h b/xc/lib/GL/mesa/src/drv/common/stenciltmp.h index d22f6867c..2dada8da7 100644 --- a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h +++ b/xc/lib/GL/mesa/src/drv/common/stenciltmp.h @@ -4,13 +4,26 @@ #define DBG 0 #endif +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif static void TAG(WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLstencil *stencil, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -40,7 +53,7 @@ static void TAG(WriteStencilSpan)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -51,7 +64,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, const GLstencil stencil[], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_STENCIL_VARS; @@ -71,7 +84,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -81,7 +94,7 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLstencil stencil[]) { - HW_LOCK() + HW_READ_LOCK() { GLint x1,n1; LOCAL_STENCIL_VARS; @@ -99,14 +112,14 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLstencil stencil[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_STENCIL_VARS; @@ -123,7 +136,7 @@ static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810span.c b/xc/lib/GL/mesa/src/drv/i810/i810span.c index aa4f22d0c..9e86e9b68 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810span.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810span.c @@ -36,18 +36,18 @@ _y >= miny && _y < maxy) -#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ - if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ - else { \ - _n1 = _n; \ - _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ - } +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } #define Y_FLIP(_y) (height - _y - 1) - #define HW_LOCK() \ i810ContextPtr imesa = I810_CONTEXT(ctx); \ LOCK_HARDWARE_QUIESCENT(imesa); diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c index dd8222d47..acef5c908 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c @@ -46,6 +46,15 @@ #define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ _y >= miny && _y < maxy) +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } #define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile b/xc/lib/GL/mesa/src/drv/r128/Imakefile index 7e15a1074..f4a386963 100644 --- a/xc/lib/GL/mesa/src/drv/r128/Imakefile +++ b/xc/lib/GL/mesa/src/drv/r128/Imakefile @@ -28,6 +28,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #if BuildXF86DRI DRI_DEFINES = GlxDefines -DDRIVERTS DRI_INCLUDES = -I../../../../dri \ + -I../../../../dri/drm \ -I../../../../glx \ -I../../../dri \ -I$(TOP)/include \ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.c b/xc/lib/GL/mesa/src/drv/r128/r128_span.c index f0d7c318f..0233d6592 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_span.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_span.c @@ -148,6 +148,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define TAG(x) r128##x##_RGB565 #include "spantmp.h" +#define READ_DEPTH(d, _x, _y) \ + d = *(GLushort *)(buf + _x*2 + _y*pitch) /* 32 bit, ARGB8888 color spanline and pixel functions */ @@ -173,6 +175,23 @@ do { \ #include "spantmp.h" +/* 24 bit, RGB888 color spanline and pixel functions */ +#define WRITE_RGBA(_x, _y, r, g, b, a) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = ((r << 16) | \ + (g << 8) | \ + (b << 0)) + +#define WRITE_PIXEL(_x, _y, p) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = p + +#define READ_RGBA(rgba, _x, _y) \ + do { \ + GLuint p = *(GLuint *)(read_buf + _x*3 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 0xff; \ + } while (0) /* ================================================================ * Depth buffer @@ -341,6 +360,9 @@ do { \ */ +/* 32 bit depthbuffer functions */ +#define WRITE_DEPTH(_x, _y, d) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = d void r128DDInitSpanFuncs( GLcontext *ctx ) { diff --git a/xc/lib/GL/mesa/src/drv/radeon/Imakefile b/xc/lib/GL/mesa/src/drv/radeon/Imakefile index d862565d0..10e71732a 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/Imakefile +++ b/xc/lib/GL/mesa/src/drv/radeon/Imakefile @@ -13,16 +13,13 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #endif #ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow +#ifdef MesaUse3DNow 3DNOW_DEFS = -DUSE_3DNOW_ASM #endif -#if MesaUseKatmai +#ifdef MesaUseKatmai KATMAI_DEFS = -DUSE_KATMAI_ASM #endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) + ASM_DEFINES = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS) #endif #if BuildXF86DRI @@ -270,13 +267,11 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../X86/x86_xform_raw3.o \ ../../X86/x86_xform_raw4.o -#if MesaUseMMX MMX_SRCS = ../../X86/mmx_blend.S MMX_OBJS = ../../X86/mmx_blend.o -#endif -#if MesaUse3DNow +#ifdef MesaUse3DNow 3DNOW_SRCS = ../../X86/3dnow.c \ ../../X86/3dnow_norm_raw.S \ ../../X86/3dnow_vertex.S \ @@ -302,7 +297,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../X86/3dnow_xform_raw4.o #endif -#if MesaUseKatmai +#ifdef MesaUseKatmai KATMAI_SRCS = ../../X86/katmai.c \ ../../X86/katmai_norm_raw.S \ ../../X86/katmai_vertex.S \ diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_span.c b/xc/lib/GL/mesa/src/drv/sis/sis_span.c index 70fbd7f64..5bd6e6f63 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_span.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_span.c @@ -51,14 +51,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ _y >= miny && _y < maxy) -#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ - if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ - else { \ - _n1 = _n; \ - _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 > maxx) n1 -= (_x1 + n1 - maxx); \ - } +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } #define HW_LOCK() do{}while(0); diff --git a/xc/lib/GL/mesa/src/drv/tdfx/BUGS b/xc/lib/GL/mesa/src/drv/tdfx/BUGS new file mode 100644 index 000000000..fc239df41 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/BUGS @@ -0,0 +1,42 @@ +REMOVE THIS FILE BEFORE MERGING WITH TRUNK +------------------------------------------ + +OUTSTANDING BUGS + +demos/reflect - reading back Z on Voodoo3, image offset to right + Fixed in latest Glide. + +Q3 - some polygons drawn as vertical strips, similar to bug that was + seen in demos/fire. Voodoo3 only. May be related to glDepthMask + or glColorMask. + +book/fog - not fogging + Fog in orthograph mode still not implemented. Checking with + 3dfx engineers for ideas. + +Q3 demo crashes after changing display settings + but the full Q3 game version seems OK. + + + + +PERFORMANCE COMPARISON (Brian / Alan) + + V3/16 is Voodoo3 in 16bpp on a P3/500 + V5/16 is Voodoo5 in 16bpp on a P3/600 + V5/32 is Voodoo5 in 32bpp on a P3/600 + V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600 + V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600 + + tdfx-2-1-branch tdfx-3-0-0-branch +demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32 +------------------------------------------------------------------------ +gloss 257 183 174 320 308 177 313 167 +fire 42 39 52 41 +fire (no help) 98 80 50 106 113 73 124 80 +tunnel 61 50 70 58 +tunnel (no help) 167 142 57 138 152 113 171 122 +gears 663 554 540 881 1232 776 1484 830 +teapot 20 21 37 36 +teapot (no help) 22 14 14 24 30 30 43 42 + diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile index 160a33da6..ebb353844 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile @@ -57,41 +57,43 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../../../dri/drm/xf86drmRandom.o \ ../../../../dri/drm/xf86drmSL.o - TDFXSRCS = tdfx_xmesa.c \ - tdfx_init.c \ - tdfx_inithw.c \ - fxclip.c \ - fxcva.c \ - fxdd.c \ - fxddspan.c \ - fxddtex.c \ - fxfastpath.c \ - fxglidew.c \ - fxpipeline.c \ - fxrender.c \ - fxsanity.c \ - fxsetup.c \ - fxtexman.c \ - fxtrifuncs.c \ - fxvsetup.c - - TDFXOBJS = tdfx_xmesa.o \ - tdfx_init.o \ - tdfx_inithw.o \ - fxclip.o \ - fxcva.o \ - fxdd.o \ - fxddspan.o \ - fxddtex.o \ - fxfastpath.o \ - fxglidew.o \ - fxpipeline.o \ - fxrender.o \ - fxsanity.o \ - fxsetup.o \ - fxtexman.o \ - fxtrifuncs.o \ - fxvsetup.o + TDFXSRCS = tdfx_context.c \ + tdfx_dd.c \ + tdfx_pixels.c \ + tdfx_fastpath.c \ + tdfx_g3ext.c \ + tdfx_lock.c \ + tdfx_pipeline.c \ + tdfx_render.c \ + tdfx_screen.c \ + tdfx_span.c \ + tdfx_state.c \ + tdfx_tex.c \ + tdfx_texman.c \ + tdfx_texstate.c \ + tdfx_tris.c \ + tdfx_vb.c \ + tdfx_wrapper.c \ + tdfx_xmesa.c + + TDFXOBJS = tdfx_context.o \ + tdfx_dd.o \ + tdfx_pixels.o \ + tdfx_fastpath.o \ + tdfx_g3ext.o \ + tdfx_lock.o \ + tdfx_pipeline.o \ + tdfx_render.o \ + tdfx_screen.o \ + tdfx_span.o \ + tdfx_state.o \ + tdfx_tex.o \ + tdfx_texman.o \ + tdfx_texstate.o \ + tdfx_tris.o \ + tdfx_vb.o \ + tdfx_wrapper.o \ + tdfx_xmesa.o MESASRCS = ../../aatriangle.c \ ../../accum.c \ @@ -346,7 +348,6 @@ REQUIREDLIBS = -l$(GLIDE3LIBNAME) MathLibrary REQUIREDLIBS += -L../../../.. -lGL #endif - #if !GlxUseBuiltInDRIDriver #undef DoNormalLib NormalLibGlx #undef DoExtraLib SharedLibGlx diff --git a/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h b/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h new file mode 100644 index 000000000..83223b07c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h @@ -0,0 +1,63 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __DRI_GLIDE_H__ +#define __DRI_GLIDE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <glide.h> +#include "dri_mesaint.h" + +/* + * This is the private interface between Glide and the DRI. + */ +extern void grDRIOpen( char *pFB, char *pRegs, int deviceID, + int width, int height, + int mem, int cpp, int stride, + int fifoOffset, int fifoSize, + int fbOffset, int backOffset, int depthOffset, + int textureOffset, int textureSize, + volatile int *fifoPtr, volatile int *fifoRead ); +extern void grDRIPosition( int x, int y, int w, int h, + int numClip, XF86DRIClipRectPtr pClip ); +extern void grDRILostContext( void ); +extern void grDRIImportFifo( int fifoPtr, int fifoRead ); +extern void grDRIInvalidateAll( void ); +extern void grDRIResetSAREA( void ); +extern void grDRIBufferSwap( FxU32 swapInterval ); +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxclip.c b/xc/lib/GL/mesa/src/drv/tdfx/fxclip.c deleted file mode 100644 index 1beb843fc..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxclip.c +++ /dev/null @@ -1,488 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxclip.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include "fxdrv.h" -#include "fxtexman.h" -#include "mmath.h" -#include "macros.h" -#include "vector.h" -#include "types.h" - - -#if 0 && defined(__i386__) -#define NEGATIVE(f) ((*(int *)&f) < 0) -#define DIFFERENT_SIGNS(a,b) (((*(int *)&a)^(*(int *)&b)) < 0) -#else -#define NEGATIVE(f) (f < 0) -#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) -#endif - -#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) ) - - -#define CLIP(sgn,v) \ -do { \ - GLuint out = in ^ 1; \ - GLfloat **indata = inlist[in]; \ - GrVertex **inverts = vertlist[in]; \ - GrVertex **outverts = vertlist[out]; \ - GLfloat **outdata = inlist[in = out]; \ - GLfloat *J = indata[n-1]; \ - GLfloat dpJ = (sgn J[v]) + J[3]; \ - GLuint nr = n; \ - \ - for (i = n = 0 ; i < nr ; i++) { \ - GLfloat *I = indata[i]; \ - GLfloat dpI = (sgn I[v]) + I[3]; \ - \ - if (DIFFERENT_SIGNS(dpI, dpJ)) { \ - GLuint j; \ - GLfloat t = dpI / (dpI - dpJ); \ - outverts[n] = 0; \ - outdata[n++] = store; \ - store[3] = LINTERP(t, I[3], J[3]); \ - store[v] = - sgn store[3]; \ - if (v != 0) store[0] = LINTERP(t, I[0], J[0]); \ - if (v != 1) store[1] = LINTERP(t, I[1], J[1]); \ - if (v != 2) store[2] = LINTERP(t, I[2], J[2]); \ - store += 4; \ - for (j = 4 ; j < sz ; j+=4,store+=4) { \ - store[0] = LINTERP(t, I[j], J[j] ); \ - store[1] = LINTERP(t, I[j+1], J[j+1] ); \ - store[2] = LINTERP(t, I[j+2], J[j+2] ); \ - store[3] = LINTERP(t, I[j+3], J[j+3] ); \ - } \ - } \ - \ - if (!NEGATIVE(dpI)) { \ - outverts[n] = inverts[i]; \ - outdata[n++] = I; \ - } \ - \ - \ - J = I; \ - dpJ = dpI; \ - } \ - \ - if (n < 3) return 0; \ -} while (0) - - -/* Originally used this for the viewclip planes as well, as in - * CLIP(-1,0,0,1), which was just as fast, but tended to lead to - * cracks. I haven't figured out exactly why this is, but the above - * code only really differs in the way it sets store[v] to +- w. - */ -#define UCLIP(a,b,c,d) \ -do { \ - GLuint out = in ^ 1; \ - GLfloat **indata = inlist[in]; \ - GrVertex **inverts = vertlist[in]; \ - GrVertex **outverts = vertlist[out]; \ - GLfloat **outdata = inlist[in = out]; \ - GLfloat *J = indata[n-1]; \ - GLfloat dpJ = DOT4V(J,a,b,c,d); \ - GLuint nr = n; \ - \ - for (i = n = 0 ; i < nr ; i++) { \ - GLfloat *I = indata[i]; \ - GLfloat dpI = DOT4V(I,a,b,c,d); \ - \ - if (DIFFERENT_SIGNS(dpI, dpJ)) { \ - GLuint j; \ - GLfloat t = dpI / (dpI - dpJ); \ - outverts[n] = 0; \ - outdata[n++] = store; \ - for (j = 0 ; j < sz ; j+=4,store+=4) { \ - store[0] = LINTERP(t, I[j], J[j] ); \ - store[1] = LINTERP(t, I[j+1], J[j+1] ); \ - store[2] = LINTERP(t, I[j+2], J[j+2] ); \ - store[3] = LINTERP(t, I[j+3], J[j+3] ); \ - } \ - } \ - \ - if (!NEGATIVE(dpI)) { \ - outverts[n] = inverts[i]; \ - outdata[n++] = I; \ - } \ - \ - \ - J = I; \ - dpJ = dpI; \ - } \ - \ - if (n < 3) return 0; \ -} while (0) - - - -/* Data parameter is organized as 4 clip coordinates followed by an - * arbitary number (sz-4) of additional data. The three original - * vertices are packed together at the start, and there is room for at - * least VB_MAX_CLIPPED_VERTS vertices of the same size in this - * storage. - * - */ -static INLINE GLuint -fx_clip_triangle(GLcontext * ctx, - GLfloat * inoutlist[], - GrVertex ** verts, GLuint sz, GLuint mask) -{ - GLuint n = 3; - GLfloat *store = inoutlist[n - 1] + sz; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GrVertex *verts2[VB_MAX_CLIPPED_VERTS]; - GLfloat **inlist[2]; - GrVertex **vertlist[2]; - GLuint in = 0; - GLuint i; - - inlist[0] = inoutlist; - inlist[1] = vlist; - - vertlist[0] = verts; - vertlist[1] = verts2; - - if (mask & CLIP_ALL_BITS) { - if (mask & CLIP_RIGHT_BIT) - CLIP(-, 0); - - if (mask & CLIP_LEFT_BIT) - CLIP(+, 0); - - if (mask & CLIP_TOP_BIT) - CLIP(-, 1); - - if (mask & CLIP_BOTTOM_BIT) - CLIP(+, 1); - - if (mask & CLIP_FAR_BIT) - CLIP(-, 2); - - if (mask & CLIP_NEAR_BIT) - CLIP(+, 2); - } - - if (mask & CLIP_USER_BIT) { - GLuint bit; - GLfloat(*plane)[4] = &ctx->Transform.ClipUserPlane[0]; - for (bit = 0x100; bit < mask; plane++, bit *= 2) { - if (mask & bit) { - GLfloat a = plane[0][0]; - GLfloat b = plane[0][1]; - GLfloat c = plane[0][2]; - GLfloat d = plane[0][3]; - UCLIP(a, b, c, d); - } - } - } - - if (inlist[in] != inoutlist) - for (i = 0; i < n; i++) { - inoutlist[i] = inlist[in][i]; - verts[i] = verts2[i]; - } - - return n; -} - - - -static INLINE GLuint -fx_view_clip_triangle(GLcontext * ctx, - GLfloat * inoutlist[], - GrVertex ** verts, GLuint sz, GLubyte mask) -{ - GLuint n = 3; - GLfloat *store = inoutlist[n - 1] + sz; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GrVertex *verts2[VB_MAX_CLIPPED_VERTS]; - GLfloat **inlist[2]; - GrVertex **vertlist[2]; - GLuint in = 0; - GLuint i; - - inlist[0] = inoutlist; - inlist[1] = vlist; - - vertlist[0] = verts; - vertlist[1] = verts2; - - if (mask & CLIP_RIGHT_BIT) - CLIP(-, 0); - - if (mask & CLIP_LEFT_BIT) - CLIP(+, 0); - - if (mask & CLIP_TOP_BIT) - CLIP(-, 1); - - if (mask & CLIP_BOTTOM_BIT) - CLIP(+, 1); - - if (mask & CLIP_FAR_BIT) - CLIP(-, 2); - - if (mask & CLIP_NEAR_BIT) - CLIP(+, 2); - - if (inlist[in] != inoutlist) - for (i = 0; i < n; i++) { - inoutlist[i] = inlist[in][i]; - verts[i] = verts2[i]; - } - - return n; -} - - - -#undef CLIP - -#define CLIP(x,y,z,w) \ -do { \ - GLfloat dpI = DOT4V(I,x,y,z,w); \ - GLfloat dpJ = DOT4V(J,x,y,z,w); \ - \ - if (DIFFERENT_SIGNS(dpI, dpJ)) { \ - GLuint j; \ - GLfloat t = dpI / (dpI - dpJ); \ - GLfloat *tmp = store; \ - \ - for (j = 0 ; j < sz ; j+=2) { \ - *store++ = LINTERP(t, I[j], J[j] ); \ - *store++ = LINTERP(t, I[j+1], J[j+1] ); \ - } \ - \ - if (NEGATIVE(dpI)) \ - I = tmp; \ - else \ - J = tmp; \ - \ - } \ - else if (NEGATIVE(dpI)) \ - return 0; \ - \ -} while (0) - - -static GLuint -fx_clip_line(GLcontext * ctx, - GLfloat * inoutlist[], GLuint sz, GLubyte clipor) -{ - GLfloat *I = inoutlist[0]; - GLfloat *J = inoutlist[1]; - GLfloat *store = J + sz; - - if (clipor & CLIP_ALL_BITS) { - if (clipor & CLIP_LEFT_BIT) - CLIP(1, 0, 0, 1); - - if (clipor & CLIP_RIGHT_BIT) - CLIP(-1, 0, 0, 1); - - if (clipor & CLIP_TOP_BIT) - CLIP(0, -1, 0, 1); - - if (clipor & CLIP_BOTTOM_BIT) - CLIP(0, 1, 0, 1); - - if (clipor & CLIP_FAR_BIT) - CLIP(0, 0, -1, 1); - - if (clipor & CLIP_NEAR_BIT) - CLIP(0, 0, 1, 1); - } - - if (clipor & CLIP_USER_BIT) { - GLuint i; - for (i = 0; i < MAX_CLIP_PLANES; i++) { - if (ctx->Transform.ClipEnabled[i]) { - GLfloat a = ctx->Transform.ClipUserPlane[i][0]; - GLfloat b = ctx->Transform.ClipUserPlane[i][1]; - GLfloat c = ctx->Transform.ClipUserPlane[i][2]; - GLfloat d = ctx->Transform.ClipUserPlane[i][3]; - CLIP(a, b, c, d); - } - } - } - - inoutlist[0] = I; - inoutlist[1] = J; - - return 2; -} - - -/* Add window offset to window coords to get screen coords */ - -#define VARS_XYZW \ - GLfloat vsx = mat[MAT_SX]; \ - GLfloat vsy = mat[MAT_SY]; \ - GLfloat vsz = mat[MAT_SZ]; \ - GLfloat vtx = mat[MAT_TX]+fxMesa->x_offset; \ - GLfloat vty = mat[MAT_TY]+fxMesa->y_delta; \ - GLfloat vtz = mat[MAT_TZ]; - -#define DO_SETUP_XYZW \ -{ \ - GLfloat oow = 1.0 / data[3]; \ - v->x = data[0]*oow*vsx + vtx; \ - v->y = data[1]*oow*vsy + vty; \ - v->ooz = data[2]*oow*vsz + vtz; \ - v->oow = oow; \ -} - - - -#define COPY_XYZW_STRIDE \ - { GLfloat *clip = VEC_ELT(VB->ClipPtr, GLfloat, e); \ - COPY_4FV(out, clip); } - -#define VARS_RGBA - -#define COPY_RGBA_STRIDE \ - { GLubyte *color = VEC_ELT(VB->ColorPtr, GLubyte, e); \ - UBYTE_RGBA_TO_FLOAT_255_RGBA((out+4), color); } - -#if FX_USE_PARGB -#define DO_SETUP_RGBA \ - PACK_4F_ARGB(GET_PARGB(v), data[4+3], data[4+0], data[4+1], data[4+2]); -#else -#define DO_SETUP_RGBA \ - v->r = data[4+0]; \ - v->g = data[4+1]; \ - v->b = data[4+2]; \ - v->a = data[4+3]; -#endif /* FX_USE_PARGB */ - -#define VARS_TMU0 \ - struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; \ - GLfloat sScale0 = fxTMGetTexInfo(t0->Current)->sScale; \ - GLfloat tScale0 = fxTMGetTexInfo(t0->Current)->tScale; \ - - -#define COPY_TMU0_STRIDE(offset) \ - { GLfloat *tc0 = VEC_ELT(tc0_vec, GLfloat, e); \ - COPY_2V((out+offset), tc0); } - - -#define DO_SETUP_TMU0(offset) \ - v->tmuvtx[0].sow = data[offset+0]*sScale0*v->oow; \ - v->tmuvtx[0].tow = data[offset+1]*tScale0*v->oow; - -#define VARS_TMU1 \ - struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; \ - GLfloat sScale1 = fxTMGetTexInfo(t1->Current)->sScale; \ - GLfloat tScale1 = fxTMGetTexInfo(t1->Current)->tScale; - -#define COPY_TMU1_STRIDE(offset) \ - { GLfloat *tc1 = VEC_ELT(tc1_vec, GLfloat, e); \ - COPY_2V((out+offset), tc1); } - - -#define DO_SETUP_TMU1(offset) \ - v->tmuvtx[1].sow = data[offset+0]*sScale1*v->oow; \ - v->tmuvtx[1].tow = data[offset+1]*tScale1*v->oow; - -#define COPY_NIL(offset) ASSIGN_2V((out+offset), 0, 0); - -#define IND 0 -#define TAG(x) x##_nil -#include "fxcliptmp.h" - -#define IND SETUP_RGBA -#define TAG(x) x##_RGBA -#include "fxcliptmp.h" - -#define IND SETUP_TMU0 -#define TAG(x) x##_TMU0 -#include "fxcliptmp.h" - -#define IND (SETUP_TMU0|SETUP_TMU1) -#define TAG(x) x##_TMU0_TMU1 -#include "fxcliptmp.h" - -#define IND (SETUP_RGBA|SETUP_TMU0) -#define TAG(x) x##_RGBA_TMU0 -#include "fxcliptmp.h" - -#define IND (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1) -#define TAG(x) x##_RGBA_TMU0_TMU1 -#include "fxcliptmp.h" - -tfxTriViewClipFunc fxTriViewClipTab[0x8]; -tfxTriClipFunc fxTriClipStrideTab[0x8]; -tfxLineClipFunc fxLineClipTab[0x8]; - - -void -fxDDClipInit() -{ - fxTriViewClipTab[0] = fx_tri_view_clip_nil; - fxTriViewClipTab[SETUP_RGBA] = fx_tri_view_clip_RGBA; - fxTriViewClipTab[SETUP_TMU0] = fx_tri_view_clip_TMU0; - fxTriViewClipTab[SETUP_TMU0 | SETUP_TMU1] = fx_tri_view_clip_TMU0_TMU1; - fxTriViewClipTab[SETUP_RGBA | SETUP_TMU0] = fx_tri_view_clip_RGBA_TMU0; - fxTriViewClipTab[SETUP_RGBA | SETUP_TMU0 | SETUP_TMU1] = - fx_tri_view_clip_RGBA_TMU0_TMU1; - - fxTriClipStrideTab[0] = fx_tri_clip_stride_nil; - fxTriClipStrideTab[SETUP_RGBA] = fx_tri_clip_stride_RGBA; - fxTriClipStrideTab[SETUP_TMU0] = fx_tri_clip_stride_TMU0; - fxTriClipStrideTab[SETUP_TMU0 | SETUP_TMU1] = - fx_tri_clip_stride_TMU0_TMU1; - fxTriClipStrideTab[SETUP_RGBA | SETUP_TMU0] = - fx_tri_clip_stride_RGBA_TMU0; - fxTriClipStrideTab[SETUP_RGBA | SETUP_TMU0 | SETUP_TMU1] = - fx_tri_clip_stride_RGBA_TMU0_TMU1; - - fxLineClipTab[0] = fx_line_clip_nil; - fxLineClipTab[SETUP_RGBA] = fx_line_clip_RGBA; - fxLineClipTab[SETUP_TMU0] = fx_line_clip_TMU0; - fxLineClipTab[SETUP_TMU0 | SETUP_TMU1] = fx_line_clip_TMU0_TMU1; - fxLineClipTab[SETUP_RGBA | SETUP_TMU0] = fx_line_clip_RGBA_TMU0; - fxLineClipTab[SETUP_RGBA | SETUP_TMU0 | SETUP_TMU1] = - fx_line_clip_RGBA_TMU0_TMU1; -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h deleted file mode 100644 index b84e3c3f2..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h +++ /dev/null @@ -1,353 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h,v 1.1 2000/09/24 13:51:13 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#define V1 VARS_XYZW -#define S1 DO_SETUP_XYZW -#define T1 COPY_XYZW_STRIDE -#define Z1 4 - -#if (IND & SETUP_RGBA) -#define V2 V1 VARS_RGBA -#define S2 S1 DO_SETUP_RGBA -#define T2 T1 COPY_RGBA_STRIDE -#define Z2 (Z1 + 4) -#else -#define V2 V1 -#define S2 S1 -#define T2 T1 -#define Z2 Z1 -#endif - -#if (IND & SETUP_TMU0) -#define V3 V2 VARS_TMU0 -#define S3 S2 DO_SETUP_TMU0(Z2) -#define T3 T2 COPY_TMU0_STRIDE(Z2) -#define Z3 (Z2 + 2) -#else -#define V3 V2 -#define S3 S2 -#define T3 T2 -#define Z3 Z2 -#endif - -#if (IND & SETUP_TMU1) -#define V4 V3 VARS_TMU1 -#define S4 S3 DO_SETUP_TMU1(Z3) -#define T4 T3 COPY_TMU1_STRIDE(Z3) -#define Z4 (Z3 + 2) -#else -#define V4 V3 -#define S4 S3 -#define T4 T3 -#define Z4 Z3 -#endif - -#if (Z4 & 2) -#define SIZE (Z4+2) -#define COPY_STRIDE T4 COPY_NIL(Z4) -#else -#define SIZE Z4 -#define COPY_STRIDE T4 -#endif - -#define VARS V4 -#define SETUP S4 - -#define DRAW_LINE(fxMesa, tmp0, tmp1, width) \ - if (width <= 1.0) { \ - FX_grDrawLine(fxMesa, tmp0, tmp1); \ - } \ - else { \ - GrVertex verts[4]; \ - float dx, dy, ix, iy; \ - \ - dx = tmp0->x - tmp1->x; \ - dy = tmp0->y - tmp1->y; \ - \ - if (dx * dx > dy * dy) { \ - iy = width * .5; \ - ix = 0; \ - } \ - else { \ - iy = 0; \ - ix = width * .5; \ - } \ - \ - verts[0] = *tmp0; \ - verts[1] = *tmp0; \ - verts[2] = *tmp1; \ - verts[3] = *tmp1; \ - \ - verts[0].x = tmp0->x - ix; \ - verts[0].y = tmp0->y - iy; \ - \ - verts[1].x = tmp0->x + ix; \ - verts[1].y = tmp0->y + iy; \ - \ - verts[2].x = tmp1->x + ix; \ - verts[2].y = tmp1->y + iy; \ - \ - verts[3].x = tmp1->x - ix; \ - verts[3].y = tmp1->y - iy; \ - \ - FX_grDrawPolygonVertexList(fxMesa, 4, verts); \ - } - - - -static void TAG(fx_tri_view_clip) (struct vertex_buffer * VB, - GLuint v[], GLubyte mask) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLfloat data[VB_MAX_CLIPPED_VERTS * 12]; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GrVertex *verts[VB_MAX_CLIPPED_VERTS]; - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLfloat *out = data; - GLfloat *mat = ctx->Viewport.WindowMap.m; - GLuint i, n; - GLubyte *clipmask = VB->ClipMask; - - GLuint tmu0_source = fxMesa->tmu_source[0]; - GLuint tmu1_source = fxMesa->tmu_source[1]; - GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; - GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; - - (void) fxMesa; - (void) tmu0_source; - (void) tc0_vec; - (void) tmu1_source; - (void) tc1_vec; - - for (i = 0; i < 3; i++) { - GLuint e = v[i]; - verts[i] = 0; - if (!clipmask[e]) - verts[i] = (GrVertex *) gWin[e].f; - vlist[i] = out; - COPY_STRIDE; - out += SIZE; - } - - if ((n = fx_view_clip_triangle(ctx, vlist, verts, SIZE, mask)) >= 3) { - GrVertex tmp[VB_MAX_CLIPPED_VERTS]; - GrVertex *v = tmp, *v2, *v3; - VARS; - - for (i = 0; i < n; i++) - if (!verts[i]) { - GLfloat *data = vlist[i]; - SETUP; - verts[i] = v++; - } - - v = verts[0]; - v2 = verts[1]; - v3 = verts[2]; - - for (i = 2; i < n; v2 = v3, v3 = verts[++i]) - FX_grDrawTriangle(fxMesa, v, v2, v3); - } -} - - - - - -static void TAG(fx_tri_clip_stride) (struct vertex_buffer * VB, - GLuint v[], GLuint mask) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLfloat data[VB_MAX_CLIPPED_VERTS * 12]; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GrVertex *verts[VB_MAX_CLIPPED_VERTS]; - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLfloat *out = data; - GLfloat *mat = ctx->Viewport.WindowMap.m; - GLuint i, n; - GLubyte *clipmask = VB->ClipMask; - - GLuint tmu0_source = fxMesa->tmu_source[0]; - GLuint tmu1_source = fxMesa->tmu_source[1]; - GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; - GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; - - (void) fxMesa; - (void) tmu0_source; - (void) tc0_vec; - (void) tmu1_source; - (void) tc1_vec; - - for (i = 0; i < 3; i++) { - GLuint e = v[i]; - verts[i] = 0; - if (!clipmask[e]) - verts[i] = (GrVertex *) gWin[e].f; - vlist[i] = out; - COPY_STRIDE; - out += SIZE; - } - - if (VB->ClipPtr->size < 4) { - vlist[0][3] = vlist[1][3] = vlist[2][3] = 1.0; - if (VB->ClipPtr->size == 2) - vlist[0][2] = vlist[1][2] = vlist[2][2] = 0.0; - } - - if ((n = fx_clip_triangle(ctx, vlist, verts, SIZE, mask)) >= 3) { - GrVertex tmp[VB_MAX_CLIPPED_VERTS]; - GrVertex *v = tmp, *v2, *v3; - VARS; - - for (i = 0; i < n; i++) - if (!verts[i]) { - GLfloat *data = vlist[i]; - SETUP; - verts[i] = v++; - } - - v = verts[0]; - v2 = verts[1]; - v3 = verts[2]; - - for (i = 2; i < n; v2 = v3, v3 = verts[++i]) - FX_grDrawTriangle(fxMesa, v, v2, v3); - } -} - - - -static void TAG(fx_line_clip) (struct vertex_buffer * VB, - GLuint v1, GLuint v2, GLubyte mask) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLfloat data[VB_MAX_CLIPPED_VERTS * 12]; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GLfloat *out = data; - GLfloat *mat = ctx->Viewport.WindowMap.m; - GLfloat w = ctx->Line.Width * .5; - GLuint e, n; - - GLuint tmu0_source = fxMesa->tmu_source[0]; - GLuint tmu1_source = fxMesa->tmu_source[1]; - GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; - GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; - - VARS; - - (void) fxMesa; - (void) tmu0_source; - (void) tc0_vec; - (void) tmu1_source; - (void) tc1_vec; - - vlist[0] = out; - e = v1; - COPY_STRIDE; - out += SIZE; - - vlist[1] = out; - e = v2; - COPY_STRIDE; - out += SIZE; - - if (VB->ClipPtr->size < 4) { - vlist[0][3] = vlist[1][3] = 1.0; - if (VB->ClipPtr->size == 2) - vlist[0][2] = vlist[1][2] = 0.0; - } - - if ((n = fx_clip_line(ctx, vlist, SIZE, mask)) != 0) { - GrVertex gWin[2]; - GrVertex *v; - GLfloat *data; - - v = gWin; - data = vlist[0]; - SETUP; - - v++; - data = vlist[1]; - SETUP; - - DRAW_LINE(fxMesa, gWin, v, w); - } -} - - - -#undef V1 -#undef S1 -#undef C1 -#undef Z1 -#undef T1 - -#undef V2 -#undef S2 -#undef C2 -#undef Z2 -#undef T2 - -#undef V3 -#undef S3 -#undef C3 -#undef Z3 -#undef T3 - -#undef V4 -#undef S4 -#undef C4 -#undef Z4 -#undef T4 - -#undef VARS -#undef SETUP -#undef COPY -#undef COPY_STRIDE -#undef SIZE -#undef IND -#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.c b/xc/lib/GL/mesa/src/drv/tdfx/fxcva.c deleted file mode 100644 index 0ee144854..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.c +++ /dev/null @@ -1,482 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcva.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxcva.c - the CVA related code */ - -#include "fxdrv.h" -#include "fxtexman.h" -#include "mmath.h" -#include "vbindirect.h" -#include "pb.h" -#include "fxsetup.h" -#include "fxvsetup.h" -#include "fxcva.h" -#include "pipeline.h" -#include "stages.h" - -#define PRIM_POINTS 0 -#define PRIM_LINES 1 -#define PRIM_TRIS 2 -#define PRIM_CULLED 3 - - -static GLuint reduce_prim[GL_POLYGON + 2] = { - PRIM_POINTS, - PRIM_LINES, - PRIM_LINES, - PRIM_LINES, - PRIM_TRIS, - PRIM_TRIS, - PRIM_TRIS, - PRIM_TRIS, - PRIM_TRIS, - PRIM_TRIS, - PRIM_CULLED -}; - -typedef void (*mergefunc) (struct vertex_buffer * cvaVB, - struct vertex_buffer * VB, - const struct gl_prim_state * state, - GLuint start, GLuint count); - -static void -fxCvaRenderNoop(struct vertex_buffer *cvaVB, - struct vertex_buffer *VB, - const struct gl_prim_state *state, GLuint start, GLuint count) -{ -} - -static INLINE void -fxRenderClippedTriangle2(struct vertex_buffer *VB, - GLuint v1, GLuint v2, GLuint v3) -{ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLubyte *clipmask = VB->ClipMask; - GLubyte mask = clipmask[v1] | clipmask[v2] | clipmask[v3]; - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - if (!mask) { - FX_grDrawTriangle(fxMesa, (GrVertex *) gWin[v1].f, - (GrVertex *) gWin[v2].f, (GrVertex *) gWin[v3].f); - } - else if (!(clipmask[v1] & clipmask[v2] & clipmask[v3] & CLIP_ALL_BITS)) { - GLuint n; - GLuint vlist[VB_MAX_CLIPPED_VERTS]; - ASSIGN_3V(vlist, v1, v2, v3); - - n = (VB->ctx->poly_clip_tab[VB->ClipPtr->size]) (VB, 3, vlist, mask); - if (n >= 3) { - GLuint i, j0 = vlist[0]; - for (i = 2; i < n; i++) { - FX_grDrawTriangle(fxMesa, - (GrVertex *) gWin[j0].f, - (GrVertex *) gWin[vlist[i - 1]].f, - (GrVertex *) gWin[vlist[i]].f); - } - } - } -} - - -static mergefunc merge_and_render_tab[2][MAX_MERGABLE][PRIM_CULLED + 1]; - - -/* -#define CVA_VARS_RGBA \ - GLubyte (*color)[4] = VB->ColorPtr->data; \ - GLubyte (*cva_color)[4] = (cvaVB->ColorPtr = cvaVB->LitColor[0])->data; -*/ - -#define CVA_VARS_RGBA \ - GLubyte (*color)[4] = VB->ColorPtr->data; \ - GLubyte (*cva_color)[4] = cvaVB->ColorPtr->data; - - - -#undef DO_SETUP_RGBA -#if FX_USE_PARGB -#define DO_SETUP_RGBA \ -{ \ - GLubyte *col = color[i]; \ - PACK_4F_ARGB(GET_PARGB(v), col[3], col[0], col[1], col[2]); \ -} -#else -#define DO_SETUP_RGBA \ -{ \ - GLubyte *col = color[i]; \ - v[GR_VERTEX_R_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ - v[GR_VERTEX_G_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ - v[GR_VERTEX_B_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ - v[GR_VERTEX_A_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ -} -#endif /* FX_USE_PARGB */ - - -#define CVA_VARS_TMU0 \ - VARS_TMU0 \ - GLfloat (*cva_tex0)[4] = (cvaVB->TexCoordPtr[tmu0_source] = cvaVB->store.TexCoord[tmu0_source])->data; - -#define CVA_VARS_TMU1 \ - VARS_TMU1 \ - GLfloat (*cva_tex1)[4] = (cvaVB->TexCoordPtr[tmu1_source] = cvaVB->store.TexCoord[tmu1_source])->data; - - -#define INIT_RGBA (void) cva_color; -#define INIT_TMU0 (void) cva_tex0; (void) tmu0_stride; (void) tmu0_sz; -#define INIT_TMU1 (void) cva_tex1; (void) tmu1_stride; (void) tmu1_sz; - - -#define DRAW_POINT FX_grDrawPoint( fxMesa, (GrVertex *)v ) -#define DRAW_LINE FX_grDrawLine( fxMesa, (GrVertex *)v, (GrVertex *)prev_v ) -#define DRAW_TRI FX_grDrawTriangle( fxMesa, (GrVertex *)gWin[l[0]].f, (GrVertex *)gWin[l[1]].f, (GrVertex *)v ) -#define DRAW_TRI2 FX_grDrawTriangle( fxMesa, vl[0], vl[1], vl[2] ) -#define CLIP_LINE fxRenderClippedLine( cvaVB, e, prev ) -#define CLIP_OR_DRAW_TRI fxRenderClippedTriangle2( cvaVB, l[0], l[1], e ) -#define DIRECT 1 - -#define TAG(x) x -#define IDX 0 -#define VARS -#define INIT -#define INCR -#define MERGE_RAST -#define MERGE_VB -#include "fxcvatmp.h" - -#define TAG(x) x##RGBA -#define IDX SETUP_RGBA -#define VARS CVA_VARS_RGBA -#define INIT INIT_RGBA -#define INCR -#define MERGE_RAST DO_SETUP_RGBA -#define MERGE_VB COPY_4UBV(cva_color[e], color[i]) -#include "fxcvatmp.h" - -#define TAG(x) x##T0 -#define IDX SETUP_TMU0 -#define VARS CVA_VARS_TMU0 -#define INIT INIT_TMU0 -#define INCR , tmu0_data+=4 -#define MERGE_RAST DO_SETUP_TMU0 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data) -#include "fxcvatmp.h" - -#define TAG(x) x##T1 -#define IDX SETUP_TMU1 -#define VARS CVA_VARS_TMU1 -#define INIT INIT_TMU1 -#define INCR , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex1[e], tmu1_data) -#include "fxcvatmp.h" - -#define TAG(x) x##T0T1 -#define IDX SETUP_TMU0|SETUP_TMU1 -#define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 -#define INIT INIT_TMU0 INIT_TMU1 -#define INCR , tmu0_data+=4 , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_TMU0 DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ - COPY_2FV(cva_tex1[e], tmu1_data); -#include "fxcvatmp.h" - -#define TAG(x) x##RGBAT0 -#define IDX SETUP_RGBA|SETUP_TMU0 -#define VARS CVA_VARS_RGBA CVA_VARS_TMU0 -#define INIT INIT_RGBA INIT_TMU0 -#define INCR , tmu0_data+=4 -#define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU0 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ - COPY_4UBV(cva_color[e], color[i]); -#include "fxcvatmp.h" - -#define TAG(x) x##RGBAT1 -#define IDX SETUP_RGBA|SETUP_TMU1 -#define VARS CVA_VARS_RGBA CVA_VARS_TMU1 -#define INIT INIT_RGBA INIT_TMU1 -#define INCR , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex1[e], tmu1_data); \ - COPY_4UBV(cva_color[e], color[i]); -#include "fxcvatmp.h" - -#define TAG(x) x##RGBAT0T1 -#define IDX SETUP_RGBA|SETUP_TMU0|SETUP_TMU1 -#define VARS CVA_VARS_RGBA CVA_VARS_TMU0 CVA_VARS_TMU1 -#define INIT INIT_RGBA INIT_TMU0 INIT_TMU1 -#define INCR , tmu0_data+=4 , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU0 DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ - COPY_2FV(cva_tex1[e], tmu1_data); \ - COPY_4UBV(cva_color[e], color[i]); -#include "fxcvatmp.h" - - - -#undef DRAW_POINT -#undef DRAW_LINE -#undef DRAW_TRI -#undef CLIP_LINE -#undef CLIP_OR_DRAW_TRI -#undef DIRECT - -#define DRAW_POINT ctx->Driver.PointsFunc( ctx, e, e ) -#define DRAW_LINE ctx->Driver.LineFunc( ctx, e, prev, e ) -#define DRAW_TRI ctx->TriangleFunc( ctx, l[0], l[1], e, e ) -#define CLIP_LINE gl_render_clipped_line( ctx, e, prev ) -#define CLIP_OR_DRAW_TRI \ -do { \ - if (clip[l[0]] | clip[l[1]] | clip[e]) { \ - if (!(clip[l[0]] & clip[l[1]] & clip[e] & CLIP_ALL_BITS)) { \ - COPY_3V(vlist, l); \ - gl_render_clipped_triangle( ctx, 3, vlist, e ); \ - } \ - } \ - else ctx->TriangleFunc( ctx, l[0], l[1], e, e ); \ -} while (0) - - -#define DIRECT 0 - -#define TAG(x) x##_indirect -#define IDX 0 -#define VARS -#define INIT -#define INCR -#define MERGE_RAST -#define MERGE_VB -#include "fxcvatmp.h" - -#define TAG(x) x##RGBA_indirect -#define IDX SETUP_RGBA -#define VARS CVA_VARS_RGBA -#define INIT INIT_RGBA -#define INCR -#define MERGE_RAST DO_SETUP_RGBA -#define MERGE_VB COPY_4UBV(cva_color[e], color[i]) -#include "fxcvatmp.h" - -#define TAG(x) x##T0_indirect -#define IDX SETUP_TMU0 -#define VARS CVA_VARS_TMU0 -#define INIT INIT_TMU0 -#define INCR , tmu0_data+=4 -#define MERGE_RAST DO_SETUP_TMU0 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data) -#include "fxcvatmp.h" - -#define TAG(x) x##T1_indirect -#define IDX SETUP_TMU1 -#define VARS CVA_VARS_TMU1 -#define INIT INIT_TMU1 -#define INCR , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex1[e], tmu1_data) -#include "fxcvatmp.h" - -#define TAG(x) x##T0T1_indirect -#define IDX SETUP_TMU0|SETUP_TMU1 -#define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 -#define INIT INIT_TMU0 INIT_TMU1 -#define INCR , tmu0_data+=4 , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_TMU0 DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ - COPY_2FV(cva_tex1[e], tmu1_data); -#include "fxcvatmp.h" - -#define TAG(x) x##RGBAT0_indirect -#define IDX SETUP_RGBA|SETUP_TMU0 -#define VARS CVA_VARS_RGBA CVA_VARS_TMU0 -#define INIT INIT_RGBA INIT_TMU0 -#define INCR , tmu0_data+=4 -#define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU0 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ - COPY_4UBV(cva_color[e], color[i]); -#include "fxcvatmp.h" - -#define TAG(x) x##RGBAT1_indirect -#define IDX SETUP_RGBA|SETUP_TMU1 -#define VARS CVA_VARS_RGBA CVA_VARS_TMU1 -#define INIT INIT_RGBA INIT_TMU1 -#define INCR , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex1[e], tmu1_data); \ - COPY_4UBV(cva_color[e], color[i]); -#include "fxcvatmp.h" - -#define TAG(x) x##RGBAT0T1_indirect -#define IDX SETUP_RGBA|SETUP_TMU0|SETUP_TMU1 -#define VARS CVA_VARS_RGBA CVA_VARS_TMU0 CVA_VARS_TMU1 -#define INIT INIT_RGBA INIT_TMU0 INIT_TMU1 -#define INCR , tmu0_data+=4 , tmu1_data+=4 -#define MERGE_RAST DO_SETUP_RGBA DO_SETUP_TMU0 DO_SETUP_TMU1 -#define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ - COPY_2FV(cva_tex1[e], tmu1_data); \ - COPY_4UBV(cva_color[e], color[i]); -#include "fxcvatmp.h" - - - - -void -fxDDCvaInit() -{ - /* Call grDrawTriangle et al */ - init_cva(); - init_cvaT0(); - init_cvaT1(); - init_cvaT0T1(); - init_cvaRGBA(); - init_cvaRGBAT0(); - init_cvaRGBAT1(); - init_cvaRGBAT0T1(); - - /* Call ctx->TriangleFunc and friends */ - init_cva_indirect(); - init_cvaT0_indirect(); - init_cvaT1_indirect(); - init_cvaT0T1_indirect(); - init_cvaRGBA_indirect(); - init_cvaRGBAT0_indirect(); - init_cvaRGBAT1_indirect(); - init_cvaRGBAT0T1_indirect(); -} - - -void -fxDDCheckMergeAndRender(GLcontext * ctx, struct gl_pipeline_stage *d) -{ - GLuint inputs = ctx->RenderFlags & ~ctx->CVA.pre.outputs; - - if (!(ctx->TriangleCaps & DD_TRI_UNFILLED) && - (ctx->Array.Summary & VERT_OBJ_ANY)) { - d->inputs = (VERT_SETUP_PART | VERT_ELT | inputs); - d->outputs = 0; - d->type = PIPE_IMMEDIATE; - } - -/* gl_print_vert_flags("merge&render inputs", d->inputs); */ -} - - -/* static GLboolean edge_flag[GL_POLYGON+2] = { 0,0,0,0,1,0,0,1,0,1,0 }; */ - -void -fxDDMergeAndRender(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - struct vertex_buffer *cvaVB = ctx->CVA.VB; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint i, next, prim; - GLuint parity = VB->Parity; - GLuint count = VB->Count; - const struct gl_prim_state *state; - mergefunc func; - struct vertex_buffer *saved_vb = ctx->VB; - GLuint inputs = ctx->RenderFlags & ~ctx->CVA.pre.outputs; - GLuint flags = 0; - GLuint direct = (fxMesa->render_index == 0); - mergefunc(*tab)[PRIM_CULLED + 1] = merge_and_render_tab[direct]; - GLuint p = 0; - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - - /* May actually contain elements not present in fxMesa->setupindex, - * eg RGBA when flat shading. These need to be copied into the cva - * VB so that funcs like fxTriangleFlat will be able to reach them. - * - * This leads to some duplication of effort in the merge funcs. - */ - if (inputs & VERT_RGBA) { - cvaVB->ColorPtr = cvaVB->Color[0] = cvaVB->LitColor[0]; - cvaVB->Color[1] = cvaVB->LitColor[1]; - flags |= SETUP_RGBA; - } - - if (inputs & VERT_TEX0_ANY) { - cvaVB->TexCoordPtr[0] = cvaVB->store.TexCoord[0]; - flags |= fxMesa->tex_dest[0]; - } - - if (inputs & VERT_TEX1_ANY) { - cvaVB->TexCoordPtr[1] = cvaVB->store.TexCoord[1]; - flags |= fxMesa->tex_dest[1]; - } -#if 0 - fxPrintSetupFlags("FX cva merge & render", flags); -#endif - - if (cvaVB->ClipOrMask) - gl_import_client_data(cvaVB, ctx->RenderFlags, - VEC_WRITABLE | VEC_GOOD_STRIDE); - - ctx->VB = cvaVB; - - do { - for (i = VB->CopyStart; i < count; parity = 0, i = next) { - prim = VB->Primitive[i]; - next = VB->NextPrimitive[i]; - - state = gl_prim_state_machine[prim][parity]; - func = tab[flags][reduce_prim[prim]]; - func(cvaVB, VB, state, i, next); - - if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { - cvaVB->Specular = cvaVB->Spec[0]; - cvaVB->ColorPtr = cvaVB->Color[0]; - cvaVB->IndexPtr = cvaVB->Index[0]; - } - } - } while (ctx->Driver.MultipassFunc && ctx->Driver.MultipassFunc(VB, ++p)); - - - - if (ctx->PB->count > 0) - gl_flush_pb(ctx); - - ctx->VB = saved_vb; -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.h b/xc/lib/GL/mesa/src/drv/tdfx/fxcva.h deleted file mode 100644 index 98ae5f075..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcva.h,v 1.1 2000/09/24 13:51:14 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#ifndef _FXCVA_H_ -#define _FXCVA_H_ - - - -extern GLboolean fxMergeAndRenderCVA(struct vertex_buffer *VB, - struct vertex_buffer *cvaVB); - -extern void fxRenderCVAElements(struct vertex_buffer *VB, - GLenum mode, GLuint * elts, GLuint n); - -extern GLboolean fxCheckCVA(GLcontext * ctx); - -extern void fxPrecalcCVA(struct vertex_buffer *VB); - -extern void fxDDCheckMergeAndRender(GLcontext * ctx, - struct gl_pipeline_stage *d); - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h deleted file mode 100644 index 20523e33e..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h +++ /dev/null @@ -1,278 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h,v 1.1 2000/09/24 13:51:14 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -static void TAG(cva_render_points) (struct vertex_buffer * cvaVB, - struct vertex_buffer * VB, - const struct gl_prim_state * state, - GLuint start, GLuint count) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxVertex *gWin = FX_DRIVER_DATA(cvaVB)->verts; - const GLuint *elt = VB->EltPtr->data; - GLuint i; - - VARS; - INIT; - (void) fxMesa; - - if (cvaVB->ClipOrMask) { - const GLubyte *clip = cvaVB->ClipMask; - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - if (!clip[e]) { - GLfloat *v = gWin[e].f; - (void) v; - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - DRAW_POINT; - } - } - } - else { - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[e].f; - (void) v; - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - DRAW_POINT; - } - } -} - -static void TAG(cva_render_lines) (struct vertex_buffer * cvaVB, - struct vertex_buffer * VB, - const struct gl_prim_state * state, - GLuint start, GLuint count) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxVertex *gWin = FX_DRIVER_DATA(cvaVB)->verts; - const GLuint *elt = VB->EltPtr->data; - GLuint i; - - VARS; - INIT; - (void) fxMesa; - - if (cvaVB->ClipOrMask) { - const GLubyte *clip = cvaVB->ClipMask; - GLuint prev = 0; - GLfloat *prev_v = 0; - - (void) ctx; - - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[e].f; - - MERGE_VB; - - if (!clip[e]) - MERGE_RAST; - - if (state->draw) { - if (clip[e] | clip[prev]) - CLIP_LINE; - else - DRAW_LINE; - } - - prev = e; - prev_v = v; - state = state->next; - } - if (state->finish_loop) { - GLuint e = elt[start]; - GLfloat *v = gWin[e].f; - (void) v; - - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - - if (clip[e] | clip[prev]) - CLIP_LINE; - else - DRAW_LINE; - } - } - else { - GLuint prev = 0; - GLfloat *prev_v = 0; - - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[e].f; - - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - if (state->draw) - DRAW_LINE; - prev = e; - prev_v = v; - state = state->next; - } - if (state->finish_loop) { - GLuint e = elt[start]; - GLfloat *v = gWin[e].f; - (void) v; - - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - DRAW_LINE; - } - } -} - - -static void TAG(cva_render_tris) (struct vertex_buffer * cvaVB, - struct vertex_buffer * VB, - const struct gl_prim_state * state, - GLuint start, GLuint count) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxVertex *gWin = FX_DRIVER_DATA(cvaVB)->verts; - const GLuint *elt = VB->EltPtr->data; - GLuint i; - VARS; - INIT; - (void) fxMesa; - - if (cvaVB->ClipOrMask) { - GLuint vlist[VB_MAX_CLIPPED_VERTS]; - GLuint l[3]; - const GLubyte *clip = cvaVB->ClipMask; - - (void) vlist; - - for (i = start; i < count; i++ INCR) { - GLuint e = l[2] = elt[i]; - GLfloat *v = gWin[e].f; - (void) v; - - MERGE_VB; /* needed for clip-interp */ - - if (!clip[e]) { - MERGE_RAST; - } - - if (state->draw) - CLIP_OR_DRAW_TRI; - - - l[0] = l[state->v0]; - l[1] = l[state->v1]; - state = state->next; - } - } - else if (DIRECT) { - GrVertex *vl[3]; - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[elt[i]].f; - - vl[2] = (GrVertex *) v; - - (void) v; - (void) e; - - MERGE_RAST; - - if (state->draw) - DRAW_TRI2; - - vl[0] = vl[state->v0]; - vl[1] = vl[state->v1]; - state = state->next; - } - } - else { - GLuint l[3]; - for (i = start; i < count; i++ INCR) { - GLuint e = l[2] = elt[i]; - GLfloat *v = gWin[e].f; - (void) v; - - MERGE_VB; /* needed for ctx->trianglefunc? */ - MERGE_RAST; - - if (state->draw) - DRAW_TRI; - - l[0] = l[state->v0]; - l[1] = l[state->v1]; - state = state->next; - } - } -} - - -static void TAG(init_cva) (void) -{ - merge_and_render_tab[DIRECT][IDX][PRIM_POINTS] = TAG(cva_render_points); - merge_and_render_tab[DIRECT][IDX][PRIM_LINES] = TAG(cva_render_lines); - merge_and_render_tab[DIRECT][IDX][PRIM_TRIS] = TAG(cva_render_tris); - merge_and_render_tab[DIRECT][IDX][PRIM_CULLED] = fxCvaRenderNoop; -} - - -#undef IDX -#undef MERGE_RAST -#undef MERGE_VB -#undef VARS -#undef INIT -#undef INCR -#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxdd.c b/xc/lib/GL/mesa/src/drv/tdfx/fxdd.c deleted file mode 100644 index 4fbd469bd..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxdd.c +++ /dev/null @@ -1,2020 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxdd.c,v 1.3 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include <dlfcn.h> -#include "image.h" -#include "types.h" -#include "fxdrv.h" -#include "fxsetup.h" -#include "fxpipeline.h" -#include "fxddtex.h" -#include "fxtexman.h" -#include "enums.h" -#include "extensions.h" -#include "pb.h" - - -/* These are used in calls to FX_grColorMaskv() */ -static const GLboolean false4[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; -static const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE }; - -#if defined(FX_PXCONV_TABULAR) -/* These lookup table are used to extract RGB values in [0,255] from - * 16-bit pixel values. - */ -GLubyte FX_PixelToRArray[0x10000]; -GLubyte FX_PixelToGArray[0x10000]; -GLubyte FX_PixelToBArray[0x10000]; - -/* - * Initialize the FX_PixelTo{RGB} arrays. - * Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order. - */ -void -fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder) -{ - fxMesa->bgrOrder = bgrOrder; - /* - * We add a level of braces so that we can define the - * variable pixel here. - */ - { - GLuint pixel = 0; - for (pixel = 0; pixel <= 0xffff; pixel++) { - GLuint r, g, b; - if (bgrOrder) { - r = (pixel & 0x001F) << 3; - g = (pixel & 0x07E0) >> 3; - b = (pixel & 0xF800) >> 8; - } - else { - r = (pixel & 0xF800) >> 8; - g = (pixel & 0x07E0) >> 3; - b = (pixel & 0x001F) << 3; - } - r = r * 255 / 0xF8; /* fill in low-order bits */ - g = g * 255 / 0xFC; - b = b * 255 / 0xF8; - FX_PixelToRArray[pixel] = r; - FX_PixelToGArray[pixel] = g; - FX_PixelToBArray[pixel] = b; - } - } -} -#endif /* FX_PXCONV_TABULAR */ - -/**********************************************************************/ -/***** Miscellaneous functions *****/ -/**********************************************************************/ - - -/* Return buffer size information */ -static void -fxDDBufferSize(GLcontext * ctx, GLuint * width, GLuint * height) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDBufferSize(...) Start\n"); - } - - *width = fxMesa->width; - *height = fxMesa->height; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDBufferSize(...) End\n"); - } -} - - -/* Set current drawing color */ -static void -fxDDSetColor(GLcontext * ctx, GLubyte red, GLubyte green, - GLubyte blue, GLubyte alpha) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLubyte col[4]; - ASSIGN_4V(col, red, green, blue, alpha); - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDSetColor(%d,%d,%d,%d)\n", red, green, - blue, alpha); - } - fxMesa->color = FXCOLOR4(col); -} - - -/* Implements glClearColor() */ -static void -fxDDClearColor(GLcontext * ctx, GLubyte red, GLubyte green, - GLubyte blue, GLubyte alpha) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLubyte col[4]; - ASSIGN_4V(col, red, green, blue, 255); - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDClearColor(%d,%d,%d,%d)\n", red, green, - blue, alpha); - } - fxMesa->clearC = FXCOLOR4(col); - fxMesa->clearA = alpha; -} - - -/* Clear the color and/or depth buffers */ -static GLbitfield -fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all, - GLint x, GLint y, GLint width, GLint height) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); - const FxU32 clearD = (FxU32) (ctx->Depth.Clear * fxMesa->depthClear); - const FxU32 clearS = (FxU32) (ctx->Stencil.Clear); - GLbitfield softwareMask = mask & (DD_ACCUM_BIT); - GLuint stencil_size = - fxMesa->haveHwStencil ? fxMesa->glVis->StencilBits : 0; - - /* we can't clear accum buffers */ - mask &= ~(DD_ACCUM_BIT); - - if ((mask & DD_STENCIL_BIT) && !fxMesa->haveHwStencil) { - /* software stencil buffer */ - mask &= ~(DD_STENCIL_BIT); - softwareMask |= DD_STENCIL_BIT; - } - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDClear(%d,%d,%d,%d)\n", (int) x, (int) y, - (int) width, (int) height); - } - - if (colorMask != 0xffffffff) { - /* do masked color buffer clears in software */ - softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)); - mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); - } - - if (fxMesa->haveHwStencil) { - /* - * If we want to clear stencil, it must be enabled - * in the HW, even if the stencil test is not enabled - * in the OGL state. - */ - if (mask & DD_STENCIL_BIT) { - FX_grStencilMask_NoLock(0xFF /* ctx->Stencil.WriteMask*/ ); - /* set stencil ref value = desired clear value */ - FX_grStencilFunc_NoLock(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff); - FX_grStencilOp_NoLock(GR_STENCILOP_REPLACE, - GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE); - FX_grEnable_NoLock(GR_STENCIL_MODE_EXT); - } - else { - FX_grDisable_NoLock(GR_STENCIL_MODE_EXT); - } - } - - BEGIN_CLIP_LOOP(fxMesa) - - /* - * This could probably be done fancier but doing each possible case - * explicitly is less error prone. - */ - switch (mask & ~DD_STENCIL_BIT) { - case DD_BACK_LEFT_BIT | DD_DEPTH_BIT: - /* back buffer & depth */ - FX_grDepthMask_NoLock(FXTRUE); - FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask || !ctx->Depth.Test) { - FX_grDepthMask_NoLock(FXFALSE); - } - break; - case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT: - /* XXX it appears that the depth buffer isn't cleared when - * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set. - * This is a work-around/ - */ - /* clear depth */ - FX_grDepthMask_NoLock(FXTRUE); - FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); - FX_grColorMaskv_NoLock(ctx, false4); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - /* clear front */ - FX_grColorMaskv_NoLock(ctx, true4); - FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask || !ctx->Depth.Test) { - FX_grDepthMask_NoLock(FXFALSE); - } - break; - case DD_BACK_LEFT_BIT: - /* back buffer only */ - FX_grDepthMask_NoLock(FXFALSE); - FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - if (ctx->Depth.Mask && ctx->Depth.Test) { - FX_grDepthMask_NoLock(FXTRUE); - } - break; - case DD_FRONT_LEFT_BIT: - /* front buffer only */ - FX_grDepthMask_NoLock(FXFALSE); - FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - if (ctx->Depth.Mask && ctx->Depth.Test) { - FX_grDepthMask_NoLock(FXTRUE); - } - break; - case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT: - /* front and back */ - FX_grDepthMask_NoLock(FXFALSE); - FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - if (ctx->Depth.Mask && ctx->Depth.Test) { - FX_grDepthMask_NoLock(FXTRUE); - } - break; - case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT: - /* clear front */ - FX_grDepthMask_NoLock(FXFALSE); - FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - /* clear back and depth */ - FX_grDepthMask_NoLock(FXTRUE); - FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask || !ctx->Depth.Mask) { - FX_grDepthMask_NoLock(FXFALSE); - } - break; - case DD_DEPTH_BIT: - /* just the depth buffer */ - FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); - FX_grColorMaskv_NoLock(ctx, false4); - FX_grDepthMask_NoLock(FXTRUE); - if (stencil_size > 0) - FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD, - clearS); - else - FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD); - FX_grColorMaskv_NoLock(ctx, true4); - if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) - FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); - if (!ctx->Depth.Test || !ctx->Depth.Mask) - FX_grDepthMask_NoLock(FXFALSE); - break; - default: - /* clear no color buffers or depth buffer but might clear stencil */ - if ((stencil_size > 0) && (mask & DD_STENCIL_BIT)) { - FX_grDepthMask_NoLock(FXFALSE); - FX_grColorMaskv_NoLock(ctx, false4); - FX_grBufferClearExt_NoLock(fxMesa->clearC, - fxMesa->clearA, - clearD, - (FxU32) clearS); - if (ctx->Depth.Mask && ctx->Depth.Test) { - FX_grDepthMask_NoLock(FXTRUE); - } - FX_grColorMaskv_NoLock(ctx, true4); - } - break; - } - - END_CLIP_LOOP(fxMesa); - - if (fxMesa->haveHwStencil) { - if (ctx->Stencil.Enabled) { - /* restore stencil state to as it was before the clear */ - GrStencil_t sfail = fxConvertGLStencilOp(ctx->Stencil.FailFunc); - GrStencil_t zfail = fxConvertGLStencilOp(ctx->Stencil.ZFailFunc); - GrStencil_t zpass = fxConvertGLStencilOp(ctx->Stencil.ZPassFunc); - FX_grStencilOp_NoLock(sfail, zfail, zpass); - FX_grStencilMask_NoLock(ctx->Stencil.WriteMask); - FX_grStencilFunc_NoLock(ctx->Stencil.Function - GL_NEVER, - ctx->Stencil.Ref, ctx->Stencil.ValueMask); - FX_grEnable_NoLock(GR_STENCIL_MODE_EXT); - } - else { - FX_grDisable_NoLock(GR_STENCIL_MODE_EXT); - } - } - - return softwareMask; -} - - -/* Set the buffer used for drawing */ -/* XXX support for separate read/draw buffers hasn't been tested */ -static GLboolean -fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode); - } - - if (mode == GL_FRONT_LEFT) { - fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; - FX_grRenderBuffer(fxMesa, fxMesa->currentFB); - return GL_TRUE; - } - else if (mode == GL_BACK_LEFT) { - fxMesa->currentFB = GR_BUFFER_BACKBUFFER; - FX_grRenderBuffer(fxMesa, fxMesa->currentFB); - return GL_TRUE; - } - else if (mode == GL_NONE) { - FX_grColorMaskv(ctx, false4); - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - - -/* Set the buffer used for reading */ -/* XXX support for separate read/draw buffers hasn't been tested */ -static void -fxDDSetReadBuffer(GLcontext * ctx, GLframebuffer * buffer, GLenum mode) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - (void) buffer; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode); - } - - if (mode == GL_FRONT_LEFT) { - fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; - FX_grRenderBuffer(fxMesa, fxMesa->currentFB); - } - else if (mode == GL_BACK_LEFT) { - fxMesa->currentFB = GR_BUFFER_BACKBUFFER; - FX_grRenderBuffer(fxMesa, fxMesa->currentFB); - } -} - - -/* - * These functions just set new-state flags. The exact state - * values will be evaluated later. - */ -static void -fxDDStencilFunc(GLcontext * ctx, GLenum func, GLint ref, GLuint mask) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - (void) func; - (void) ref; - (void) mask; - fxMesa->new_state |= FX_NEW_STENCIL; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - -static void -fxDDStencilMask(GLcontext * ctx, GLuint mask) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - (void) mask; - fxMesa->new_state |= FX_NEW_STENCIL; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - -static void -fxDDStencilOp(GLcontext * ctx, GLenum sfail, GLenum zfail, GLenum zpass) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - (void) sfail; - (void) zfail; - (void) zpass; - fxMesa->new_state |= FX_NEW_STENCIL; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - -static void -fxDDDepthFunc(GLcontext * ctx, GLenum func) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - (void) func; - fxMesa->new_state |= FX_NEW_DEPTH; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - -static void -fxDDDepthMask(GLcontext * ctx, GLboolean mask) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - (void) mask; - fxMesa->new_state |= FX_NEW_DEPTH; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - - - -/* - * Return the current value of the occlusion test flag and - * reset the flag (hardware counters) to false. - */ -#if 0 -static GLboolean -get_occlusion_result(GLcontext *ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLboolean result; - - BEGIN_BOARD_LOCK(fxMesa); - - if (ctx->Depth.OcclusionTest) { - if (ctx->OcclusionResult) { - result = GL_TRUE; /* result of software rendering */ - } - else { - FxI32 zfail, in; - zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL); - in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN); - if (in == zfail) - result = GL_FALSE; /* geom was completely occluded */ - else - result = GL_TRUE; /* all or part of geom was visible */ - } - } - else { - result = ctx->OcclusionResultSaved; - } - - /* reset results now */ - grReset(GR_STATS_PIXELS); - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - - END_BOARD_LOCK(fxMesa); - - return result; -} -#else - -static GLboolean get_occlusion_result( GLcontext *ctx ) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLboolean result; - - LOCK_HARDWARE( fxMesa ); - - printf("start state: %d %d\n", ctx->Depth.OcclusionTest, ctx->OcclusionResult); - - if (ctx->Depth.OcclusionTest) { - if (ctx->OcclusionResult) { - result = GL_TRUE; /* result of software rendering */ - printf("res = true 1\n"); - } - else { - FxI32 zfail, in; - zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL); - in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN); - if (in == zfail) { - result = GL_FALSE; /* geom was completely occluded */ - printf("res = false 2\n"); - } - else { - result = GL_TRUE; /* all or part of geom was visible */ - printf("res = true 2\n"); - - } - } - } - else { - result = ctx->OcclusionResultSaved; - printf("res = saved\n"); - } - - /* reset results now */ - grReset(GR_STATS_PIXELS); - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - - UNLOCK_HARDWARE( fxMesa ); - - printf("result = %d\n", result); - return result; -} - -#endif - -/* - * We're only implementing this function to handle the - * GL_OCCLUSTION_TEST_RESULT_HP case. It's special because it - * has a side-effect: resetting the occlustion result flag. - */ -static GLboolean -fxDDGetBooleanv(GLcontext *ctx, GLenum pname, GLboolean *result) -{ - if (pname == GL_OCCLUSION_TEST_RESULT_HP) { - *result = get_occlusion_result(ctx); - return GL_TRUE; - } - return GL_FALSE; -} - - -static GLboolean -fxDDGetIntegerv(GLcontext *ctx, GLenum pname, GLint *result) -{ - if (pname == GL_OCCLUSION_TEST_RESULT_HP) { - *result = (GLint) get_occlusion_result(ctx); - return GL_TRUE; - } - return GL_FALSE; -} - - -static GLboolean -fxDDGetFloatv(GLcontext *ctx, GLenum pname, GLfloat *result) -{ - if (pname == GL_OCCLUSION_TEST_RESULT_HP) { - *result = (GLfloat) get_occlusion_result(ctx); - return GL_TRUE; - } - return GL_FALSE; -} - - -static GLboolean -fxDDGetDoublev(GLcontext *ctx, GLenum pname, GLdouble *result) -{ - if (pname == GL_OCCLUSION_TEST_RESULT_HP) { - *result = (GLdouble) get_occlusion_result(ctx); - return GL_TRUE; - } - return GL_FALSE; -} - - -/* test if window coord (px,py) is visible */ -static GLboolean -inClipRects(fxMesaContext fxMesa, int px, int py) -{ - int i; - for (i = 0; i < fxMesa->numClipRects; i++) { - if ((px >= fxMesa->pClipRects[i].x1) && - (px < fxMesa->pClipRects[i].x2) && - (py >= fxMesa->pClipRects[i].y1) && - (py < fxMesa->pClipRects[i].y2)) return GL_TRUE; - } - return GL_FALSE; -} - - - -static GLboolean -bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte * bitmap) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - FxU16 color; - const struct gl_pixelstore_attrib *finalUnpack; - struct gl_pixelstore_attrib scissoredUnpack; - - /* check if there's any raster operations enabled which we can't handle */ - if (ctx->RasterMask & (ALPHATEST_BIT | - BLEND_BIT | - DEPTH_BIT | - FOG_BIT | - LOGIC_OP_BIT | - SCISSOR_BIT | - STENCIL_BIT | - MASKING_BIT | - ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; - - if (ctx->Scissor.Enabled) { - /* This is a bit tricky, but by carefully adjusting the px, py, - * width, height, skipPixels and skipRows values we can do - * scissoring without special code in the rendering loop. - */ - - /* we'll construct a new pixelstore struct */ - finalUnpack = &scissoredUnpack; - scissoredUnpack = *unpack; - if (scissoredUnpack.RowLength == 0) - scissoredUnpack.RowLength = width; - - /* clip left */ - if (px < ctx->Scissor.X) { - scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); - width -= (ctx->Scissor.X - px); - px = ctx->Scissor.X; - } - /* clip right */ - if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { - width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); - } - /* clip bottom */ - if (py < ctx->Scissor.Y) { - scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); - height -= (ctx->Scissor.Y - py); - py = ctx->Scissor.Y; - } - /* clip top */ - if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { - height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); - } - - if (width <= 0 || height <= 0) - return GL_TRUE; /* totally scissored away */ - } - else { - finalUnpack = unpack; - } - - /* compute pixel value */ - { - GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); - GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); - GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); - /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f); */ - if (fxMesa->bgrOrder) { - color = (FxU16) - (((FxU16) 0xf8 & b) << (11 - 3)) | - (((FxU16) 0xfc & g) << (5 - 3 + 1)) | - (((FxU16) 0xf8 & r) >> 3); - } - else - color = (FxU16) - (((FxU16) 0xf8 & r) << (11 - 3)) | - (((FxU16) 0xfc & g) << (5 - 3 + 1)) | - (((FxU16) 0xf8 & b) >> 3); - } - - info.size = sizeof(info); - if (!FX_grLfbLock(fxMesa, - GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_565, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { -#ifndef FX_SILENT - fprintf(stderr, "fx Driver: error locking the linear frame buffer\n"); -#endif - return GL_TRUE; - } - - { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - /* The dest stride depends on the hardware and whether we're drawing - * to the front or back buffer. This compile-time test seems to do - * the job for now. - */ - const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - GLint row; - /* compute dest address of bottom-left pixel in bitmap */ - GLushort *dst = (GLushort *) info.lfbPtr - + (winY - py) * dstStride + (winX + px); - - for (row = 0; row < height; row++) { - const GLubyte *src = - (const GLubyte *) _mesa_image_address(finalUnpack, - bitmap, width, height, - GL_COLOR_INDEX, - GL_BITMAP, 0, row, 0); - if (finalUnpack->LsbFirst) { - /* least significan bit first */ - GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); - GLint col; - for (col = 0; col < width; col++) { - if (*src & mask) { - if (inClipRects(fxMesa, winX + px + col, winY - py - row)) - dst[col] = color; - } - if (mask == 128U) { - src++; - mask = 1U; - } - else { - mask = mask << 1; - } - } - if (mask != 1) - src++; - } - else { - /* most significan bit first */ - GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); - GLint col; - for (col = 0; col < width; col++) { - if (*src & mask) { - if (inClipRects(fxMesa, winX + px + col, winY - py - row)) - dst[col] = color; - } - if (mask == 1U) { - src++; - mask = 128U; - } - else { - mask = mask >> 1; - } - } - if (mask != 128) - src++; - } - dst -= dstStride; - } - } - - FX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); - return GL_TRUE; -} - - -static GLboolean -bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte * bitmap) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - GLuint color; - const struct gl_pixelstore_attrib *finalUnpack; - struct gl_pixelstore_attrib scissoredUnpack; - - /* check if there's any raster operations enabled which we can't handle */ - if (ctx->RasterMask & (ALPHATEST_BIT | - BLEND_BIT | - DEPTH_BIT | - FOG_BIT | - LOGIC_OP_BIT | - SCISSOR_BIT | - STENCIL_BIT | - MASKING_BIT | - ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; - - if (ctx->Scissor.Enabled) { - /* This is a bit tricky, but by carefully adjusting the px, py, - * width, height, skipPixels and skipRows values we can do - * scissoring without special code in the rendering loop. - */ - - /* we'll construct a new pixelstore struct */ - finalUnpack = &scissoredUnpack; - scissoredUnpack = *unpack; - if (scissoredUnpack.RowLength == 0) - scissoredUnpack.RowLength = width; - - /* clip left */ - if (px < ctx->Scissor.X) { - scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); - width -= (ctx->Scissor.X - px); - px = ctx->Scissor.X; - } - /* clip right */ - if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { - width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); - } - /* clip bottom */ - if (py < ctx->Scissor.Y) { - scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); - height -= (ctx->Scissor.Y - py); - py = ctx->Scissor.Y; - } - /* clip top */ - if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { - height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); - } - - if (width <= 0 || height <= 0) - return GL_TRUE; /* totally scissored away */ - } - else { - finalUnpack = unpack; - } - - /* compute pixel value */ - { - GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); - GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); - GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); - GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0f); - color = PACK_BGRA32(r, g, b, a); - } - - info.size = sizeof(info); - if (!FX_grLfbLock(fxMesa, GR_LFB_WRITE_ONLY, - fxMesa->currentFB, GR_LFBWRITEMODE_8888, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { -#ifndef FX_SILENT - fprintf(stderr, "fx Driver: error locking the linear frame buffer\n"); -#endif - return GL_TRUE; - } - - { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - GLint dstStride; - GLuint *dst; - GLint row; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - dstStride = fxMesa->screen_width; - dst = - (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + - px); - } - else { - dstStride = info.strideInBytes / 4; - dst = - (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + - px); - } - - /* compute dest address of bottom-left pixel in bitmap */ - for (row = 0; row < height; row++) { - const GLubyte *src = - (const GLubyte *) _mesa_image_address(finalUnpack, - bitmap, width, height, - GL_COLOR_INDEX, - GL_BITMAP, 0, row, 0); - if (finalUnpack->LsbFirst) { - /* least significan bit first */ - GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); - GLint col; - for (col = 0; col < width; col++) { - if (*src & mask) { - if (inClipRects(fxMesa, winX + px + col, winY - py - row)) - dst[col] = color; - } - if (mask == 128U) { - src++; - mask = 1U; - } - else { - mask = mask << 1; - } - } - if (mask != 1) - src++; - } - else { - /* most significan bit first */ - GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); - GLint col; - for (col = 0; col < width; col++) { - if (*src & mask) { - if (inClipRects(fxMesa, winX + px + col, winY - py - row)) - dst[col] = color; - } - if (mask == 1U) { - src++; - mask = 128U; - } - else { - mask = mask >> 1; - } - } - if (mask != 128) - src++; - } - dst -= dstStride; - } - } - - FX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); - return GL_TRUE; -} - - -static GLboolean -readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *packing, - GLvoid * dstImage) -{ - if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { - return GL_FALSE; /* can't do this */ - } - else { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - GLboolean result = GL_FALSE; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint srcStride = - (fxMesa->glCtx->Color.DrawBuffer == - GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / - 2); - const GLushort *src = (const GLushort *) info.lfbPtr - + (winY - y) * srcStride + (winX + x); - GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage, - width, height, - format, type, 0, 0, - 0); - GLint dstStride = - _mesa_image_row_stride(packing, width, format, type); - - if (format == GL_RGB && type == GL_UNSIGNED_BYTE) { - /* convert 5R6G5B into 8R8G8B */ - GLint row, col; - const GLint halfWidth = width >> 1; - const GLint extraPixel = (width & 1); - for (row = 0; row < height; row++) { - GLubyte *d = dst; - for (col = 0; col < halfWidth; col++) { - const GLuint pixel = ((const GLuint *) src)[col]; - const GLint pixel0 = pixel & 0xffff; - const GLint pixel1 = pixel >> 16; - *d++ = FX_PixelToR(fxMesa, pixel0); - *d++ = FX_PixelToG(fxMesa, pixel0); - *d++ = FX_PixelToB(fxMesa, pixel0); - *d++ = FX_PixelToR(fxMesa, pixel1); - *d++ = FX_PixelToG(fxMesa, pixel1); - *d++ = FX_PixelToB(fxMesa, pixel1); - } - if (extraPixel) { - GLushort pixel = src[width - 1]; - *d++ = FX_PixelToR(fxMesa, pixel); - *d++ = FX_PixelToG(fxMesa, pixel); - *d++ = FX_PixelToB(fxMesa, pixel); - } - dst += dstStride; - src -= srcStride; - } - result = GL_TRUE; - } - else if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { - /* convert 5R6G5B into 8R8G8B8A */ - GLint row, col; - const GLint halfWidth = width >> 1; - const GLint extraPixel = (width & 1); - for (row = 0; row < height; row++) { - GLubyte *d = dst; - for (col = 0; col < halfWidth; col++) { - const GLuint pixel = ((const GLuint *) src)[col]; - const GLint pixel0 = pixel & 0xffff; - const GLint pixel1 = pixel >> 16; - *d++ = FX_PixelToR(fxMesa, pixel0); - *d++ = FX_PixelToG(fxMesa, pixel0); - *d++ = FX_PixelToB(fxMesa, pixel0); - *d++ = 255; - *d++ = FX_PixelToR(fxMesa, pixel1); - *d++ = FX_PixelToG(fxMesa, pixel1); - *d++ = FX_PixelToB(fxMesa, pixel1); - *d++ = 255; - } - if (extraPixel) { - const GLushort pixel = src[width - 1]; - *d++ = FX_PixelToR(fxMesa, pixel); - *d++ = FX_PixelToG(fxMesa, pixel); - *d++ = FX_PixelToB(fxMesa, pixel); - *d++ = 255; - } - dst += dstStride; - src -= srcStride; - } - result = GL_TRUE; - } - else if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { - /* directly memcpy 5R6G5B pixels into client's buffer */ - const GLint widthInBytes = width * 2; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, widthInBytes); - dst += dstStride; - src -= srcStride; - } - result = GL_TRUE; - } - else { - result = GL_FALSE; - } - - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); - return result; - } -} - - - -static GLboolean -readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *packing, - GLvoid * dstImage) -{ - if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) - && !(format == GL_BGRA && type == GL_UNSIGNED_BYTE) - && !(format == GL_RGBA && type == GL_UNSIGNED_BYTE)) { - return GL_FALSE; /* format/type not optimised */ - } - - if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { - return GL_FALSE; /* can't do this */ - } - - { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - GLboolean result = GL_FALSE; - - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 4); - const GLuint *src = (const GLuint *) info.lfbPtr - + scrY * srcStride + scrX; - const GLint dstStride = - _mesa_image_row_stride(packing, width, format, type); - const GLubyte *dst = (GLubyte *) _mesa_image_address(packing, - dstImage, width, height, format, type, 0, 0, 0); - - if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) - || (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { - const GLint widthInBytes = width * 4; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, widthInBytes); - dst += dstStride; - src -= srcStride; - } - result = GL_TRUE; - } else - if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { - const GLint widthInBytes = width * 4; - GLuint *dstp = (GLuint *)dst; - GLint row; - GLint i; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, widthInBytes); - dst += dstStride; - src -= srcStride; - /* Data is in memory in BGRA format */ - /* We need to swap R & B values */ - for (i = 0; i < width; i++, dstp++) { - char *dstp0 = ((char *)(dstp)) + 0; - char *dstp2 = ((char *)(dstp)) + 2; - *dstp0 ^= *dstp2; - *dstp2 ^= *dstp0; - *dstp0 ^= *dstp2; - } - } - result = GL_TRUE; - } - - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); - return result; - } -} - - - -static GLboolean -drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid * pixels) -{ - if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) - && !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { - return GL_FALSE; /* format/type not optimised */ - } - - if (ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F) { - return GL_FALSE; /* can't scale pixels */ - } - - if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { - return GL_FALSE; /* can't do this */ - } - - if (ctx->RasterMask) { - return GL_FALSE; /* can't do any raster ops */ - } - - { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - GLboolean result = GL_FALSE; - - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - - /* look for clipmasks, giveup if region obscured */ - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - int i; - for (i = 0; i < fxMesa->numClipRects; i++) { - const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; - - if (scrY < rect->y1 || scrY+height > rect->y2) { - if (scrX < rect->x1 || scrX+width > rect->x2) { - return GL_FALSE; /* dst is obscured */ - } - } - } - } - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_8888, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width * 4) : (info.strideInBytes); - const GLubyte *dst = (const GLubyte *) info.lfbPtr - + scrY * dstStride + scrX * 4; - const GLint srcStride = - _mesa_image_row_stride(unpack, width, format, type); - const GLubyte *src = (GLubyte *) _mesa_image_address(unpack, - pixels, width, height, format, type, 0, 0, 0); - - if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) - || (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { - const GLint widthInBytes = width * 4; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, widthInBytes); - dst -= dstStride; - src += srcStride; - } - result = GL_TRUE; - } - - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); - return result; - } -} - - -static GLboolean -drawpixels_R8G8B8A8_v2(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid * pixels) -{ - if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) - && !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { - return GL_FALSE; /* format/type not optimised */ - } - - if (ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F) { - return GL_FALSE; /* can't scale pixels */ - } - - if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { - return GL_FALSE; /* can't do this */ - } - - if (ctx->RasterMask & (~BLEND_BIT)) { - return GL_FALSE; /* can't do any raster ops, except blend */ - } - - { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - GLboolean result = GL_FALSE; - - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - - /* look for clipmasks, giveup if region obscured */ - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - int i; - for (i = 0; i < fxMesa->numClipRects; i++) { - const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; - - if (scrY < rect->y1 || scrY+height > rect->y2) { - if (scrX < rect->x1 || scrX+width > rect->x2) { - return GL_FALSE; /* dst is obscured */ - } - } - } - } - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_8888, GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) { - const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width * 4) : (info.strideInBytes); - const GLubyte *dst = (const GLubyte *) info.lfbPtr - + scrY * dstStride + scrX * 4; - const GLint srcStride = - _mesa_image_row_stride(unpack, width, format, type); - const GLubyte *src = (GLubyte *) _mesa_image_address(unpack, - pixels, width, height, format, type, 0, 0, 0); - - void *grState = NULL; - GLint grSize; - - if (grGet(GR_GLIDE_STATE_SIZE, sizeof(grSize), (void *) &grSize)) { - if ((grState = malloc(grSize)) != 0) { - grGlideGetState(grState); - } - } - - if (ctx->RasterMask & BLEND_BIT) { - grDisableAllEffects(); - grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, - GR_BLEND_ONE_MINUS_SRC_ALPHA, - GR_BLEND_ONE, - GR_BLEND_ZERO); - grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_OTHER_ALPHA, - GR_COMBINE_LOCAL_NONE, - GR_COMBINE_OTHER_ITERATED, - FXFALSE); - grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_OTHER_ALPHA, - GR_COMBINE_LOCAL_ITERATED, - GR_COMBINE_OTHER_ITERATED, - FXFALSE); - } - - if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) - || (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { - const GLint widthInBytes = width * 4; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, widthInBytes); - dst -= dstStride; - src += srcStride; - } - result = GL_TRUE; - } - - if (grState) { - grGlideSetState(grState); - free(grState); - } - - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); - return result; - } -} - - -static void -fxDDFinish(GLcontext *ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - FX_grFinish(fxMesa); -} - - -static void -fxDDFlush(GLcontext *ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - FX_grFlush(fxMesa); -} - - -static GLint -fxDDGetParameteri(const GLcontext * ctx, GLint param) -{ - switch (param) { - case DD_HAVE_HARDWARE_FOG: - return 1; - default: - fprintf(stderr, - "fx Driver: internal error in fxDDGetParameteri(): %x\n", - (int) param); - return 0; - } -} - - -static void -fxDDSetNearFar(GLcontext * ctx, GLfloat n, GLfloat f) -{ - FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - - -/* KW: Put the word Mesa in the render string because quakeworld - * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE). - * Why? - */ -static const GLubyte * -fxDDGetString(GLcontext * ctx, GLenum name) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - switch (name) { - case GL_RENDERER: - { - static char buffer[100]; - char hardware[100]; - strcpy(hardware, FX_grGetString(fxMesa, GR_HARDWARE)); - if (strcmp(hardware, "Voodoo3 (tm)") == 0) - strcpy(hardware, "Voodoo3"); - else if (strcmp(hardware, "Voodoo4 (tm)") == 0) - strcpy(hardware, "Voodoo4"); - else if (strcmp(hardware, "Voodoo5 (tm)") == 0) - strcpy(hardware, "Voodoo5"); - else if (strcmp(hardware, "Voodoo Banshee (tm)") == 0) - strcpy(hardware, "VoodooBanshee"); - else { - /* unexpected result: replace spaces with hyphens */ - int i; - for (i = 0; hardware[i]; i++) { - if (hardware[i] == ' ' || hardware[i] == '\t') - hardware[i] = '-'; - } - } - /* now make the GL_RENDERER string */ - sprintf(buffer, "Mesa DRI %s 20001101", hardware); - return buffer; - } - case GL_VENDOR: - return "VA Linux Systems, Inc."; - default: - return NULL; - } -} - - -#if 0 -/* Example extension function */ -static void -fxFooBarEXT(GLint i) -{ - printf("You called glFooBarEXT(%d)\n", i); -} -#endif - - - -/* - * Enable/Disable the extensions for this context. - */ -static void -fxDDInitExtensions(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - gl_extensions_disable(ctx, "GL_EXT_blend_logic_op"); - gl_extensions_disable(ctx, "GL_EXT_blend_minmax"); - gl_extensions_disable(ctx, "GL_EXT_blend_subtract"); - gl_extensions_disable(ctx, "GL_EXT_blend_color"); - gl_extensions_disable(ctx, "GL_EXT_blend_func_separate"); - gl_extensions_disable(ctx, "GL_INGR_blend_func_separate"); - gl_extensions_enable(ctx, "GL_HP_occlusion_test"); - - if (!fxMesa->haveTwoTMUs) - gl_extensions_disable(ctx, "GL_EXT_texture_env_add"); - - if (!fxMesa->emulateTwoTMUs) - gl_extensions_disable(ctx, "GL_ARB_multitexture"); - - if (fxMesa->isNapalm) { - gl_extensions_enable(ctx, "GL_ARB_texture_compression"); - gl_extensions_enable(ctx, "GL_3DFX_texture_compression_FXT1"); - { - char *legacy_str = getenv("FX_GL_COMPRESS_LEGACY_TEXTURES"); - if (!legacy_str || ((legacy_str[0] == '0') - && (legacy_str[1] == '\0'))) { - gl_extensions_add(ctx, ALWAYS_ENABLED, "GL_S3_s3tc", 0); - } - } - gl_extensions_enable(ctx, "GL_EXT_texture_env_combine"); - } - - /* Example of hooking in an extension function. - * For DRI-based drivers, also see __driRegisterExtensions in the - * tdfx_xmesa.c file. - */ -#if 0 - { - void **dispatchTable = (void **) ctx->Exec; - const int _gloffset_FooBarEXT = 555; /* just an example number! */ - const int tabSize = _glapi_get_dispatch_table_size(); - assert(_gloffset_FooBarEXT < tabSize); - dispatchTable[_gloffset_FooBarEXT] = (void *) fxFooBarEXT; - /* XXX You would also need to hook into the display list dispatch - * table. Really, the implementation of extensions might as well - * be in the core of Mesa since core Mesa and the device driver - * is one big shared lib. - */ - } -#endif -} - - - -/* - * Initialize the state in an fxMesaContext struct. - */ -int -fxDDInitFxMesaContext(fxMesaContext fxMesa) -{ - /* Get Glide3 extension function pointers */ - { - void *handle = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); - if (!handle) { - txImgQuantizePtr = NULL; - txImgDequantizeFXT1Ptr = NULL; - txErrorSetCallbackPtr = NULL; - grStencilFuncPtr = NULL; - grStencilMaskPtr = NULL; - grStencilOpPtr = NULL; - grBufferClearExtPtr = NULL; - grColorMaskExtPtr = NULL; - grColorCombineExtPtr = NULL; - grTexColorCombineExtPtr = NULL; - grAlphaCombineExtPtr = NULL; - grTexAlphaCombineExtPtr = NULL; - grAlphaBlendFunctionExtPtr = NULL; - grConstantColorValueExtPtr = NULL; - return 0; - } - else { - /* - * These are not exported by Glide. - */ - txImgQuantizePtr = dlsym(handle, "txImgQuantize"); - txImgDequantizeFXT1Ptr = dlsym(handle, "_txImgDequantizeFXT1"); - txErrorSetCallbackPtr = dlsym(handle, "txErrorSetCallback"); - grStencilFuncPtr = dlsym(handle, "grStencilFunc"); - grStencilMaskPtr = dlsym(handle, "grStencilMask"); - grStencilOpPtr = dlsym(handle, "grStencilOp"); - grBufferClearExtPtr = dlsym(handle, "grBufferClearExt"); - grColorMaskExtPtr = dlsym(handle, "grColorMaskExt"); - grColorCombineExtPtr = dlsym(handle, "grColorCombineExt"); - grTexColorCombineExtPtr = dlsym(handle, "grTexColorCombineExt"); - grAlphaCombineExtPtr = dlsym(handle, "grAlphaCombineExt"); - grTexAlphaCombineExtPtr = dlsym(handle, "grTexAlphaCombineExt"); - grAlphaBlendFunctionExtPtr = dlsym(handle, "grAlphaBlendFunctionExt"); - grConstantColorValueExtPtr = dlsym(handle, "grConstantColorValueExt"); - } - dlclose(handle); - } - - FX_setupGrVertexLayout(fxMesa); - - if (getenv("FX_EMULATE_SINGLE_TMU")) - fxMesa->haveTwoTMUs = GL_FALSE; - - fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs; - - if (!getenv("FX_DONT_FAKE_MULTITEX")) - fxMesa->emulateTwoTMUs = GL_TRUE; - - if (getenv("FX_GLIDE_SWAPINTERVAL")) - fxMesa->swapInterval = atoi(getenv("FX_GLIDE_SWAPINTERVAL")); - else - fxMesa->swapInterval = 1; - - if (getenv("MESA_FX_SWAP_PENDING")) - fxMesa->maxPendingSwapBuffers = atoi(getenv("MESA_FX_SWAP_PENDING")); - else - fxMesa->maxPendingSwapBuffers = 2; - - if (getenv("MESA_FX_INFO")) - fxMesa->verbose = GL_TRUE; - else - fxMesa->verbose = GL_FALSE; - -#if 0 - printf("haveTwoTMUs=%d emulateTwoTMUs=%d\n", - fxMesa->haveTwoTMUs, fxMesa->emulateTwoTMUs); -#endif - - fxMesa->depthClear = FX_grGetInteger(fxMesa, FX_ZDEPTH_MAX); - - fxMesa->color = 0xffffffff; - fxMesa->clearC = 0; - fxMesa->clearA = 0; - - fxMesa->stats.swapBuffer = 0; - fxMesa->stats.reqTexUpload = 0; - fxMesa->stats.texUpload = 0; - fxMesa->stats.memTexUpload = 0; - - fxMesa->tmuSrc = FX_TMU_NONE; - fxTMInit(fxMesa); - - /* FX units setup */ - fxMesa->unitsState.alphaTestEnabled = GL_FALSE; - fxMesa->unitsState.alphaTestFunc = GR_CMP_ALWAYS; - fxMesa->unitsState.alphaTestRefValue = 0; - - fxMesa->unitsState.blendEnabled = GL_FALSE; - fxMesa->unitsState.blendSrcFuncRGB = GR_BLEND_ONE; - fxMesa->unitsState.blendDstFuncRGB = GR_BLEND_ZERO; - fxMesa->unitsState.blendSrcFuncAlpha = GR_BLEND_ONE; - fxMesa->unitsState.blendDstFuncAlpha = GR_BLEND_ZERO; - - /* - fxMesa->unitsState.depthTestEnabled = GL_FALSE; - fxMesa->unitsState.depthMask = GL_TRUE; - fxMesa->unitsState.depthTestFunc = GR_CMP_LESS; - */ - - FX_grColorMaskv(fxMesa->glCtx, true4); - if (fxMesa->glVis->DBflag) { - fxMesa->currentFB = GR_BUFFER_BACKBUFFER; - FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER); - } - else { - fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; - FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER); - } - - fxMesa->state = NULL; - fxMesa->fogTable = NULL; - - fxMesa->state = malloc(FX_grGetInteger(fxMesa, FX_GLIDE_STATE_SIZE)); - fxMesa->fogTable = - malloc(FX_grGetInteger(fxMesa, FX_FOG_TABLE_ENTRIES) * sizeof(GrFog_t)); - - if (!fxMesa->state || !fxMesa->fogTable) { - if (fxMesa->state) - free(fxMesa->state); - if (fxMesa->fogTable) - free(fxMesa->fogTable); - return 0; - } - - if (fxMesa->glVis->DepthBits > 0) - FX_grDepthBufferMode(fxMesa, GR_DEPTHBUFFER_ZBUFFER); - - FX_grLfbWriteColorFormat(fxMesa, GR_COLORFORMAT_ABGR); - - fxMesa->textureAlign = FX_grGetInteger(fxMesa, FX_TEXTURE_ALIGN); - if (fxMesa->isNapalm) { - fxMesa->glCtx->Const.MaxTextureLevels = 12; - fxMesa->glCtx->Const.MaxTextureSize = 2048; - fxMesa->glCtx->Const.NumCompressedTextureFormats = 1; - } - else { - fxMesa->glCtx->Const.MaxTextureLevels = 9; - fxMesa->glCtx->Const.MaxTextureSize = 256; - fxMesa->glCtx->Const.NumCompressedTextureFormats = 0; - } - fxMesa->glCtx->Const.MaxTextureUnits = fxMesa->emulateTwoTMUs ? 2 : 1; - fxMesa->glCtx->NewState |= NEW_DRVSTATE1; - fxMesa->new_state = NEW_ALL; - - fxDDSetupInit(); - fxDDCvaInit(); - fxDDClipInit(); - fxDDTrifuncInit(); - fxDDFastPathInit(); - - fxSetupDDPointers(fxMesa->glCtx); - fxDDRenderInit(fxMesa->glCtx); - fxDDInitExtensions(fxMesa->glCtx); - - fxDDSetNearFar(fxMesa->glCtx, 1.0, 100.0); - - FX_grGlideGetState(fxMesa, (GrState *) fxMesa->state); - - /* XXX Fix me: callback not registered when main VB is created. - */ - if (fxMesa->glCtx->VB) - fxDDRegisterVB(fxMesa->glCtx->VB); - - /* XXX Fix me too: need to have the 'struct dd' prepared prior to - * creating the context... The below is broken if you try to insert - * new stages. - */ - if (fxMesa->glCtx->NrPipelineStages) - fxMesa->glCtx->NrPipelineStages = - fxDDRegisterPipelineStages(fxMesa->glCtx->PipelineStage, - fxMesa->glCtx->PipelineStage, - fxMesa->glCtx->NrPipelineStages); - - /* this little bit ensures that all Glide state gets initialized */ - fxMesa->new_state = NEW_ALL; - fxMesa->glCtx->Driver.RenderStart = fxSetupFXUnits; - -#if defined(FX_PXCONV_TABULAR) - fxInitPixelTables(fxMesa, GL_FALSE); /* Load tables of pixel colors */ -#endif /* FX_PXCONV_TABULAR */ - - /* Run the config file */ - gl_context_initialize(fxMesa->glCtx); - - return 1; -} - - - -/* Check if the hardware supports the current context - * - * Performs similar work to fxDDChooseRenderState() - should be merged. - */ -static GLboolean -fxIsInHardware(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (!ctx->Hint.AllowDrawMem) - return GL_TRUE; /* you'll take it and like it */ - - if (ctx->Color.BlendEnabled - && ctx->Color.BlendEquation != GL_FUNC_ADD_EXT) { - return GL_FALSE; - } - - if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) { - return GL_FALSE; - } - - if (ctx->Light.Enabled && - ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) { - return GL_FALSE; - } - - if (ctx->Visual->RedBits < 8 && - (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] || - ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP])) { - /* can't individually mask R, G, B in 16bpp/Voodoo3 mode */ - return GL_FALSE; - } - - -#if 000 - if ( - ((ctx->Color.BlendEnabled) - && (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT)) - || ((ctx->Color.ColorLogicOpEnabled) - && (ctx->Color.LogicOp != GL_COPY)) - || (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) - || - (!((ctx->Color.ColorMask[RCOMP] == ctx->Color.ColorMask[GCOMP]) - && (ctx->Color.ColorMask[GCOMP] == ctx->Color.ColorMask[BCOMP]) - && (ctx->Color.ColorMask[ACOMP] == ctx->Color.ColorMask[ACOMP]))) - ) { - return GL_FALSE; - } -#endif - - - /* Unsupported texture/multitexture cases */ - - if (fxMesa->emulateTwoTMUs) { - if ((ctx->Enabled & (TEXTURE0_3D | TEXTURE1_3D)) || - /* Not very well written ... */ - ((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) && - ((ctx->Enabled & (TEXTURE0_2D | TEXTURE1_2D)) != - (TEXTURE0_2D | TEXTURE1_2D)))) { - return GL_FALSE; - } - - if (ctx->Texture.ReallyEnabled & TEXTURE0_2D) { -#if 0 - if (ctx->Texture.Unit[0].EnvMode == GL_BLEND) { - return GL_FALSE; - } -#endif - if (!fxMesa->isNapalm && - ctx->Texture.Unit[0].EnvMode == GL_BLEND && - (ctx->Texture.ReallyEnabled & TEXTURE1_2D || - ctx->Texture.Unit[0].EnvColor[0] != 0 || - ctx->Texture.Unit[0].EnvColor[1] != 0 || - ctx->Texture.Unit[0].EnvColor[2] != 0 || - ctx->Texture.Unit[0].EnvColor[3] != 1)) { - return GL_FALSE; - } - if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0) - return GL_FALSE; - } - - if (ctx->Texture.ReallyEnabled & TEXTURE1_2D) { - if (!fxMesa->isNapalm && ctx->Texture.Unit[1].EnvMode == GL_BLEND) - return GL_FALSE; - if (ctx->Texture.Unit[1].Current->Image[0]->Border > 0) - return GL_FALSE; - } - - if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) - fprintf(stderr, "fxMesa: fxIsInHardware, envmode is %s/%s\n", - gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode), - gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode)); - - /* KW: This was wrong (I think) and I changed it... which doesn't mean - * it is now correct... - */ - if ((ctx->Enabled & (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D)) && - (ctx->Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D))) { - /* Can't use multipass to blend a multitextured triangle - fall - * back to software. - */ - if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) { - return GL_FALSE; - } - - if ((ctx->Texture.Unit[0].EnvMode != ctx->Texture.Unit[1].EnvMode) - && (ctx->Texture.Unit[0].EnvMode != GL_MODULATE) - && (ctx->Texture.Unit[0].EnvMode != GL_REPLACE)) { /* q2, seems ok... */ - if (MESA_VERBOSE & VERBOSE_DRIVER) - fprintf(stderr, - "fxMesa: unsupported multitex env mode\n"); - return GL_FALSE; - } - } - } - else { - if ((ctx->Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) || - /* Not very well written ... */ - ((ctx->Enabled & TEXTURE0_1D) && (!(ctx->Enabled & TEXTURE0_2D))) - ) { - return GL_FALSE; - } - - - if (!fxMesa->isNapalm && (ctx->Texture.ReallyEnabled & TEXTURE0_2D) && - (ctx->Texture.Unit[0].EnvMode == GL_BLEND)) { - return GL_FALSE; - } - } - - if (ctx->Stencil.Enabled && !fxMesa->haveHwStencil) - return GL_FALSE; - - return GL_TRUE; -} - - - -#define INTERESTED (~(NEW_MODELVIEW|NEW_PROJECTION|NEW_PROJECTION|NEW_TEXTURE_MATRIX|NEW_USER_CLIP|NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE)) - -static void -fxDDUpdateDDPointers(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint new_state = ctx->NewState; - - if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_STATE)) - fprintf(stderr, "fxmesa: fxDDUpdateDDPointers(...)\n"); - - if (new_state & (NEW_RASTER_OPS | NEW_TEXTURING)) - fxMesa->is_in_hardware = fxIsInHardware(ctx); - - if (fxMesa->is_in_hardware) { - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - if (new_state & INTERESTED) { - fxDDChooseRenderState(ctx); - fxMesa->RenderVBTables = fxDDChooseRenderVBTables(ctx); - fxMesa->RenderVBClippedTab = fxMesa->RenderVBTables[0]; - fxMesa->RenderVBCulledTab = fxMesa->RenderVBTables[1]; - fxMesa->RenderVBRawTab = fxMesa->RenderVBTables[2]; - - ctx->Driver.RasterSetup = fxDDChooseSetupFunction(ctx); - } - - ctx->Driver.PointsFunc = fxMesa->PointsFunc; - ctx->Driver.LineFunc = fxMesa->LineFunc; - ctx->Driver.TriangleFunc = fxMesa->TriangleFunc; - ctx->Driver.QuadFunc = fxMesa->QuadFunc; - } - else { - fxMesa->render_index = FX_FALLBACK; - } -} - -static void -fxDDReducedPrimitiveChange(GLcontext * ctx, GLenum prim) -{ - if (ctx->Polygon.CullFlag) { - if (ctx->PB->primitive != GL_POLYGON) { /* Lines or Points */ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - FX_grCullMode(fxMesa, GR_CULL_DISABLE); - fxMesa->cullMode = GR_CULL_DISABLE; - } - } -} - - -void -fxSetupDDPointers(GLcontext * ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupDDPointers()\n"); - } - ctx->Driver.UpdateState = fxDDUpdateDDPointers; - ctx->Driver.ClearIndex = NULL; - ctx->Driver.ClearColor = fxDDClearColor; - ctx->Driver.Clear = fxDDClear; - ctx->Driver.Index = NULL; - ctx->Driver.Color = fxDDSetColor; - ctx->Driver.SetDrawBuffer = fxDDSetDrawBuffer; - ctx->Driver.SetReadBuffer = fxDDSetReadBuffer; - ctx->Driver.GetBufferSize = fxDDBufferSize; - ctx->Driver.Finish = fxDDFinish; - ctx->Driver.Flush = fxDDFlush; - ctx->Driver.GetString = fxDDGetString; - ctx->Driver.NearFar = fxDDSetNearFar; - ctx->Driver.GetParameteri = fxDDGetParameteri; - ctx->Driver.GetBooleanv = fxDDGetBooleanv; - ctx->Driver.GetFloatv = fxDDGetFloatv; - ctx->Driver.GetDoublev = fxDDGetDoublev; - ctx->Driver.GetIntegerv = fxDDGetIntegerv; - - if (ctx->Visual->RedBits == 8 && - ctx->Visual->GreenBits == 8 && - ctx->Visual->BlueBits == 8 && - ctx->Visual->AlphaBits == 8) { - ctx->Driver.Bitmap = bitmap_R8G8B8A8; - ctx->Driver.DrawPixels = drawpixels_R8G8B8A8; - ctx->Driver.ReadPixels = readpixels_R8G8B8A8; - } - else if (ctx->Visual->RedBits == 5 && - ctx->Visual->GreenBits == 6 && - ctx->Visual->BlueBits == 5 && - ctx->Visual->AlphaBits == 0) { - ctx->Driver.Bitmap = bitmap_R5G6B5; - ctx->Driver.DrawPixels = NULL; - ctx->Driver.ReadPixels = readpixels_R5G6B5; - } - else { - ctx->Driver.Bitmap = NULL; - ctx->Driver.DrawPixels = NULL; - ctx->Driver.ReadPixels = NULL; - } - - ctx->Driver.RenderStart = NULL; - ctx->Driver.RenderFinish = NULL; - - ctx->Driver.TexImage2D = fxDDTexImage2D; - ctx->Driver.TexSubImage2D = fxDDTexSubImage2D; - ctx->Driver.TestProxyTexImage = fxDDTestProxyTexImage; - ctx->Driver.GetTexImage = fxDDGetTexImage; - ctx->Driver.CompressedTexImage2D = fxDDCompressedTexImage2D; - ctx->Driver.CompressedTexSubImage2D = fxDDCompressedTexSubImage2D; - ctx->Driver.GetCompressedTexImage = fxDDGetCompressedTexImage; - ctx->Driver.SpecificCompressedTexFormat = fxDDSpecificCompressedTexFormat; - ctx->Driver.BaseCompressedTexFormat = fxDDBaseCompressedTexFormat; - ctx->Driver.IsCompressedFormat = fxDDIsCompressedFormat; - ctx->Driver.CompressedImageSize = fxDDCompressedImageSize; - ctx->Driver.TexEnv = fxDDTexEnv; - ctx->Driver.TexParameter = fxDDTexParam; - ctx->Driver.BindTexture = fxDDTexBind; - ctx->Driver.DeleteTexture = fxDDTexDel; - ctx->Driver.IsTextureResident = fxDDIsTextureResident; - ctx->Driver.UpdateTexturePalette = fxDDTexPalette; - - ctx->Driver.RectFunc = NULL; - - if (fxMesa->haveHwStencil) { - ctx->Driver.StencilFunc = fxDDStencilFunc; - ctx->Driver.StencilMask = fxDDStencilMask; - ctx->Driver.StencilOp = fxDDStencilOp; - } - - ctx->Driver.AlphaFunc = fxDDAlphaFunc; - ctx->Driver.BlendFunc = fxDDBlendFunc; - ctx->Driver.BlendFuncSeparate = fxDDBlendFuncSeparate; - ctx->Driver.DepthFunc = fxDDDepthFunc; - ctx->Driver.DepthMask = fxDDDepthMask; - ctx->Driver.ColorMask = fxDDColorMask; - ctx->Driver.Fogfv = fxDDFogfv; - ctx->Driver.Scissor = fxDDScissor; - ctx->Driver.FrontFace = fxDDFrontFace; - ctx->Driver.CullFace = fxDDCullFace; - ctx->Driver.ShadeModel = fxDDShadeModel; - ctx->Driver.Enable = fxDDEnable; - ctx->Driver.ReducedPrimitiveChange = fxDDReducedPrimitiveChange; - - ctx->Driver.RegisterVB = fxDDRegisterVB; - ctx->Driver.UnregisterVB = fxDDUnregisterVB; - - ctx->Driver.RegisterPipelineStages = fxDDRegisterPipelineStages; - - ctx->Driver.OptimizeImmediatePipeline = 0; /* nothing done yet */ - ctx->Driver.OptimizePrecalcPipeline = 0; - -/* if (getenv("MESA_USE_FAST") || getenv("FX_USE_FAST")) */ -/* ctx->Driver.OptimizePrecalcPipeline = fxDDOptimizePrecalcPipeline; */ - - if (!getenv("FX_NO_FAST")) - ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline; - - ctx->Driver.TriangleCaps = - DD_TRI_CULL | DD_TRI_OFFSET | DD_TRI_LIGHT_TWOSIDE; - - fxSetupDDSpanPointers(ctx); - - FX_CONTEXT(ctx)->render_index = 1; /* force an update */ - fxDDUpdateDDPointers(ctx); -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c b/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c deleted file mode 100644 index c18cac338..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c +++ /dev/null @@ -1,2080 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c,v 1.7 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxdd.c - 3Dfx VooDoo Mesa span and pixel functions */ - - -#include "fxdrv.h" - -/* - * Examine the cliprects to generate an array of flags to indicate - * which pixels in a span are visible. Note: (x,y) is a screen - * coordinate. - */ -static void -generate_vismask(const fxMesaContext fxMesa, GLint x, GLint y, GLint n, - GLubyte vismask[]) -{ - GLboolean initialized = GL_FALSE; - GLint i, j; - - /* Ensure we clear the visual mask */ - MEMSET(vismask, 0, n); - - /* turn on flags for all visible pixels */ - for (i = 0; i < fxMesa->numClipRects; i++) { - const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; - - if (y >= rect->y1 && y < rect->y2) { - if (x >= rect->x1 && x + n <= rect->x2) { - /* common case, whole span inside cliprect */ - MEMSET(vismask, 1, n); - return; - } - if (x < rect->x2 && x + n >= rect->x1) { - /* some of the span is inside the rect */ - GLint start, end; - if (!initialized) { - MEMSET(vismask, 0, n); - initialized = GL_TRUE; - } - if (x < rect->x1) - start = rect->x1 - x; - else - start = 0; - if (x + n > rect->x2) - end = rect->x2 - x; - else - end = n; - assert(start >= 0); - assert(end <= n); - for (j = start; j < end; j++) - vismask[j] = 1; - } - } - } -} - -/* - * Examine cliprects and determine if the given screen pixel is visible. - */ -static GLboolean -visible_pixel(const fxMesaContext fxMesa, int scrX, int scrY) -{ - int i; - for (i = 0; i < fxMesa->numClipRects; i++) { - const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; - if (scrX >= rect->x1 && - scrX < rect->x2 && - scrY >= rect->y1 && scrY < rect->y2) return GL_TRUE; - } - return GL_FALSE; -} - -/* - * 16bpp span/pixel functions - */ -static void -write_R5G6B5_rgba_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: write_R5G6B5_rgba_span\n"); - } - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_565, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - GLushort *data16 = (GLushort *) info.lfbPtr + scrY * srcStride + scrX; - GLuint i; - - if (mask) { - for (i = 0; i < n; i++) { - if (visible_pixel(fxMesa, scrX + i, scrY) && mask[i]) { - GLushort pixel; - if (fxMesa->bgrOrder) { - pixel = PACK_BGR16(rgba[i][0], - rgba[i][1], - rgba[i][2]); - } else { - pixel = PACK_RGB16(rgba[i][0], - rgba[i][1], - rgba[i][2]); - } - data16[i] = pixel; - } - } - } else { - for (i = 0; i < n; i++) { - if (visible_pixel(fxMesa, scrX + i, scrY)) { - GLushort pixel; - - if (fxMesa->bgrOrder) { - pixel = PACK_BGR16(rgba[i][0], - rgba[i][1], - rgba[i][2]); - } else { - pixel = PACK_RGB16(rgba[i][0], - rgba[i][1], - rgba[i][2]); - } - data16[i] = pixel; - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R5G6B5_rgb_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: write_R5G6B5_rgb_span\n"); - } - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_565, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - GLushort *data16 = (GLushort *) info.lfbPtr + scrY * srcStride + scrX; - GLuint i; - - if (mask) { - for (i = 0; i < n; i++) { - if (visible_pixel(fxMesa, scrX + i, scrY) && mask[i]) { - GLushort pixel; - if (fxMesa->bgrOrder) { - pixel = PACK_BGR16(rgb[i][0], - rgb[i][1], - rgb[i][2]); - } else { - pixel = PACK_RGB16(rgb[i][0], - rgb[i][1], - rgb[i][2]); - } - data16[i] = pixel; - } - } - } else { - for (i = 0; i < n; i++) { - if (visible_pixel(fxMesa, scrX + i, scrY)) { - GLushort pixel; - if (fxMesa->bgrOrder) { - pixel = PACK_BGR16(rgb[i][0], - rgb[i][1], - rgb[i][2]); - } else { - pixel = PACK_RGB16(rgb[i][0], - rgb[i][1], - rgb[i][2]); - } - data16[i] = pixel; - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - -static void -write_R5G6B5_mono_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - GLubyte *constantColor = (GLubyte *)(&fxMesa->color); - GLushort pixel; - - if (fxMesa->bgrOrder) { - pixel = PACK_BGR16(constantColor[0], - constantColor[1], - constantColor[2]); - } else { - pixel = PACK_RGB16(constantColor[0], - constantColor[1], - constantColor[2]); - } - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: write_r5g6b5_mono_span\n"); - } - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_565, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - GLushort *data16 = (GLushort *) info.lfbPtr - + scrY * srcStride + scrX; - GLuint i; - - if (mask) { - for (i = 0; i < n; i++) { - if (visible_pixel(fxMesa, scrX + i, scrY) && mask[i]) { - data16[i] = pixel; - } - } - } else { - for (i = 0; i < n; i++) { - if (visible_pixel(fxMesa, scrX + i, scrY)) { - data16[i] = pixel; - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - -/* - * Read a span of 16-bit RGB pixels. Note, we don't worry about cliprects - * since OpenGL says obscured pixels have undefined values. - */ -static void -read_R5G6B5_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - GLubyte rgba[][4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - const GLushort *data16 = (const GLushort *) info.lfbPtr - + (winY - y) * srcStride + (winX + x); - GLuint i, j; - GLuint extraPixel = (n & 1); - n -= extraPixel; - for (i = j = 0; i < n; i += 2, j++) { - /* use data16[] to keep correct alignment */ - GLuint pixel0 = data16[i]; - GLuint pixel1 = data16[i+1]; - rgba[i][RCOMP] = FX_PixelToR(fxMesa, pixel0); - rgba[i][GCOMP] = FX_PixelToG(fxMesa, pixel0); - rgba[i][BCOMP] = FX_PixelToB(fxMesa, pixel0); - rgba[i][ACOMP] = 255; - rgba[i + 1][RCOMP] = FX_PixelToR(fxMesa, pixel1); - rgba[i + 1][GCOMP] = FX_PixelToG(fxMesa, pixel1); - rgba[i + 1][BCOMP] = FX_PixelToB(fxMesa, pixel1); - rgba[i + 1][ACOMP] = 255; - } - if (extraPixel) { - GLushort pixel = data16[n]; - rgba[n][RCOMP] = FX_PixelToR(fxMesa, pixel); - rgba[n][GCOMP] = FX_PixelToG(fxMesa, pixel); - rgba[n][BCOMP] = FX_PixelToB(fxMesa, pixel); - rgba[n][ACOMP] = 255; - } - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R5G6B5_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: write_R5G6B5_pixels\n"); - } - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_565, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - GLuint i; - - for (i = 0; i < n; i++) { - GLint scrX = winX + x[i]; - GLint scrY = winY - y[i]; - if (visible_pixel(fxMesa, scrX, scrY) && mask[i]) { - GLushort *data16 = (GLushort *) info.lfbPtr - + scrY * srcStride + scrX; - GLushort pixel; - if (fxMesa->bgrOrder) { - pixel = PACK_BGR16(rgba[i][0], - rgba[i][1], - rgba[i][2]); - } else { - pixel = PACK_RGB16(rgba[i][0], - rgba[i][1], - rgba[i][2]); - } - data16[0] = pixel; - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - -static void -write_R5G6B5_mono_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrLfbInfo_t info; - GLubyte *constantColor = (GLubyte *)(&fxMesa->color); - GLushort pixel; - - if (fxMesa->bgrOrder) { - pixel = PACK_BGR16(constantColor[0], - constantColor[1], - constantColor[2]); - } else { - pixel = PACK_RGB16(constantColor[0], - constantColor[1], - constantColor[2]); - } - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: write_R5G6B5_mono_pixels\n"); - } - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_565, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - GLuint i; - - for (i = 0; i < n; i++) { - GLint scrX = winX + x[i]; - GLint scrY = winY - y[i]; - if (visible_pixel(fxMesa, scrX, scrY) && mask[i]) { - GLushort *data16 = (GLushort *) info.lfbPtr - + scrY * srcStride + scrX; - data16[0] = pixel; - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - -static void -read_R5G6B5_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); - GLuint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - const GLushort *data16 = (const GLushort *) info.lfbPtr - + (winY - y[i]) * srcStride + (winX + x[i]); - GLushort pixel = *data16; - rgba[i][RCOMP] = FX_PixelToR(fxMesa, pixel); - rgba[i][GCOMP] = FX_PixelToG(fxMesa, pixel); - rgba[i][BCOMP] = FX_PixelToB(fxMesa, pixel); - rgba[i][ACOMP] = 255; - } - } - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -/* - * 24bpp span/pixel functions - */ - -static void -write_R8G8B8_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbWriteMode_t mode; - GrLfbInfo_t info; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - mode = GR_LFBWRITEMODE_888; - else - mode = GR_LFBWRITEMODE_888; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - mode, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - /*GLint dstStride = fxMesa->screen_width * 3; */ - GLint dstStride = info.strideInBytes / 1; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 1; - GLuint *dst32 = (GLuint *) dst; - GLubyte visMask[MAX_WIDTH]; - GLuint i; - generate_vismask(fxMesa, scrX, scrY, n, visMask); - for (i = 0; i < n; i++) { - if (visMask[i] && (!mask || mask[i])) { - dst32[i] = - PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); - } - } - } - else { - /* back buffer */ - GLint dstStride = info.strideInBytes; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 4; - GLuint *dst32 = (GLuint *) dst; - if (mask) { - GLuint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - dst32[i] = - PACK_RGBA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); - } - } - } - else { - GLuint i; - for (i = 0; i < n; i++) { - dst32[i] = - PACK_RGBA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - - -static void -write_R8G8B8_rgba_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbWriteMode_t mode; - GrLfbInfo_t info; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - mode = GR_LFBWRITEMODE_8888; - else - mode = GR_LFBWRITEMODE_888; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - mode, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - /* XXX have to do cliprect clipping! */ - GLint dstStride = fxMesa->screen_width * 4; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 4; - GLuint *dst32 = (GLuint *) dst; - GLubyte visMask[MAX_WIDTH]; - GLuint i; - generate_vismask(fxMesa, scrX, scrY, n, visMask); - for (i = 0; i < n; i++) { - if (visMask[i] && (!mask || mask[i])) { - dst32[i] = - PACK_BGRA32(rgba[i][0], rgba[i][1], rgba[i][2], - rgba[i][3]); - } - } - } - else { - /* back buffer */ - GLint dstStride = info.strideInBytes; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 4; - if (mask) { - const GLuint *src32 = (const GLuint *) rgba; - GLuint *dst32 = (GLuint *) dst; - GLuint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - dst32[i] = src32[i]; - } - } - } - else { - /* no mask, write all pixels */ - MEMCPY(dst, rgba, 4 * n); - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R8G8B8_mono_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLubyte rgba[MAX_WIDTH][4]; - GLuint *data = (GLuint *) rgba; - GLuint i; - - /* XXX this is a simple-minded implementation but good enough for now */ - for (i = 0; i < n; i++) { - data[i] = (GLuint) fxMesa->color; - } - write_R8G8B8_rgba_span(ctx, n, x, y, (const GLubyte(*)[4]) rgba, mask); -} - - -static void -read_R8G8B8_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - GLubyte rgba[][4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_READ_ONLY, fxMesa->currentFB, GR_LFBWRITEMODE_8888, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - GLint srcStride = fxMesa->screen_width * 4; - const GLubyte *src = (const GLubyte *) info.lfbPtr - + (winY - y) * srcStride + (winX + x) * 4; - GLuint i; - for (i = 0; i < n; i++) { - rgba[i][0] = src[i * 4 + 2]; - rgba[i][1] = src[i * 4 + 1]; - rgba[i][2] = src[i * 4 + 0]; - rgba[i][3] = src[i * 4 + 3]; - } - } - else { - /* back buffer */ - GLint srcStride = info.strideInBytes / 2; - const GLubyte *src = (const GLubyte *) info.lfbPtr - + (winY - y) * srcStride + (winX + x) * 4; - GLuint i; - for (i = 0; i < n; i++) { - rgba[i][0] = src[i * 4 + 2]; - rgba[i][1] = src[i * 4 + 1]; - rgba[i][2] = src[i * 4 + 0]; - rgba[i][3] = src[i * 4 + 3]; - } - } - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R8G8B8_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbWriteMode_t mode; - GrLfbInfo_t info; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - mode = GR_LFBWRITEMODE_8888; - else - mode = GR_LFBWRITEMODE_888 /*565 */ ; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, - fxMesa->currentFB, - mode, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - GLuint i; - for (i = 0; i < n; i++) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x[i]; - const GLint scrY = winY - y[i]; - if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { - GLint dstStride = fxMesa->screen_width * 4; - GLubyte *dst = - (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; - GLuint *dst32 = (GLuint *) dst; - *dst32 = PACK_BGRA32(rgba[i][0], rgba[i][1], - rgba[i][2], rgba[i][3]); - } - } - } - else { - /* back buffer */ - GLuint i; - for (i = 0; i < n; i++) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x[i]; - const GLint scrY = winY - y[i]; - if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { - GLint dstStride = info.strideInBytes; - GLubyte *dst = - (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; - GLuint *dst32 = (GLuint *) dst; - *dst32 = PACK_BGRA32(rgba[i][0], rgba[i][1], - rgba[i][2], rgba[i][3]); - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R8G8B8_mono_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[]) -{ - printf("write_r8g8b8_mono_pixels\n"); -} - - -static void -read_R8G8B8_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[]) -{ - printf("read_R8G8B8_pixels %d\n", n); -} - - - -/* - * 32bpp span/pixel functions - */ - -static void -write_R8G8B8A8_rgb_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, fxMesa->currentFB, GR_LFBWRITEMODE_8888, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - GLubyte visMask[MAX_WIDTH]; - - generate_vismask(fxMesa, scrX, scrY, n, visMask); - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - GLint dstStride = fxMesa->screen_width * 4; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 4; - GLuint *dst32 = (GLuint *) dst; - GLuint i; - for (i = 0; i < n; i++) { - if (visMask[i] && (!mask || mask[i])) { - dst32[i] = - PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); - } - } - } - else { - /* back buffer */ - GLint dstStride = info.strideInBytes; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 4; - GLuint *dst32 = (GLuint *) dst; - if (mask) { - GLuint i; - for (i = 0; i < n; i++) { - if (visMask[i] && mask[i]) { - dst32[i] = - PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); - } - } - } - else { - GLuint i; - for (i = 0; i < n; i++) { - if (visMask[i]) { - dst32[i] = PACK_BGRA32(rgb[i][0], rgb[i][1], - rgb[i][2], 255); - } - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -/* - *XXX test of grLfbWriteRegion in 32bpp mode. Doesn't seem to work! - */ -#if 0 -static void -write_R8G8B8A8_rgb_span2(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; - GLint x2 = fxMesa->x_offset + x; - GLint y2 = bottom - y; - - FX_grLfbWriteRegion(fxMesa->currentFB, x2, y2, GR_LFB_SRC_FMT_888, - n, 1, 0, rgb); -} -#endif - - -static void -write_R8G8B8A8_rgba_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, fxMesa->currentFB, GR_LFBWRITEMODE_8888, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - GLubyte visMask[MAX_WIDTH]; - - generate_vismask(fxMesa, scrX, scrY, n, visMask); - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - GLint dstStride = fxMesa->screen_width * 4; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 4; - GLuint *dst32 = (GLuint *) dst; - GLuint i; - for (i = 0; i < n; i++) { - if (visMask[i] && (!mask || mask[i])) { - dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1], rgba[i][2], - rgba[i][3]); - } - } - } - else { - /* back buffer */ - GLint dstStride = info.strideInBytes; - GLubyte *dst = (GLubyte *) info.lfbPtr - + (winY - y) * dstStride + (winX + x) * 4; - GLuint *dst32 = (GLuint *) dst; - GLubyte visMask[MAX_WIDTH]; - generate_vismask(fxMesa, scrX, scrY, n, visMask); - if (mask) { - GLuint i; - for (i = 0; i < n; i++) { - if (visMask[i] && mask[i]) { - dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1], - rgba[i][2], rgba[i][3]); - } - } - } - else { - /* no mask, write all pixels */ - GLuint i; - for (i = 0; i < n; i++) { - if (visMask[i]) { - dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1], - rgba[i][2], rgba[i][3]); - } - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - else { - info.strideInBytes = -1; - } - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R8G8B8A8_mono_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLubyte rgba[MAX_WIDTH][4]; - GLuint *data = (GLuint *) rgba; - GLuint i; - - /* XXX this is a simple-minded implementation but good enough for now */ - for (i = 0; i < n; i++) { - data[i] = (GLuint) fxMesa->color; - } - write_R8G8B8A8_rgba_span(ctx, n, x, y, (const GLubyte(*)[4]) rgba, mask); -} - - -static void -read_R8G8B8A8_span(const GLcontext * ctx, GLuint n, GLint x, GLint y, - GLubyte rgba[][4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_READ_ONLY, fxMesa->currentFB, GR_LFBWRITEMODE_ANY, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - GLint srcStride = fxMesa->screen_width; - const GLuint *src32 = (const GLuint *) info.lfbPtr - + (winY - y) * srcStride + (winX + x); - GLuint i; - MEMCPY(rgba, src32, n * 4); - for (i = 0; i < n; i++) { - rgba[i][0] ^= rgba[i][2]; - rgba[i][2] ^= rgba[i][0]; - rgba[i][0] ^= rgba[i][2]; - } - } - else { - /* back buffer */ - GLint srcStride = info.strideInBytes / sizeof(GLuint); - const GLuint *src32 = (const GLuint *) info.lfbPtr - + (winY - y) * srcStride + (winX + x); - GLuint i; - MEMCPY(rgba, src32, n * 4); - for (i = 0; i < n; i++) { - rgba[i][0] ^= rgba[i][2]; - rgba[i][2] ^= rgba[i][0]; - rgba[i][0] ^= rgba[i][2]; - } - } - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - else - info.strideInBytes = -1; - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R8G8B8A8_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - - BEGIN_BOARD_LOCK(fxMesa); - info.size = sizeof(info); - if (grLfbLock(GR_LFB_WRITE_ONLY, fxMesa->currentFB, GR_LFBWRITEMODE_8888, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { - GLuint i; - for (i = 0; i < n; i++) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x[i]; - const GLint scrY = winY - y[i]; - if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { - GLint dstStride = fxMesa->screen_width * 4; - GLubyte *dst = - (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; - GLuint *dst32 = (GLuint *) dst; - *dst32 = PACK_BGRA32(rgba[i][0], rgba[i][1], - rgba[i][2], rgba[i][3]); - } - } - } - else { - /* back buffer */ - GLuint i; - for (i = 0; i < n; i++) { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x[i]; - const GLint scrY = winY - y[i]; - if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { - GLint dstStride = info.strideInBytes; - GLubyte *dst = - (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; - GLuint *dst32 = (GLuint *) dst; - *dst32 = PACK_BGRA32(rgba[i][0], rgba[i][1], - rgba[i][2], rgba[i][3]); - } - } - } - grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(fxMesa); -} - - -static void -write_R8G8B8A8_mono_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint i; - GLuint color = fxMesa->color; - for (i = 0; i < n; i++) { - if (mask[i]) { - write_R8G8B8A8_rgba_span(ctx, 1, x[i], y[i], - (const GLubyte(*)[4]) &color, mask + i); - } - } -} - - - -static void -read_R8G8B8A8_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[]) -{ - GLuint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - read_R8G8B8A8_span(ctx, 1, x[i], y[i], rgba + i); - } - } -} - - - -/* - * Depth buffer read/write functions. - */ -/* - * To read the frame buffer, we need to lock and unlock it. The - * four macros {READ,WRITE}_FB_SPAN_{LOCK,UNLOCK} - * do this for us. - * - * Note that the lock must be matched with an unlock. These - * macros include a spare curly brace, so they must - * be syntactically matched. - * - * Note, also, that you can't lock a buffer twice with different - * modes. That is to say, you can't lock a buffer in both read - * and write modes. The strideInBytes and LFB pointer will be - * the same with read and write locks, so you can use either. - * o The HW has different state for reads and writes, so - * locking it twice may give screwy results. - * o The DRM won't let you lock twice. It hangs. This is probably - * because of the BEGIN_BOARD_LOCK IN THE *_FB_SPAN_LOCK macros, - * and could be eliminated with nonlocking lock routines. But - * what's the point after all. - */ -#define READ_FB_SPAN_LOCK(fxMesa, info, target_buffer) \ - BEGIN_BOARD_LOCK(fxMesa); \ - (info).size=sizeof(info); \ - if (grLfbLock(GR_LFB_READ_ONLY, \ - target_buffer, \ - GR_LFBWRITEMODE_ANY, \ - GR_ORIGIN_LOWER_LEFT, \ - FXFALSE, \ - &(info))) { - -#define READ_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ - grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \ - } else { \ - fprintf(stderr, "fxDriver: Can't get %s (%d) read lock\n", \ - (target_buffer == GR_BUFFER_BACKBUFFER) \ - ? "back buffer" \ - : ((target_buffer == GR_BUFFER_AUXBUFFER) \ - ? "depth buffer" \ - : "unknown buffer"), \ - target_buffer); \ - } \ - END_BOARD_LOCK(fxMesa); - - -#define WRITE_FB_SPAN_LOCK(fxMesa, info, target_buffer, write_mode) \ - BEGIN_BOARD_LOCK(fxMesa); \ - info.size=sizeof(info); \ - if (grLfbLock(GR_LFB_WRITE_ONLY, \ - target_buffer, \ - write_mode, \ - GR_ORIGIN_LOWER_LEFT, \ - FXFALSE, \ - &info)) { - -#define WRITE_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ - grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \ - } else { \ - fprintf(stderr, "fxDriver: Can't get %s (%d) write lock\n", \ - (target_buffer == GR_BUFFER_BACKBUFFER) \ - ? "back buffer" \ - : ((target_buffer == GR_BUFFER_AUXBUFFER) \ - ? "depth buffer" \ - : "unknown buffer"), \ - target_buffer); \ - } \ - END_BOARD_LOCK(fxMesa); - -/* - * Because the Linear Frame Buffer is not necessarily aligned - * with the depth buffer, we have to do some fiddling - * around to get the right addresses. - * - * Perhaps a picture is in order. The Linear Frame Buffer - * looks like this: - * - * |<----------------------info.strideInBytes------------->| - * |<-----physicalStrideInBytes------->| - * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ - * | | | - * | Legal Memory | Forbidden Zone | - * | | | - * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ - * - * You can only reliably read and write legal locations. Reads - * and writes from the Forbidden Zone will return undefined values, - * and may cause segmentation faults. - * - * Now, the depth buffer may not end up in a location such each - * scan line is an LFB line. For example, the depth buffer may - * look like this: - * - * wrapped ordinary. - * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ - * |0000000000000000000000 | | back - * |1111111111111111111111 | | buffer - * |2222222222222222222222 | | - * |4096b align. padxx00000000000000000| Forbidden Zone | depth - * |0000 11111111111111111| | buffer - * |1111 22222222222222222| | - * |2222 | | - * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ - * where each number is the scan line number. We know it will - * be aligned on 128 byte boundaries, at least. Aligning this - * on a scanline boundary causes the back and depth buffers to - * thrash in the SST1 cache. (Note that the back buffer is always - * allocated at the beginning of LFB memory, and so it is always - * properly aligned with the LFB stride.) - * - * We call the beginning of the line (which is the rightmost - * part of the depth line in the picture above) the *ordinary* part - * of the scanline, and the end of the line (which is the - * leftmost part, one line below) the *wrapped* part of the scanline. - * a.) We need to know what x value to subtract from the screen - * x coordinate to index into the wrapped part. - * b.) We also need to figure out if we need to read from the ordinary - * part scan line, or from the wrapped part of the scan line. - * - * [ad a] - * The first wrapped x coordinate is that coordinate such that - * depthBufferOffset&(info.strideInBytes) + x*elmentSize {*} - * > physicalStrideInBytes - * where depthBufferOffset is the LFB distance in bytes - * from the back buffer to the depth buffer. The expression - * depthBufferOffset&(info.strideInBytes) - * is then the offset (in bytes) from the beginining of (any) - * depth buffer line to first element in the line. - * Simplifying inequation {*} above we see that x is the smallest - * value such that - * x*elementSize > physicalStrideInBytes {**} - * - depthBufferOffset&(info.strideInBytes) - * Now, we know that both the summands on the right are multiples of - * 128, and elementSize <= 4, so if equality holds in {**}, x would - * be a multiple of 32. Thus we can set x to - * xwrapped = (physicalStrideInBytes - * - depthBufferOffset&(info.strideInBytes))/elementSize - * + 1 - * - * [ad b] - * Question b is now simple. We read from the wrapped scan line if - * x is greater than xwrapped. - */ -#define TILE_WIDTH_IN_BYTES 128 -#define TILE_WIDTH_IN_ZOXELS(bpz) (TILE_WIDTH_IN_BYTES/(bpz)) -#define TILE_HEIGHT_IN_LINES 32 -typedef struct -{ - void *lfbPtr; - void *lfbWrapPtr; - FxU32 LFBStrideInElts; - GLint firstWrappedX; -} -LFBParameters; - -/* - * We need information about the back buffer. Note that - * this function *cannot be called* while the aux buffer - * is locked, or the caller will hang. - * - * Only Glide knows the LFB address of the back and depth - * offsets. The upper levels of Mesa know the depth offset, - * but that is not in LFB space, it is tiled memory space, - * and is not useable for us. - */ -static void -GetBackBufferInfo(fxMesaContext fxMesa, GrLfbInfo_t * backBufferInfo) -{ - READ_FB_SPAN_LOCK(fxMesa, *backBufferInfo, GR_BUFFER_BACKBUFFER); - READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_BACKBUFFER); -} - -static void -GetFbParams(fxMesaContext fxMesa, - GrLfbInfo_t * info, - GrLfbInfo_t * backBufferInfo, - LFBParameters * ReadParamsp, FxU32 elementSize) -{ - FxU32 physicalStrideInBytes, bufferOffset; - FxU32 strideInBytes = info->strideInBytes; - char *lfbPtr = (char *) (info->lfbPtr); - - /* - * These two come directly from the info structure. - */ - ReadParamsp->lfbPtr = (void *) lfbPtr; - ReadParamsp->LFBStrideInElts = strideInBytes / elementSize; - /* - * Now, calculate the value of firstWrappedX. - * - * The physical stride is the screen width in bytes rounded up to - * the next highest multiple of 128 bytes. Note that this fails - * when TILE_WIDTH_IN_BYTES is not a power of two. - * - * The buffer Offset is the distance between the beginning of - * the LFB space, which is the beginning of the back buffer, - * and the buffer we are gathering information about. - * We want to make this routine usable for operations on the - * back buffer, though we don't actually use it on the back - * buffer. Note, then, that if bufferOffset == 0, the firstWrappedX - * is in the forbidden zone, and is therefore never reached. - * - * Note that if - * physicalStrideInBytes - * < bufferOffset&(info->strideInBytes-1) - * the buffer begins in the forbidden zone. We assert for this. - */ - bufferOffset = (FxU32)(lfbPtr - (char *) backBufferInfo->lfbPtr); - physicalStrideInBytes - = (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1) - & ~(TILE_WIDTH_IN_BYTES - 1); - assert(physicalStrideInBytes > (bufferOffset & (strideInBytes - 1))); - ReadParamsp->firstWrappedX - = (physicalStrideInBytes - - (bufferOffset & (strideInBytes - 1))) / elementSize; - /* - * This is the address of the next physical line. - */ - ReadParamsp->lfbWrapPtr - = (void *) ((char *) backBufferInfo->lfbPtr - + (bufferOffset & ~(strideInBytes - 1)) - + (TILE_HEIGHT_IN_LINES) * strideInBytes); -} - -/* - * These macros fetch data from the frame buffer. The type is - * the type of data we want to fetch. It should match the type - * whose size was used with GetFbParams to fill in the structure - * in *ReadParamsp. We have a macro to read the ordinary - * part, a second macro to read the wrapped part, and one which - * will do either. When we are reading a span, we will know - * when the ordinary part ends, so there's no need to test for - * it. However, when reading and writing pixels, we don't - * necessarily know. I suppose it's a matter of taste whether - * it's better in the macro or in the call. - * - * Recall that x and y are screen coordinates. - */ -#define GET_FB_DATA(ReadParamsp, type, x, y) \ - (((x) < (ReadParamsp)->firstWrappedX) \ - ? (((type *)((ReadParamsp)->lfbPtr)) \ - [(y) * ((ReadParamsp)->LFBStrideInElts) \ - + (x)]) \ - : (((type *)((ReadParamsp)->lfbWrapPtr)) \ - [((y)) * ((ReadParamsp)->LFBStrideInElts) \ - + ((x) - (ReadParamsp)->firstWrappedX)])) -#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \ - (((type *)((ReadParamsp)->lfbPtr)) \ - [(y) * ((ReadParamsp)->LFBStrideInElts) \ - + (x)]) -#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) \ - (((type *)((ReadParamsp)->lfbWrapPtr)) \ - [((y)) * ((ReadParamsp)->LFBStrideInElts) \ - + ((x) - (ReadParamsp)->firstWrappedX)]) -#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \ - (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) -#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \ - (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) -#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \ - (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) - -static void -fxDDWriteDepthSpan(GLcontext * ctx, - GLuint n, GLint x, GLint y, const GLdepth depth[], - const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLint bottom = fxMesa->y_offset + fxMesa->height - 1; - GLuint depth_size = fxMesa->glVis->DepthBits; - GLuint stencil_size = fxMesa->glVis->StencilBits; - GrLfbInfo_t info; - GLubyte visMask[MAX_WIDTH]; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n"); - } - - assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); - /* - * Convert x and y to screen coordinates. - */ - x += fxMesa->x_offset; - y = bottom - y; - if (mask) { - GLint i; - GLushort d16; - GrLfbInfo_t backBufferInfo; - - switch (depth_size) { - case 16: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, - GR_LFBWRITEMODE_ANY); - generate_vismask(fxMesa, x, y, n, visMask); - { - LFBParameters ReadParams; - int wrappedPartStart; - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLushort)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - for (i = 0; i < wrappedPartStart; i++) { - if (mask[i] && visMask[i]) { - d16 = depth[i]; - PUT_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y, d16); - } - } - for (; i < n; i++) { - if (mask[i] && visMask[i]) { - d16 = depth[i]; - PUT_WRAPPED_FB_DATA(&ReadParams, GLushort, x + i, y, d16); - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - case 24: - case 32: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, - GR_LFBWRITEMODE_ANY); - generate_vismask(fxMesa, x, y, n, visMask); - { - LFBParameters ReadParams; - int wrappedPartStart; - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLuint)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - for (i = 0; i < wrappedPartStart; i++) { - GLuint d32; - if (mask[i] && visMask[i]) { - if (stencil_size > 0) { - d32 = - GET_ORDINARY_FB_DATA(&ReadParams, GLuint, - x + i, y); - d32 = - (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); - } - else { - d32 = depth[i]; - } - PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); - } - } - for (; i < n; i++) { - GLuint d32; - if (mask[i] && visMask[i]) { - if (stencil_size > 0) { - d32 = - GET_WRAPPED_FB_DATA(&ReadParams, GLuint, - x + i, y); - d32 = - (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); - } - else { - d32 = depth[i]; - } - PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - } - } - else { - GLint i; - GLuint d32; - GLushort d16; - GrLfbInfo_t backBufferInfo; - - switch (depth_size) { - case 16: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, - GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); - generate_vismask(fxMesa, x, y, n, visMask); - { - LFBParameters ReadParams; - GLuint wrappedPartStart; - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLushort)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - for (i = 0; i < wrappedPartStart; i++) { - if (visMask[i]) { - d16 = depth[i]; - PUT_ORDINARY_FB_DATA(&ReadParams, - GLushort, - x + i, y, - d16); - } - } - for (; i < n; i++) { - if (visMask[i]) { - d16 = depth[i]; - PUT_WRAPPED_FB_DATA(&ReadParams, - GLushort, - x + i, y, - d16); - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - case 24: - case 32: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, - GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); - generate_vismask(fxMesa, x, y, n, visMask); - { - LFBParameters ReadParams; - GLuint wrappedPartStart; - - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLuint)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - for (i = 0; i < wrappedPartStart; i++) { - if (visMask[i]) { - if (stencil_size > 0) { - d32 = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); - d32 = - (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); - } - else { - d32 = depth[i]; - } - PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); - } - } - for (; i < n; i++) { - if (visMask[i]) { - if (stencil_size > 0) { - d32 = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); - d32 = - (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); - } - else { - d32 = depth[i]; - } - PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - } - } -} - -static void -fxDDReadDepthSpan(GLcontext * ctx, - GLuint n, GLint x, GLint y, GLdepth depth[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; - GLuint i; - GLuint depth_size = fxMesa->glVis->DepthBits; - GrLfbInfo_t info; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n"); - } - - /* - * Convert to screen coordinates. - */ - x += fxMesa->x_offset; - y = bottom - y; - switch (depth_size) { - case 16: - { - LFBParameters ReadParams; - GrLfbInfo_t backBufferInfo; - int wrappedPartStart; - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLushort)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - /* - * Read the line. - */ - for (i = 0; i < wrappedPartStart; i++) { - depth[i] = - GET_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y); - } - for (; i < n; i++) { - depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLushort, - x + i, y); - } - READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - } - case 24: - case 32: - { - LFBParameters ReadParams; - GrLfbInfo_t backBufferInfo; - int wrappedPartStart; - GLuint stencil_size = fxMesa->glVis->StencilBits; - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLuint)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - /* - * Read the line. - */ - for (i = 0; i < wrappedPartStart; i++) { - const GLuint mask = - (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; - depth[i] = - GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); - depth[i] &= mask; - } - for (; i < n; i++) { - const GLuint mask = - (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; - depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); - depth[i] &= mask; - } - READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - } - } -} - - -static void -fxDDWriteDepthPixels(GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - const GLdepth depth[], const GLubyte mask[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; - GLuint i; - GLushort d16; - GLuint d32; - GLuint depth_size = fxMesa->glVis->DepthBits; - GLuint stencil_size = fxMesa->glVis->StencilBits; - GrLfbInfo_t info; - int xpos; - int ypos; - GrLfbInfo_t backBufferInfo; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n"); - } - - switch (depth_size) { - case 16: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, - GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); - { - LFBParameters ReadParams; - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLushort)); - for (i = 0; i < n; i++) { - if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) { - xpos = x[i] + fxMesa->x_offset; - ypos = bottom - y[i]; - d16 = depth[i]; - PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16); - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - case 24: - case 32: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, - GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); - { - LFBParameters ReadParams; - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLuint)); - for (i = 0; i < n; i++) { - if (mask[i]) { - if (visible_pixel(fxMesa, x[i], y[i])) { - xpos = x[i] + fxMesa->x_offset; - ypos = bottom - y[i]; - if (stencil_size > 0) { - d32 = - GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); - d32 = (d32 & 0xFF000000) | (depth[i] & 0xFFFFFF); - } - else { - d32 = depth[i]; - } - PUT_FB_DATA(&ReadParams, GLuint, xpos, ypos, d32); - } - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - } -} - - -static void -fxDDReadDepthPixels(GLcontext * ctx, GLuint n, - const GLint x[], const GLint y[], GLdepth depth[]) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; - GLuint i; - GLuint depth_size = fxMesa->glVis->DepthBits; - GLushort d16; - int xpos; - int ypos; - GrLfbInfo_t info; - GLuint stencil_size; - GrLfbInfo_t backBufferInfo; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n"); - } - - assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); - switch (depth_size) { - case 16: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); - { - LFBParameters ReadParams; - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLushort)); - for (i = 0; i < n; i++) { - /* - * Convert to screen coordinates. - */ - xpos = x[i] + fxMesa->x_offset; - ypos = bottom - y[i]; - d16 = GET_FB_DATA(&ReadParams, GLushort, xpos, ypos); - depth[i] = d16; - } - } - READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - case 24: - case 32: - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); - stencil_size = fxMesa->glVis->StencilBits; - { - LFBParameters ReadParams; - GetFbParams(fxMesa, &info, &backBufferInfo, - &ReadParams, sizeof(GLuint)); - for (i = 0; i < n; i++) { - GLuint d32; - - /* - * Convert to screen coordinates. - */ - xpos = x[i] + fxMesa->x_offset; - ypos = bottom - y[i]; - d32 = GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); - if (stencil_size > 0) { - d32 &= 0x00FFFFFF; - } - depth[i] = d32; - } - } - READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); - break; - default: - assert(0); - } -} - -/* - * Stencil buffer read/write functions. - */ -#define EXTRACT_S_FROM_ZS(zs) (((zs) >> 24) & 0xFF) -#define EXTRACT_Z_FROM_ZS(zs) ((zs) & 0xffffff) -#define BUILD_ZS(z, s) (((s) << 24) | (z)) - -static void -write_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLstencil stencil[], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - GrLfbInfo_t backBufferInfo; - - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); - { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - const GLint scrX = winX + x; - const GLint scrY = winY - y; - LFBParameters ReadParams; - GLubyte visMask[MAX_WIDTH]; - GLuint i; - int wrappedPartStart; - - GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, - sizeof(GLuint)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - generate_vismask(fxMesa, scrX, scrY, n, visMask); - for (i = 0; i < wrappedPartStart; i++) { - if (visMask[i] && (!mask || mask[i])) { - GLuint z = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, - scrX + i, scrY) & 0x00FFFFFF; - z |= (stencil[i] & 0xFF) << 24; - PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); - } - } - for (; i < n; i++) { - if (visMask[i] && (!mask || mask[i])) { - GLuint z = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, - scrX + i, scrY) & 0x00FFFFFF; - z |= (stencil[i] & 0xFF) << 24; - PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); -} - - -static void -read_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, - GLstencil stencil[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - GrLfbInfo_t backBufferInfo; - - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); - { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - GLuint i; - LFBParameters ReadParams; - int wrappedPartStart; - - /* - * Convert to screen coordinates. - */ - x += winX; - y = winY - y; - GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, - sizeof(GLuint)); - if (ReadParams.firstWrappedX <= x) { - wrappedPartStart = 0; - } - else if (n <= (ReadParams.firstWrappedX - x)) { - wrappedPartStart = n; - } - else { - wrappedPartStart = (ReadParams.firstWrappedX - x); - } - for (i = 0; i < wrappedPartStart; i++) { - stencil[i] = (GET_ORDINARY_FB_DATA(&ReadParams, GLuint, - x + i, y) >> 24) & 0xFF; - } - for (; i < n; i++) { - stencil[i] = (GET_WRAPPED_FB_DATA(&ReadParams, GLuint, - x + i, y) >> 24) & 0xFF; - } - } - READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); -} - - -static void -write_stencil_pixels(GLcontext * ctx, GLuint n, - const GLint x[], const GLint y[], - const GLstencil stencil[], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - GrLfbInfo_t backBufferInfo; - - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); - { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - LFBParameters ReadParams; - GLuint i; - - GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, - sizeof(GLuint)); - for (i = 0; i < n; i++) { - const GLint scrX = winX + x[i]; - const GLint scrY = winY - y[i]; - if ((!mask || mask[i]) && visible_pixel(fxMesa, scrX, scrY)) { - GLuint z = - GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) & 0x00FFFFFF; - z |= (stencil[i] & 0xFF) << 24; - PUT_FB_DATA(&ReadParams, GLuint, scrX, scrY, z); - } - } - } - WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); -} - - -static void -read_stencil_pixels(GLcontext * ctx, GLuint n, const GLint x[], - const GLint y[], GLstencil stencil[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - GrLfbInfo_t backBufferInfo; - - GetBackBufferInfo(fxMesa, &backBufferInfo); - /* - * Note that the _LOCK macro adds a curly brace, - * and the UNLOCK macro removes it. - */ - READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); - { - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; - const GLint winX = fxMesa->x_offset; - GLuint i; - LFBParameters ReadParams; - - GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, - sizeof(GLuint)); - for (i = 0; i < n; i++) { - const GLint scrX = winX + x[i]; - const GLint scrY = winY - y[i]; - stencil[i] = - (GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) >> 24) & 0xFF; - } - } - READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); -} - -void -fxSetupDDSpanPointers(GLcontext * ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - if (ctx->Visual->RedBits == 5 && - ctx->Visual->GreenBits == 6 && - ctx->Visual->BlueBits == 5 && ctx->Visual->AlphaBits == 0) { - /* 16bpp mode */ - ctx->Driver.WriteRGBASpan = write_R5G6B5_rgba_span; - ctx->Driver.WriteRGBSpan = write_R5G6B5_rgb_span; - ctx->Driver.WriteMonoRGBASpan = write_R5G6B5_mono_span; - ctx->Driver.WriteRGBAPixels = write_R5G6B5_pixels; - ctx->Driver.WriteMonoRGBAPixels = write_R5G6B5_mono_pixels; - ctx->Driver.ReadRGBASpan = read_R5G6B5_span; - ctx->Driver.ReadRGBAPixels = read_R5G6B5_pixels; - } - else if (ctx->Visual->RedBits == 8 && - ctx->Visual->GreenBits == 8 && - ctx->Visual->BlueBits == 8 && ctx->Visual->AlphaBits == 0) { - /* 24bpp mode */ - ctx->Driver.WriteRGBASpan = write_R8G8B8_rgba_span; - ctx->Driver.WriteRGBSpan = write_R8G8B8_rgb_span; - ctx->Driver.WriteMonoRGBASpan = write_R8G8B8_mono_span; - ctx->Driver.WriteRGBAPixels = write_R8G8B8_pixels; - ctx->Driver.WriteMonoRGBAPixels = write_R8G8B8_mono_pixels; - ctx->Driver.ReadRGBASpan = read_R8G8B8_span; - ctx->Driver.ReadRGBAPixels = read_R8G8B8_pixels; - } - else if (ctx->Visual->RedBits == 8 && - ctx->Visual->GreenBits == 8 && - ctx->Visual->BlueBits == 8 && ctx->Visual->AlphaBits == 8) { - /* 32bpp mode */ - ctx->Driver.WriteRGBASpan = write_R8G8B8A8_rgba_span; - ctx->Driver.WriteRGBSpan = write_R8G8B8A8_rgb_span; - ctx->Driver.WriteMonoRGBASpan = write_R8G8B8A8_mono_span; - ctx->Driver.WriteRGBAPixels = write_R8G8B8A8_pixels; - ctx->Driver.WriteMonoRGBAPixels = write_R8G8B8A8_mono_pixels; - ctx->Driver.ReadRGBASpan = read_R8G8B8A8_span; - ctx->Driver.ReadRGBAPixels = read_R8G8B8A8_pixels; - } - else { - abort(); - } - - if (fxMesa->haveHwStencil) { - ctx->Driver.WriteStencilSpan = write_stencil_span; - ctx->Driver.ReadStencilSpan = read_stencil_span; - ctx->Driver.WriteStencilPixels = write_stencil_pixels; - ctx->Driver.ReadStencilPixels = read_stencil_pixels; - } - - ctx->Driver.WriteDepthSpan = fxDDWriteDepthSpan; - ctx->Driver.WriteDepthPixels = fxDDWriteDepthPixels; - ctx->Driver.ReadDepthSpan = fxDDReadDepthSpan; - ctx->Driver.ReadDepthPixels = fxDDReadDepthPixels; - - ctx->Driver.WriteCI8Span = NULL; - ctx->Driver.WriteCI32Span = NULL; - ctx->Driver.WriteMonoCISpan = NULL; - ctx->Driver.WriteCI32Pixels = NULL; - ctx->Driver.WriteMonoCIPixels = NULL; - ctx->Driver.ReadCI32Span = NULL; - ctx->Driver.ReadCI32Pixels = NULL; -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h b/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h deleted file mode 100644 index e4695c616..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h +++ /dev/null @@ -1,123 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -#ifndef FXDDTEX_H -#define FXDDTEX_H - - -#include "texutil.h" - - -extern void fxPrintTextureData(tfxTexInfo * ti); - -extern void fxTexGetFormat(GLenum, GrTextureFormat_t *, GLint *, - MesaIntTexFormat *, GLint *, GLboolean); - -extern void fxTexGetInfo(const GLcontext *, int, int, GrLOD_t *, - GrAspectRatio_t *, - float *, float *, int *, int *, int *, int *); - -extern GLboolean fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage, - GLboolean * retainInternalCopy); - -extern GLboolean fxDDTexSubImage2D(GLcontext * ctx, GLenum target, - GLint level, GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -extern GLboolean fxDDTestProxyTexImage(GLcontext *ctx, GLenum target, - GLint level, GLint internalFormat, - GLenum format, GLenum type, - GLint width, GLint height, - GLint depth, GLint border ); - -extern GLvoid *fxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, - const struct gl_texture_object *texObj, - GLenum * formatOut, GLenum * typeOut, - GLboolean * freeImageOut); - -extern GLboolean fxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, - GLint level, GLsizei imageSize, - const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage, - GLboolean *retainInternalCopy); -extern GLboolean fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, - GLint level, GLint xoffset, - GLint yoffset, GLsizei width, - GLint height, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); -extern void fxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, - GLint lod, void *image, - const struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); -extern GLint fxDDSpecificCompressedTexFormat(GLcontext *ctx, - GLint internalFormat, - GLint numDimensions, - GLint *levelp, - GLsizei *widthp, - GLsizei *heightp, - GLsizei *depthp, - GLint *borderp, - GLenum *formatp, - GLenum *typep); -extern GLint fxDDBaseCompressedTexFormat(GLcontext *ctx, - GLint internalFormat); - -#define fxDDIsCompressedFormatMacro(internalFormat) \ - (((internalFormat) == GL_COMPRESSED_RGB_FXT1_3DFX) || \ - ((internalFormat) == GL_COMPRESSED_RGBA_FXT1_3DFX)) -#define fxDDIsCompressedGlideFormatMacro(internalFormat) \ - ((internalFormat) == GR_TEXFMT_ARGB_CMP_FXT1) -extern GLboolean fxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat); - -extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *); - -extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *, - GLenum, const GLfloat *); - -extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *); - -extern void fxDDTexDel(GLcontext *, struct gl_texture_object *); - -extern GLboolean fxDDIsTextureResident(GLcontext *ctx, - struct gl_texture_object *t); - -extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *); - -extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean); - -/* - * Calculate the image size of a compressed texture. - * - * We return 0 if we can't calculate the size. - */ - -extern GLsizei fxDDCompressedImageSize(GLcontext *ctx, - GLenum internalFormat, - GLuint numDimensions, - GLuint width, - GLuint height, - GLuint depth); - -/* - * This is not in glext.h, since this is not an EXT or ARB - * extension. It probably shouldn't be here exactly, but - * there's not an obvious good place for it. - */ -#ifndef GL_S3_s3tc -#define GL_RGB_S3TC 0x83A0 -#define GL_RGB4_S3TC 0x83A1 -#define GL_RGBA_S3TC 0x83A2 -#define GL_RGBA4_S3TC 0x83A3 -#endif -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h b/xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h deleted file mode 100644 index d3ae3e30a..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h +++ /dev/null @@ -1,800 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Daryll Strauss <daryll@precisioninsight.com> - * Brian Paul <brianp@valinux.com> - */ - - -#ifndef _FXDRV_H_ -#define _FXDRV_H_ - -#ifdef GLX_DIRECT_RENDERING - -#include <sys/time.h> -#include "dri_tmm.h" -#include "dri_mesaint.h" -#include "dri_mesa.h" -#include "dri_xmesaapi.h" -#ifdef XFree86Server -#include "GL/xf86glx.h" -#else -#include "glheader.h" -#endif -#if defined(__linux__) -#include <signal.h> -#endif -#include "clip.h" -#include "context.h" -#include "fxglidew.h" -#include "macros.h" -#include "matrix.h" -#include "mem.h" -#include "texture.h" -#include "types.h" -#include "vb.h" -#include "vbrender.h" -#include "xform.h" - -typedef struct { - drmHandle handle; - drmSize size; - drmAddress map; -} tdfxRegion, *tdfxRegionPtr; - -typedef struct { - tdfxRegion regs; - int deviceID; - int width; - int height; - int mem; - int cpp; - int stride; - int fifoOffset; - int fifoSize; - int fbOffset; - int backOffset; - int depthOffset; - int textureOffset; - int textureSize; - __DRIscreenPrivate *driScrnPriv; -} tdfxScreenPrivate; - -typedef struct { - volatile int fifoPtr; - volatile int fifoRead; - volatile int fifoOwner; - volatile int ctxOwner; - volatile int texOwner; -} TDFXSAREAPriv; - - -extern void fx_sanity_triangle(fxMesaContext fxMesa, - GrVertex *, GrVertex *, GrVertex *); -#if defined(MESA_DEBUG) && 0 -#define grDrawTriangle fx_sanity_triangle -#endif - - -/* Define some shorter names for these things. - */ -#define XCOORD GR_VERTEX_X_OFFSET -#define YCOORD GR_VERTEX_Y_OFFSET -#define ZCOORD GR_VERTEX_OOZ_OFFSET -#define OOWCOORD GR_VERTEX_OOW_OFFSET - -#define RCOORD GR_VERTEX_R_OFFSET -#define GCOORD GR_VERTEX_G_OFFSET -#define BCOORD GR_VERTEX_B_OFFSET -#define ACOORD GR_VERTEX_A_OFFSET - -#define S0COORD GR_VERTEX_SOW_TMU0_OFFSET -#define T0COORD GR_VERTEX_TOW_TMU0_OFFSET -#define S1COORD GR_VERTEX_SOW_TMU1_OFFSET -#define T1COORD GR_VERTEX_TOW_TMU1_OFFSET - - -#define CLIP_XCOORD 0 /* normal place */ -#define CLIP_YCOROD 1 /* normal place */ -#define CLIP_ZCOORD 2 /* GR_VERTEX_Z_OFFSET */ -#define CLIP_WCOORD 3 /* GR_VERTEX_R_OFFSET */ -#define CLIP_GCOORD 4 /* normal place */ -#define CLIP_BCOORD 5 /* normal place */ -#define CLIP_RCOORD 6 /* GR_VERTEX_OOZ_OFFSET */ -#define CLIP_ACOORD 7 /* normal place */ - - -/* Should have size == 16 * sizeof(float). - */ -typedef struct -{ - GLfloat f[15]; /* Same layout as GrVertex */ - GLubyte mask; /* Unsued */ - GLubyte usermask; /* Unused */ -} -fxVertex; - - -#ifdef __i386__ -#define FXCOLOR4( c ) (* (int *)c) -#else -#define FXCOLOR4( c ) ( \ - ( ((unsigned int)(c[3]))<<24 ) | \ - ( ((unsigned int)(c[2]))<<16 ) | \ - ( ((unsigned int)(c[1]))<<8 ) | \ - ( (unsigned int)(c[0])) ) -#endif - - -#define FX_VB_COLOR(fxm, color) \ - do { \ - if (sizeof(GLint) == 4*sizeof(GLubyte)) { \ - if (fxm->constColor != *(GLuint*)color) { \ - fxm->constColor = *(GLuint*)color; \ - FX_grConstantColorValue(fxm, FXCOLOR4(color)); \ - } \ - } else { \ - FX_grConstantColorValue(fxm, FXCOLOR4(color)); \ - } \ - } while (0) - -#define GOURAUD(x) { \ - GLubyte *col = VB->ColorPtr->data[(x)]; \ - gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ - gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ - gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ - gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ -} - -#if FX_USE_PARGB -#define GOURAUD2(v, c) { \ - GLubyte *col = c; \ - PACK_4F_ARGB(GET_PARGB(v), col[3], col[0], col[1], col[2]); \ -} -#else -#define GOURAUD2(v, c) { \ - GLubyte *col = c; \ - v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ - v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ - v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ - v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ -} -#endif /* FX_USE_PARGB */ - - -/* Mergable items first - */ -#define SETUP_RGBA 0x1 -#define SETUP_TMU0 0x2 -#define SETUP_TMU1 0x4 -#define SETUP_XY 0x8 -#define SETUP_Z 0x10 -#define SETUP_W 0x20 - -#define MAX_MERGABLE 0x8 - - -#define FX_NUM_TMU 2 - -#define FX_TMU0 GR_TMU0 -#define FX_TMU1 GR_TMU1 -#define FX_TMU_SPLIT 98 -#define FX_TMU_BOTH 99 -#define FX_TMU_NONE 100 - -/* Used for fxMesa->lastUnitsMode */ - -#define FX_UM_NONE 0x00000000 - -#define FX_UM_E0_REPLACE 0x00000001 -#define FX_UM_E0_MODULATE 0x00000002 -#define FX_UM_E0_DECAL 0x00000004 -#define FX_UM_E0_BLEND 0x00000008 -#define FX_UM_E0_ADD 0x00000010 - -#define FX_UM_E1_REPLACE 0x00000020 -#define FX_UM_E1_MODULATE 0x00000040 -#define FX_UM_E1_DECAL 0x00000080 -#define FX_UM_E1_BLEND 0x00000100 -#define FX_UM_E1_ADD 0x00000200 - -#define FX_UM_E_ENVMODE 0x000003ff - -#define FX_UM_E0_ALPHA 0x00001000 -#define FX_UM_E0_LUMINANCE 0x00002000 -#define FX_UM_E0_LUMINANCE_ALPHA 0x00004000 -#define FX_UM_E0_INTENSITY 0x00008000 -#define FX_UM_E0_RGB 0x00010000 -#define FX_UM_E0_RGBA 0x00020000 - -#define FX_UM_E1_ALPHA 0x00040000 -#define FX_UM_E1_LUMINANCE 0x00080000 -#define FX_UM_E1_LUMINANCE_ALPHA 0x00100000 -#define FX_UM_E1_INTENSITY 0x00200000 -#define FX_UM_E1_RGB 0x00400000 -#define FX_UM_E1_RGBA 0x00800000 - -#define FX_UM_E_IFMT 0x00fff000 - -#define FX_UM_COLOR_ITERATED 0x01000000 -#define FX_UM_COLOR_CONSTANT 0x02000000 -#define FX_UM_ALPHA_ITERATED 0x04000000 -#define FX_UM_ALPHA_CONSTANT 0x08000000 - - -#define PACK_BGRA32(R, G, B, A) \ - ( (((GLuint) (R)) << 16) | \ - (((GLuint) (G)) << 8) | \ - (((GLuint) (B)) ) | \ - (((GLuint) (A)) << 24) ) - -#define PACK_RGBA32(R, G, B, A) \ - ( (((GLuint) (R)) ) | \ - (((GLuint) (G)) << 8) | \ - (((GLuint) (B)) << 16) | \ - (((GLuint) (A)) << 24) ) - -/* - * The first two macros are to pack 8 bit color - * channel values into a 565 format. - */ -#define PACK_RGB16(R, G, B) \ - ((((GLuint) (R) & 0xF8) << 8) | \ - (((GLuint) (G) & 0xFC) << 3) | \ - (((GLuint) (B) & 0xFF) >> 3)) -#define PACK_BGR16(R, G, B) \ - ((((GLuint) (B) & 0xF8) << 8) | \ - (((GLuint) (G) & 0xFC) << 3) | \ - (((GLuint) (R) & 0xFF) >> 3)) -/* - * The second two macros pack 8 bit color channel values - * into 1555 values. - */ -#define PACK_RGBA16(R, G, B, A) \ - (((((GLuint) (A) & 0xFF) > 0) << 15)| \ - (((GLuint) (R) & 0xF8) << 7) | \ - (((GLuint) (G) & 0xF8) << 2) | \ - (((GLuint) (B) & 0xF8) >> 3)) -#define PACK_BGRA16(R, G, B, A) \ - (((((GLuint) (A) & 0xFF) > 0) << 15)| \ - (((GLuint) (B) & 0xF8) << 7) | \ - (((GLuint) (G) & 0xF8) << 2) | \ - (((GLuint) (R) & 0xF8) >> 3)) - -typedef void (*tfxRenderVBFunc) (GLcontext *); - -/* - Memory range from startAddr to endAddr-1 -*/ -typedef struct MemRange_t -{ - struct MemRange_t *next; - FxU32 startAddr, endAddr; -} -MemRange; - - -typedef struct -{ - GLsizei width, height; /* image size */ - GLint texelSize; /* How many bytes to a texel */ - GrTextureFormat_t glideFormat; /* Glide image format */ - unsigned short *data; /* Glide-formated texture image */ - FxU32 dataSize; /* Count of the data size */ -} -tfxMipMapLevel; - - -typedef struct tfxTexInfo_t -{ - struct tfxTexInfo *next; - struct gl_texture_object *tObj; - - GLuint lastTimeUsed; - FxU32 whichTMU; - GLboolean isInTM; - - GrAspectRatio_t aspectRatio; - tfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS]; - - MemRange *tm[FX_NUM_TMU]; - - GLint minLevel, maxLevel; - GLint baseLevelInternalFormat; - - GrTexInfo info; - - GrTextureFilterMode_t minFilt; - GrTextureFilterMode_t maxFilt; - FxBool LODblend; - - GrTextureClampMode_t sClamp; - GrTextureClampMode_t tClamp; - - GrMipMapMode_t mmMode; - - GLfloat sScale, tScale; - GLint int_sScale, int_tScale; /* x86 floating point trick for - * multiplication by powers of 2. - * Used in fxfasttmp.h - */ - GuTexPalette palette; - - GLboolean fixedPalette; - GLboolean validated; -} -tfxTexInfo; - - -typedef struct -{ - GLuint swapBuffer; - GLuint reqTexUpload; - GLuint texUpload; - GLuint memTexUpload; - GLuint texSwaps; -} -tfxStats; - - -typedef void (*tfxTriViewClipFunc) (struct vertex_buffer * VB, - GLuint v[], GLubyte mask); - -typedef void (*tfxTriClipFunc) (struct vertex_buffer * VB, - GLuint v[], GLuint mask); - - -typedef void (*tfxLineClipFunc) (struct vertex_buffer * VB, - GLuint v1, GLuint v2, GLubyte mask); - - -extern tfxTriViewClipFunc fxTriViewClipTab[0x8]; -extern tfxTriClipFunc fxTriClipStrideTab[0x8]; -extern tfxLineClipFunc fxLineClipTab[0x8]; - -typedef struct -{ - /* Alpha test */ - GLboolean alphaTestEnabled; - GrCmpFnc_t alphaTestFunc; - GrAlpha_t alphaTestRefValue; - - /* Blend function */ - GLboolean blendEnabled; - GrAlphaBlendFnc_t blendSrcFuncRGB; - GrAlphaBlendFnc_t blendDstFuncRGB; - GrAlphaBlendFnc_t blendSrcFuncAlpha; - GrAlphaBlendFnc_t blendDstFuncAlpha; -} -tfxUnitsState; - - - -/* Flags for render_index. - */ -#define FX_OFFSET 0x1 -#define FX_TWOSIDE 0x2 -#define FX_FRONT_BACK 0x4 -#define FX_FLAT 0x8 -#define FX_ANTIALIAS 0x10 -#define FX_FALLBACK 0x20 - - -/* Flags for fxMesa->new_state - */ -#define FX_NEW_TEXTURING 0x1 -#define FX_NEW_BLEND 0x2 -#define FX_NEW_ALPHA 0x4 -#define FX_NEW_DEPTH 0x8 -#define FX_NEW_FOG 0x10 -#define FX_NEW_SCISSOR 0x20 -#define FX_NEW_COLOR_MASK 0x40 -#define FX_NEW_CULL 0x80 -#define FX_NEW_STENCIL 0x100 - -/* FX struct stored in VB->driver_data. - */ -struct tfxMesaVertexBuffer -{ - GLuint size; /* Number of vertexes */ - GLvector1ui clipped_elements; /* Array [size] of GLuints */ - fxVertex *verts; /* Array of [size] fxVertex */ - fxVertex *last_vert; /* Points into verts array */ -#if defined(FX_GLIDE3) - GrVertex **triangle_b; /* Triangle buffer */ - GrVertex **strips_b; /* Strips buffer */ -#endif -}; - -#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data)) -#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx)) -#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current) - -#if !defined(FX_PXCONV_TABULAR) \ - && !defined(FX_PXCONV_APPROXIMATION) \ - && !defined(FX_PXCONV_EXACT) -#define FX_PXCONV_TABULAR -#endif -/* These lookup table are used to extract RGB values in [0,255] from - * 16-bit pixel values. - * - * In general, we want to convert 5 or 6 bit numbers to 8 - * bit numbers. - * o In the FX_PXCONV_TABULAR case, we do the numerically - * correct calculation at initialization time, and store - * the results in three large tables. - * o In the FX_PXCONV_APPROXIMATION method we approximate - * the numerically correct value by using the upper bits - * of the 5 or 6 bit value. That is, - * 8bitvalue = 5bitvalue << 3 | (5bitvalue >> 2) - * o In the FX_PXCONV_EXACT method, we calculate the - * exact value at runtime every time, using a floating - * point calculation. - */ -#define FX_PXCONV_INT_FIELD(v, w, s) (((v) >> (s)) & ((1 << (w)) - 1)) -#if defined(FX_PXCONV_TABULAR) -/* These lookup table are used to extract RGB values in [0,255] from - * 16-bit pixel values. - */ -extern GLubyte FX_PixelToRArray[0x10000]; -extern GLubyte FX_PixelToGArray[0x10000]; -extern GLubyte FX_PixelToBArray[0x10000]; -#define FX_PixelToB(fxMesa, v) (FX_PixelToBArray[(v)]) -#define FX_PixelToR(fxMesa, v) (FX_PixelToRArray[(v)]) -#define FX_PixelToG(fxMesa, v) (FX_PixelToGArray[(v)]) -#elif defined(FX_PXCONV_APPROXIMATION) -#define FX_PixelToR(fxMesa, v) \ - ((fxMesa)->bgrOrder \ - ? (FX_PXCONV_INT_FIELD(v, 5, 0) << 3) | FX_PXCONV_INT_FIELD(v, 3, 2) \ - : (FX_PXCONV_INT_FIELD(v, 5, 11) << 3) | FX_PXCONV_INT_FIELD(v, 3, 13)) -#define FX_PixelToG(fxMesa, v) \ - ((FX_PXCONV_INT_FIELD(v, 6, 5) << 2) | FX_PXCONV_INT_FIELD(v, 2, 7)) -#define FX_PixelToB(fxMesa, v) \ - ((fxMesa)->bgrOrder \ - ? (FX_PXCONV_INT_FIELD(v, 5, 11) << 3) | FX_PXCONV_INT_FIELD(v, 3, 13)\ - : (FX_PXCONV_INT_FIELD(v, 5, 0) << 3) | FX_PXCONV_INT_FIELD(v, 3, 2)) -#elif defined(FX_PXCONV_EXACT) -#define FX_PixelToR(fxMesa, v) \ - ((((fxMesa)->bgrOrder \ - ? FX_PXCONV_INT_FIELD(v, 5, 0) \ - : FX_PXCONV_INT_FIELD(v, 5, 11)) * 8 * 255) / 0xF8) -#define FX_PixelToG(fxMesa, v) \ - ((FX_PXCONV_INT_FIELD(v, 6, 5) * 4 * 255) / 0xFC) -#define FX_PixelToB(fxMesa, v) \ - ((((fxMesa)->bgrOrder \ - ? FX_PXCONV_INT_FIELD(v, 5, 11) \ - : FX_PXCONV_INT_FIELD(v, 5, 0)) * 8 * 255) / 0xF8) -#else -#error Need to define pixel a conversion method. -#endif - - -/* - * This is state which may be shared by several tdfx contexts. - * It hangs off of Mesa's gl_shared_state object (ctx->Shared->DriverData). - */ -struct TdfxSharedState -{ - GLboolean umaTexMemory; - GLuint totalTexMem[FX_NUM_TMU]; /* constant */ - GLuint freeTexMem[FX_NUM_TMU]; /* changes as we go */ - MemRange *tmPool; - MemRange *tmFree[FX_NUM_TMU]; -}; - - -/* - * This is the tdfx context struct. - */ -struct tfxMesaContext -{ - /* - * Set once and never changed: - */ - GLcontext *glCtx; /* the core Mesa context */ - GLvisual *glVis; /* describes the color buffer */ - - GLboolean initDone; /* has this context been initialized? */ - GLint board; /* the board used for this context */ - int screen_width; - int screen_height; - - FX_GrContext_t glideContext; /* returned by grSstWinOpen() */ - void *state; /* Glide state buffer */ - - GLint textureAlign; - GLboolean bgrOrder; - GLboolean verbose; - GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */ - GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */ - GLboolean haveHwStencil; - GLboolean isNapalm; - GLint swapInterval; - GLint maxPendingSwapBuffers; - - /* stuff added for DRI */ - __DRIcontextPrivate *driContextPriv; - drmContext hHWContext; - int numClipRects; - XF86DRIClipRectPtr pClipRects; - tdfxScreenPrivate *tdfxScrnPriv; - - /* - * Changes during execution: - */ - int width, height; /* size of window */ - int x_offset; /* distance from window left to screen left */ - int y_offset; /* distance from window top to screen top */ - int y_delta; /* distance from window bottom to screen bottom */ - int needClip; /* need to loop over cliprects? */ - int clipMinX; /* if !needClip, bounds of the single clip rect */ - int clipMaxX; /* "" */ - int clipMinY; /* "" */ - int clipMaxY; /* "" */ - - - GrBuffer_t currentFB; /* front buffer or back buffer */ - - GLuint depthClear; /* glClear depth value */ - GrColor_t clearC; /* glClear color value */ - GrAlpha_t clearA; /* glClear alpha value */ - GLuint constColor; - GrColor_t color; - GrCullMode_t cullMode; - - tfxUnitsState unitsState; - tfxUnitsState restoreUnitsState; /* saved during multipass */ - - GuTexPalette glbPalette; /* global texture palette */ - - GLuint tmu_source[FX_NUM_TMU]; - GLuint tex_dest[MAX_TEXTURE_UNITS]; - GLuint setupindex; - GLuint partial_setup_index; - GLuint setupdone; - GLuint mergeindex; - GLuint mergeinputs; - GLuint render_index; - GLuint last_tri_caps; - GLuint stw_hint_state; /* for grHints */ - GLuint is_in_hardware; - GLuint new_state; - GLuint using_fast_path, passes, multipass; - GLuint texBindNumber; - GLint tmuSrc; - - tfxLineClipFunc clip_line; - tfxTriClipFunc clip_tri_stride; - tfxTriViewClipFunc view_clip_tri; - - GLenum fogTableMode; - GLfloat fogDensity; - GLfloat fogStart, fogEnd; - GrFog_t *fogTable; - - /* Acc. functions */ - - points_func PointsFunc; - line_func LineFunc; - triangle_func TriangleFunc; - quad_func QuadFunc; - - render_func **RenderVBTables; - render_func *RenderVBClippedTab; - render_func *RenderVBCulledTab; - render_func *RenderVBRawTab; - - tfxStats stats; -}; - - -typedef void (*tfxSetupFunc) (struct vertex_buffer *, GLuint, GLuint); - - -extern void fxPrintSetupFlags(const char *msg, GLuint flags); -extern void fxSetupDDPointers(GLcontext *); - -extern void fxDDSetupInit(void); -extern void fxDDCvaInit(void); -extern void fxDDTrifuncInit(void); -extern void fxDDFastPathInit(void); - -extern void fxDDRenderInitGlide3(GLcontext * ctx); - -extern void fxDDChooseRenderState(GLcontext * ctx); - -extern void fxRenderClippedLine(struct vertex_buffer *VB, - GLuint v1, GLuint v2); - -extern void fxRenderClippedTriangle(struct vertex_buffer *VB, - GLuint n, GLuint vlist[]); - - -extern tfxSetupFunc fxDDChooseSetupFunction(GLcontext *); - -extern points_func fxDDChoosePointsFunction(GLcontext *); -extern line_func fxDDChooseLineFunction(GLcontext *); -extern triangle_func fxDDChooseTriangleFunction(GLcontext *); -extern quad_func fxDDChooseQuadFunction(GLcontext *); -extern render_func **fxDDChooseRenderVBTables(GLcontext *); - -extern void fxDDRenderInit(GLcontext *); -extern void fxDDClipInit(void); - -extern void fxSetupDDSpanPointers(GLcontext *); - - -extern void fxDDRegisterVB(struct vertex_buffer *VB); -extern void fxDDUnregisterVB(struct vertex_buffer *VB); -extern void fxDDResizeVB(struct vertex_buffer *VB, GLuint size); - -extern void fxDDMergeAndRender(struct vertex_buffer *VB); - -extern void fxDDCheckPartialRasterSetup(GLcontext * ctx, - struct gl_pipeline_stage *d); - -extern void fxDDPartialRasterSetup(struct vertex_buffer *VB); - -extern void fxDDDoRasterSetup(struct vertex_buffer *VB); - -extern void fxDDRenderElementsDirect(struct vertex_buffer *VB); -extern void fxDDRenderVBIndirectDirect(struct vertex_buffer *VB); - -extern void fxDDFastPath(struct vertex_buffer *VB); - -extern void fxPrintRenderState(const char *msg, GLuint state); -extern void fxPrintHintState(const char *msg, GLuint state); - -extern void fxDDDoRenderVB(struct vertex_buffer *VB); - -extern int fxDDInitFxMesaContext(fxMesaContext fxMesa); - - -extern void fxSetScissorValues(GLcontext * ctx); -extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, - struct gl_texture_object *tObj, FxU32 where); -extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder); - - - -extern GLboolean tdfxMapAllRegions(__DRIscreenPrivate * driScrnPriv); -extern void tdfxUnmapAllRegions(__DRIscreenPrivate * driScrnPriv); -extern GLboolean tdfxInitHW(__DRIdrawablePrivate * driDrawPrivate, - fxMesaContext cPriv); - -extern void XMesaUpdateState(fxMesaContext fxMesa); - - -/* This is the private interface between Glide and DRI */ -#if 0 -extern void grDRIOpen(char *pFB, tdfxScreenPrivate *sPriv, - volatile int *fifoPtr, volatile int *fifoRead); -#endif -extern void grDRIPosition(int x, int y, int w, int h, - int numClip, XF86DRIClipRectPtr pClip); -extern void grDRILostContext(void); -extern void grDRIImportFifo(int fifoPtr, int fifoRead); -extern void grDRIInvalidateAll(void); -extern void grDRIResetSAREA(void); -extern void grDRIBufferSwap(FxU32 swapInterval); -extern void grDRISwapClipRects(FxU32 swapInterval, - int numClip, - const XF86DRIClipRectPtr pClip); - - - -/* You can turn this on to find locking conflicts. -#define DEBUG_LOCKING -*/ - -#ifdef DEBUG_LOCKING -extern char *prevLockFile; -extern int prevLockLine; -#define DEBUG_LOCK() \ - do { \ - prevLockFile=(__FILE__); \ - prevLockLine=(__LINE__); \ - } while (0) -#define DEBUG_RESET() \ - do { \ - prevLockFile=0; \ - prevLockLine=0; \ - } while (0) -#define DEBUG_CHECK_LOCK() \ - do { \ - if (prevLockFile) { \ - fprintf(stderr, "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \ - prevLockFile, prevLockLine, __FILE__, __LINE__); \ - exit(1); \ - } \ - } while (0) -#else -#define DEBUG_LOCK() -#define DEBUG_RESET() -#define DEBUG_CHECK_LOCK() -#endif /* DEBUG_LOCKING */ - - -/* !!! We may want to separate locks from locks with validation. - This could be used to improve performance for those things - commands that do not do any drawing !!! */ - -#define DRM_LIGHT_LOCK_RETURN(fd,lock,context,__ret) \ - do { \ - DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \ - if (__ret) drmGetLock(fd,context,0); \ - } while(0) - -#define LOCK_HARDWARE(fxMesa) XMesaUpdateState(fxMesa) - -/* Unlock the hardware using the global current context */ -#define UNLOCK_HARDWARE(fxMesa) \ - do { \ - __DRIcontextPrivate *cPriv = fxMesa->driContextPriv; \ - __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; \ - __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; \ - DRM_UNLOCK(sPriv->fd, &sPriv->pSAREA->lock, \ - dPriv->driContextPriv->hHWContext); \ - DEBUG_RESET(); \ - } while (0) - -#define BEGIN_BOARD_LOCK(fxMesa) LOCK_HARDWARE(fxMesa) -#define END_BOARD_LOCK(fxMesa) UNLOCK_HARDWARE(fxMesa) - -/* - This pair of macros makes a loop over the drawing operations - so it is not self contained and doesn't have the nice single - statement semantics of most macros -*/ -#define BEGIN_CLIP_LOOP(fxMesa) \ - do { \ - __DRIcontextPrivate *cPriv = fxMesa->driContextPriv; \ - __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; \ - int _nc; \ - LOCK_HARDWARE(fxMesa); \ - _nc = dPriv->numClipRects; \ - while (_nc--) { \ - if (fxMesa->needClip) { \ - fxMesa->clipMinX = dPriv->pClipRects[_nc].x1; \ - fxMesa->clipMaxX = dPriv->pClipRects[_nc].x2; \ - fxMesa->clipMinY = dPriv->pClipRects[_nc].y1; \ - fxMesa->clipMaxY = dPriv->pClipRects[_nc].y2; \ - fxSetScissorValues(fxMesa->glCtx); \ - } - -#define END_CLIP_LOOP(fxMesa) \ - } \ - UNLOCK_HARDWARE(fxMesa); \ - } while (0) - - -#endif /* GLX_DIRECT_RENDERING */ - -#endif /* _FXDRV_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c b/xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c deleted file mode 100644 index e238f0584..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c +++ /dev/null @@ -1,365 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c,v 1.4 2000/12/09 02:13:22 dawes Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include "types.h" -#include "cva.h" -#include "mmath.h" -#include "fxdrv.h" -#include "fxtexman.h" -#include "vertices.h" -#ifdef __i386__ -#include "X86/common_x86_asm.h" -#endif - - -#if 0 && defined(__i386__) -#define NEGATIVE(f) ((*(int *)&f) < 0) -#define DIFFERENT_SIGNS(a,b) (((*(int *)&a)^(*(int *)&b)) < 0) -#else -#define NEGATIVE(f) (f < 0) -#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) -#endif - -#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) ) - - -#define CLIP(sgn,v,PLANE) \ -if (mask & PLANE) { \ - GLuint *indata = inlist[in]; \ - GLuint *outdata = inlist[in ^= 1]; \ - GLuint nr = n; \ - GLfloat *J = verts[indata[nr-1]].f; \ - GLfloat dpJ = (sgn J[v]) + J[CLIP_WCOORD]; \ - \ - inlist[0] = vlist1; \ - for (i = n = 0 ; i < nr ; i++) { \ - GLuint elt_i = indata[i]; \ - GLfloat *I = verts[elt_i].f; \ - GLfloat dpI = (sgn I[v]) + I[CLIP_WCOORD]; \ - \ - if (DIFFERENT_SIGNS(dpI, dpJ)) { \ - GLfloat *O = verts[next_vert].f; \ - GLfloat t = dpI / (dpI - dpJ); \ - GLuint j; \ - \ - clipmask[next_vert] = 0; \ - outdata[n++] = next_vert++; \ - \ - for (j = 0 ; j < SIZE ; j += 2) { \ - O[j] = LINTERP(t, I[j], J[j]); \ - O[j+1] = LINTERP(t, I[j+1], J[j+1]); \ - } \ - } \ - \ - clipmask[elt_i] |= PLANE; /* don't set up */ \ - \ - if (!NEGATIVE(dpI)) { \ - outdata[n++] = elt_i; \ - clipmask[elt_i] &= ~PLANE; /* set up after all */ \ - } \ - \ - J = I; \ - dpJ = dpI; \ - } \ - \ - if (n < 3) return; \ -} - -#define LINE_CLIP(x,y,z,w,PLANE) \ -if (mask & PLANE) { \ - GLfloat dpI = DOT4V(I,x,y,z,w); \ - GLfloat dpJ = DOT4V(J,x,y,z,w); \ - \ - if (DIFFERENT_SIGNS(dpI, dpJ)) { \ - GLfloat *O = verts[next_vert].f; \ - GLfloat t = dpI / (dpI - dpJ); \ - GLuint j; \ - \ - for (j = 0 ; j < SIZE ; j += 2) { \ - O[j] = LINTERP(t, I[j], J[j]); \ - O[j+1] = LINTERP(t, I[j+1], J[j+1]); \ - } \ - \ - clipmask[next_vert] = 0; \ - \ - if (NEGATIVE(dpI)) { \ - clipmask[elts[0]] |= PLANE; \ - I = O; elts[0] = next_vert++; \ - } else { \ - clipmask[elts[1]] |= PLANE; \ - J = O; elts[1] = next_vert++; \ - } \ - } \ - else if (NEGATIVE(dpI)) \ - return; \ -} - - -#define CLIP_POINT( e ) \ - if (mask[e]) \ - *out++ = e - -#define CLIP_LINE( e1, e0 ) \ -do { \ - GLubyte ormask = mask[e0] | mask[e1]; \ - out[0] = e1; \ - out[1] = e0; \ - out+=2; \ - if (ormask) { \ - out-=2; \ - if (!(mask[e0] & mask[e1])) { \ - TAG(fx_line_clip)( &out, verts, mask, &next_vert, ormask); \ - } \ - } \ -} while (0) - -#define CLIP_TRIANGLE( e2, e1, e0 ) \ -do { \ - GLubyte ormask; \ - out[0] = e2; \ - out[1] = e1; \ - out[2] = e0; \ - out += 3; \ - ormask = mask[e2] | mask[e1] | mask[e0]; \ - if (ormask) { \ - out -= 3; \ - if ( !(mask[e2] & mask[e1] & mask[e0])) { \ - TAG(fx_tri_clip)( &out, verts, mask, &next_vert, ormask ); \ - } \ - } \ -} while (0) - - -/* Add window offset to window coords to get screen coords */ - -#define VARS_XYZ \ - GLfloat vsx = mat[MAT_SX]; \ - GLfloat vsy = mat[MAT_SY]; \ - GLfloat vsz = mat[MAT_SZ]; \ - GLfloat vtx = mat[MAT_TX]; \ - GLfloat vty = mat[MAT_TY]; \ - GLfloat vtz = mat[MAT_TZ]; - -#define DO_SETUP_XYZ \ - f[XCOORD] = f[0] * oow * vsx + vtx; \ - f[YCOORD] = f[1] * oow * vsy + vty; \ - f[ZCOORD] = f[2] * oow * vsz + vtz; - - - - -struct fx_fast_tab -{ - void (*build_vertices) (struct vertex_buffer * VB, GLuint do_clip); - - void (*clip[GL_POLYGON + 1]) (struct vertex_buffer * VB, - GLuint start, GLuint count, GLuint parity); - - void (*project_clipped_vertices) (GLfloat * first, - GLfloat * last, - const GLfloat * mat, - GLuint stride, const GLubyte * mask); - - void (*project_vertices) (GLfloat * first, - GLfloat * last, - const GLfloat * mat, GLuint stride); -}; - -/* Pack either rgba or texture into the remaining half of a 32 byte vertex. - */ -#define CLIP_R CLIP_RCOORD -#define CLIP_G CLIP_GCOORD -#define CLIP_B CLIP_BCOORD -#define CLIP_A CLIP_ACOORD -#define CLIP_S0 4 -#define CLIP_T0 5 -#define CLIP_S1 6 -#define CLIP_T1 7 - -#define SIZE 4 -#define TYPE (0) -#define TAG(x) x -#include "fxfasttmp.h" - -#define SIZE 8 -#define TYPE (SETUP_RGBA) -#define TAG(x) x##_RGBA -#include "fxfasttmp.h" - -#define SIZE 6 -#define TYPE (SETUP_TMU0) -#define TAG(x) x##_TMU0 -#include "fxfasttmp.h" - -#define SIZE 8 -#define TYPE (SETUP_TMU0|SETUP_TMU1) -#define TAG(x) x##_TMU0_TMU1 -#include "fxfasttmp.h" - -#undef CLIP_S1 -#undef CLIP_T1 -#define CLIP_S1 4 -#define CLIP_T1 5 - -#define SIZE 6 -#define TYPE (SETUP_TMU1) -#define TAG(x) x##_TMU1 -#include "fxfasttmp.h" - -/* These three need to use a full 64 byte clip-space vertex. - */ -#undef CLIP_S0 -#undef CLIP_T0 -#undef CLIP_S1 -#undef CLIP_T1 - -#define CLIP_S0 8 -#define CLIP_T0 9 -#define CLIP_S1 10 -#define CLIP_T1 11 - -#define SIZE 10 -#define TYPE (SETUP_RGBA|SETUP_TMU0) -#define TAG(x) x##_RGBA_TMU0 -#include "fxfasttmp.h" - -#define SIZE 12 -#define TYPE (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1) -#define TAG(x) x##_RGBA_TMU0_TMU1 -#include "fxfasttmp.h" - -#undef CLIP_S1 -#undef CLIP_T1 -#define CLIP_S1 8 -#define CLIP_T1 9 - -#define SIZE 10 -#define TYPE (SETUP_RGBA|SETUP_TMU1) -#define TAG(x) x##_RGBA_TMU1 -#include "fxfasttmp.h" - -static struct fx_fast_tab fxFastTab[0x8]; - -void -fxDDFastPathInit() -{ - fx_init_fastpath(&fxFastTab[0]); - fx_init_fastpath_RGBA(&fxFastTab[SETUP_RGBA]); - fx_init_fastpath_TMU0(&fxFastTab[SETUP_TMU0]); - fx_init_fastpath_TMU1(&fxFastTab[SETUP_TMU1]); - fx_init_fastpath_RGBA_TMU0(&fxFastTab[SETUP_RGBA | SETUP_TMU0]); - fx_init_fastpath_RGBA_TMU1(&fxFastTab[SETUP_RGBA | SETUP_TMU1]); - fx_init_fastpath_TMU0_TMU1(&fxFastTab[SETUP_TMU0 | SETUP_TMU1]); - fx_init_fastpath_RGBA_TMU0_TMU1(&fxFastTab[SETUP_RGBA | SETUP_TMU0 | - SETUP_TMU1]); -} - - - -void -fxDDFastPath(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - GLenum prim = ctx->CVA.elt_mode; - struct tfxMesaContext *fxMesa = FX_CONTEXT(ctx); - struct fx_fast_tab *tab = &fxFastTab[fxMesa->setupindex & 0x7]; - GLuint do_clip = 1; - struct tfxMesaVertexBuffer *fxVB = FX_DRIVER_DATA(VB); - GLfloat tx, ty; - - fxVertex *first; - GLfloat *mat = ctx->Viewport.WindowMap.m; - - gl_prepare_arrays_cva(VB); /* still need this */ - - if (VB->EltPtr->count * 12 > fxVB->size) { - fxDDResizeVB(VB, VB->EltPtr->count * 12); - do_clip = 1; - } - - tab->build_vertices(VB, do_clip); /* object->clip space */ - - first = FX_DRIVER_DATA(VB)->verts; - - /* Add window offset to window coords to get screen coords */ - tx = mat[MAT_TX]; - ty = mat[MAT_TY]; - mat[MAT_TX] = tx + fxMesa->x_offset; - mat[MAT_TY] = ty + fxMesa->y_delta; - - if (VB->ClipOrMask) { - if (!VB->ClipAndMask) { - GLubyte tmp = VB->ClipOrMask; - - tab->clip[prim] (VB, 0, VB->EltPtr->count, 0); /* clip */ - - tab->project_clipped_vertices(fxVB->verts->f, - fxVB->last_vert->f, - mat, 16 * 4, VB->ClipMask); - - ctx->CVA.elt_mode = gl_reduce_prim[prim]; - VB->EltPtr = &(FX_DRIVER_DATA(VB)->clipped_elements); - - VB->ClipOrMask = 0; - fxDDRenderElementsDirect(VB); /* render using new list */ - VB->ClipOrMask = tmp; - } - } - else { - tab->project_vertices(fxVB->verts->f, fxVB->last_vert->f, mat, - 16 * 4); - - fxDDRenderElementsDirect(VB); /* render using orig list */ - } - - /* Add window offset to window coords to get screen coords */ - mat[MAT_TX] = tx; - mat[MAT_TY] = ty; - - /* This indicates that there is no cached data to reuse. - */ - VB->pipeline->data_valid = 0; - VB->pipeline->pipeline_valid = 0; -} - diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h deleted file mode 100644 index 8a85a2ad5..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h +++ /dev/null @@ -1,357 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h,v 1.4 2000/12/12 23:24:28 dawes Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* Build clip space vertices from object space data. - */ -static void TAG(fx_setup_full) (struct vertex_buffer * VB, GLuint do_clip) -{ - GLcontext *ctx = VB->ctx; - GLfloat *f = (GLfloat *) FX_DRIVER_DATA(VB)->verts; - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - GLuint count = VB->Count; - GLuint i; - - const GLfloat *const m = ctx->ModelProjectMatrix.m; - -#if (TYPE & SETUP_RGBA) - GLubyte *color = (GLubyte *) VB->ColorPtr->data; - GLuint color_stride = VB->ColorPtr->stride; -#endif - -#if (TYPE & SETUP_TMU0) - GLuint tmu0_source = fxMesa->tmu_source[0]; - struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; - GLint s0scale = FX_TEXTURE_DATA(t0)->int_sScale; - GLint t0scale = FX_TEXTURE_DATA(t0)->int_tScale; - GLint *tmu0_int_data = (GLint *) VB->TexCoordPtr[tmu0_source]->data; - GLuint tmu0_stride = VB->TexCoordPtr[tmu0_source]->stride; -#endif - -#if (TYPE & SETUP_TMU1) - GLuint tmu1_source = fxMesa->tmu_source[1]; - struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; - GLint s1scale = FX_TEXTURE_DATA(t1)->int_sScale; - GLint t1scale = FX_TEXTURE_DATA(t1)->int_tScale; - GLint *tmu1_int_data = (GLint *) VB->TexCoordPtr[tmu1_source]->data; - GLuint tmu1_stride = VB->TexCoordPtr[tmu1_source]->stride; -#endif - - (void) fxMesa; - (void) ctx; - (void) i; - (void) f; - - /* Use 3 seperate loops because it's easier for assembly. A - * best-case solution might be to do all three in a single assembly - * loop. - */ - gl_xform_points3_v16_general(FX_DRIVER_DATA(VB)->verts[0].f, - m, - VB->ObjPtr->start, VB->ObjPtr->stride, - count); - - if (do_clip) { - VB->ClipAndMask = ~0; - VB->ClipOrMask = 0; - gl_cliptest_points4_v16(FX_DRIVER_DATA(VB)->verts[0].f, - FX_DRIVER_DATA(VB)->verts[count].f, - &(VB->ClipOrMask), - &(VB->ClipAndMask), VB->ClipMask); - } - - -#if (TYPE) - for (i = 0; i < count; i++, f += 16) { -#if (TYPE & SETUP_RGBA) - GLubyte *col = color; - color += color_stride; - UBYTE_COLOR_TO_FLOAT_255_COLOR2(f[CLIP_R], col[0]); - UBYTE_COLOR_TO_FLOAT_255_COLOR2(f[CLIP_G], col[1]); - UBYTE_COLOR_TO_FLOAT_255_COLOR2(f[CLIP_B], col[2]); - UBYTE_COLOR_TO_FLOAT_255_COLOR2(f[CLIP_A], col[3]); -#endif -#if (TYPE & SETUP_TMU0) - *(int *) &f[CLIP_S0] = s0scale + tmu0_int_data[0]; - *(int *) &f[CLIP_T0] = t0scale + tmu0_int_data[1]; - STRIDE_T(tmu0_int_data, GLint, tmu0_stride); -#endif -#if (TYPE & SETUP_TMU1) - *(int *) &f[CLIP_S1] = s1scale + tmu1_int_data[0]; - *(int *) &f[CLIP_T1] = t1scale + tmu1_int_data[1]; - STRIDE_T(tmu1_int_data, GLint, tmu1_stride); -#endif - } -#endif - - FX_DRIVER_DATA(VB)->last_vert = &(FX_DRIVER_DATA(VB)->verts[count]); -} - - -/* Do viewport map, device scale and perspective projection. - * - * Rearrange fxVertices to look like grVertices. - */ -static void TAG(fx_project_vertices) (GLfloat * first, - GLfloat * last, - const GLfloat * mat, GLuint stride) -{ - GLfloat *f; - VARS_XYZ; - - for (f = first; f != last; STRIDE_F(f, stride)) { - GLfloat oow = 1.0f / f[CLIP_WCOORD]; /* urp! */ - -#if FX_USE_PARGB - if (TYPE & SETUP_RGBA) { - PACK_4F_ARGB(GET_PARGB(f), f[CLIP_A], f[CLIP_R], f[CLIP_G], f[CLIP_B]); - } -#else - if (TYPE & SETUP_RGBA) { - f[RCOORD] = f[CLIP_R]; - } -#endif - if (TYPE & SETUP_TMU1) { - f[S1COORD] = f[CLIP_S1] * oow; - f[T1COORD] = f[CLIP_T1] * oow; - } - - if (TYPE & SETUP_TMU0) { - f[T0COORD] = f[CLIP_T0] * oow; - f[S0COORD] = f[CLIP_S0] * oow; - } - - DO_SETUP_XYZ; - - f[OOWCOORD] = oow; - } -} - -static void TAG(fx_project_clipped_vertices) (GLfloat * first, - GLfloat * last, - const GLfloat * mat, - GLuint stride, - const GLubyte * mask) -{ - GLfloat *f; - VARS_XYZ; - - for (f = first; f != last; STRIDE_F(f, stride), mask++) { - if (!*mask) { - - GLfloat oow = 1.0f / f[CLIP_WCOORD]; -#if FX_USE_PARGB - if (TYPE & SETUP_RGBA) { - PACK_4F_ARGB(GET_PARGB(f), f[CLIP_A], f[CLIP_R], f[CLIP_G], f[CLIP_B]); - } -#else - if (TYPE & SETUP_RGBA) { - f[RCOORD] = f[CLIP_R]; - } -#endif - - if (TYPE & SETUP_TMU1) { - f[S1COORD] = f[CLIP_S1] * oow; - f[T1COORD] = f[CLIP_T1] * oow; - } - - if (TYPE & SETUP_TMU0) { - f[T0COORD] = f[CLIP_T0] * oow; - f[S0COORD] = f[CLIP_S0] * oow; - } - - DO_SETUP_XYZ; - - f[OOWCOORD] = oow; - } - } -} - - -static -#if (SIZE <= 8) - INLINE -#endif -void TAG(fx_tri_clip) (GLuint ** p_elts, - fxVertex * verts, - GLubyte * clipmask, GLuint * p_next_vert, GLubyte mask) -{ - GLuint *elts = *p_elts; - GLuint next_vert = *p_next_vert; - GLuint vlist1[VB_MAX_CLIPPED_VERTS]; - GLuint vlist2[VB_MAX_CLIPPED_VERTS]; - GLuint *inlist[2]; - GLuint *out; - GLuint in = 0; - GLuint n = 3; - GLuint i; - - inlist[0] = elts; - inlist[1] = vlist2; - - CLIP(-, 0, CLIP_RIGHT_BIT); - CLIP(+, 0, CLIP_LEFT_BIT); - CLIP(-, 1, CLIP_TOP_BIT); - CLIP(+, 1, CLIP_BOTTOM_BIT); - CLIP(-, 2, CLIP_FAR_BIT); - CLIP(+, 2, CLIP_NEAR_BIT); - - /* Convert the planar polygon to a list of triangles. - */ - out = inlist[in]; - - for (i = 2; i < n; i++) { - elts[0] = out[0]; - elts[1] = out[i - 1]; - elts[2] = out[i]; - elts += 3; - } - - *p_next_vert = next_vert; - *p_elts = elts; -} - - -static INLINE void TAG(fx_line_clip) (GLuint ** p_elts, - fxVertex * verts, - GLubyte * clipmask, - GLuint * p_next_vert, GLubyte mask) -{ - GLuint *elts = *p_elts; - GLfloat *I = verts[elts[0]].f; - GLfloat *J = verts[elts[1]].f; - GLuint next_vert = *p_next_vert; - - LINE_CLIP(1, 0, 0, -1, CLIP_LEFT_BIT); - LINE_CLIP(-1, 0, 0, 1, CLIP_RIGHT_BIT); - LINE_CLIP(0, 1, 0, -1, CLIP_TOP_BIT); - LINE_CLIP(0, -1, 0, 1, CLIP_BOTTOM_BIT); - LINE_CLIP(0, 0, 1, -1, CLIP_FAR_BIT); - LINE_CLIP(0, 0, -1, 1, CLIP_NEAR_BIT); - - *p_next_vert = next_vert; - *p_elts += 2; -} - - -/* Build a table of functions to clip each primitive type. - */ -#define LOCAL_VARS \ - GLuint *elt = VB->EltPtr->data; \ - fxVertex *verts = FX_DRIVER_DATA(VB)->verts; \ - GLuint next_vert = VB->Count; \ - GLuint *out = FX_DRIVER_DATA(VB)->clipped_elements.data; \ - GLubyte *mask = VB->ClipMask; \ - - -#define POSTFIX \ - FX_DRIVER_DATA(VB)->clipped_elements.count = \ - out - FX_DRIVER_DATA(VB)->clipped_elements.data; \ - FX_DRIVER_DATA(VB)->last_vert = &verts[next_vert]; - -#define INIT(x) - -#define RENDER_POINTS(start, count) \ -do { \ - GLuint i; \ - for (i = start ; i < count ; i++ ) \ - CLIP_POINT( elt[i] ); \ -} while (0) - -#define RENDER_LINE(i1, i0) \ - CLIP_LINE(elt[i1], elt[i0]) - -#define RENDER_TRI(i2, i1, i0, pv, parroty) \ -do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ - if (parroty) e2 = elt[i1], e1 = elt[i2]; \ - CLIP_TRIANGLE( e2, e1, e0 ); \ -} while (0) - -#define RENDER_QUAD(i3, i2, i1, i0, pv) \ - CLIP_TRIANGLE(elt[i3], elt[i2], elt[i0]); \ - CLIP_TRIANGLE(elt[i2], elt[i1], elt[i0]) - -#define PRESERVE_TAG -#include "render_tmp.h" - - -static void TAG(fx_init_fastpath) (struct fx_fast_tab * tab) -{ - GLuint i; - - /* Use the render templates to do clipping. - */ - TAG(render_init) (); - for (i = 0; i < GL_POLYGON + 2; i++) - tab->clip[i] = TAG(render_tab)[i]; - - tab->build_vertices = TAG(fx_setup_full); - tab->project_vertices = TAG(fx_project_vertices); - tab->project_clipped_vertices = TAG(fx_project_clipped_vertices); - -#if 0 && defined(USE_3DNOW_ASM) - if (gl_x86_cpu_features & X86_FEATURE_3DNOW) { - extern void TAG(fx_3dnow_project_vertices) (GLfloat * first, - GLfloat * last, - const GLfloat * mat, - GLuint stride); - - extern void TAG(fx_3dnow_project_clipped_vertices) (GLfloat * first, - GLfloat * last, - const GLfloat * - mat, - GLuint stride, - const GLubyte * - mask); - - tab->project_vertices = TAG(fx_3dnow_project_vertices); - tab->project_clipped_vertices = - TAG(fx_3dnow_project_clipped_vertices); - } -#endif -} - -#undef TYPE -#undef TAG -#undef SIZE diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c b/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c deleted file mode 100644 index 4f54a741d..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c +++ /dev/null @@ -1,430 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include <stdlib.h> -#include <string.h> -#include "glide.h" -#include "fxdrv.h" -#include "fxglidew.h" - - -grStencilFunc_t grStencilFuncPtr = NULL; -grStencilMask_t grStencilMaskPtr = NULL; -grStencilOp_t grStencilOpPtr = NULL; -grBufferClearExt_t grBufferClearExtPtr = NULL; -grColorMaskExt_t grColorMaskExtPtr = NULL; -txImgQuantize_t txImgQuantizePtr = NULL; -txImgDeQuantize_t txImgDequantizeFXT1Ptr = NULL; -txErrorSetCallback_t txErrorSetCallbackPtr = NULL; -grColorCombineExt_t grColorCombineExtPtr = NULL; -grTexColorCombineExt_t grTexColorCombineExtPtr = NULL; -grAlphaCombineExt_t grAlphaCombineExtPtr = NULL; -grTexAlphaCombineExt_t grTexAlphaCombineExtPtr = NULL; -grAlphaBlendFunctionExt_t grAlphaBlendFunctionExtPtr = NULL; -grConstantColorValueExt_t grConstantColorValueExtPtr = NULL; - - -FxI32 -FX_grGetInteger_NoLock(FxU32 pname) -{ - switch (pname) { - case FX_FOG_TABLE_ENTRIES: - case FX_GLIDE_STATE_SIZE: - case FX_LFB_PIXEL_PIPE: - case FX_PENDING_BUFFERSWAPS: - case FX_TEXTURE_ALIGN: - case GR_STATS_PIXELS_DEPTHFUNC_FAIL: - case GR_STATS_PIXELS_IN: - case GR_STATS_PIXELS_OUT: - { - FxI32 result; - FxU32 grname = pname; - grGet(grname, 4, &result); - return result; - } - case FX_ZDEPTH_MAX: - { - FxI32 zvals[2]; - grGet(GR_ZDEPTH_MIN_MAX, 8, zvals); - return zvals[0]; - } - default: - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n"); - } - } - - return 0; -} - - -FxI32 -FX_grGetInteger(fxMesaContext fxMesa, FxU32 pname) -{ - int result; - BEGIN_BOARD_LOCK(fxMesa); - result = FX_grGetInteger_NoLock(pname); - END_BOARD_LOCK(fxMesa); - return result; -} - - -const char * -FX_grGetString(fxMesaContext fxMesa, FxU32 pname) -{ - const char *s; - BEGIN_BOARD_LOCK(fxMesa); - s = grGetString(pname); - END_BOARD_LOCK(fxMesa); - return s; -} - - - -/* Wrapper for grColorMask() and grColorMaskExt(). - */ -void -FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g, - GLboolean b, GLboolean a) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - BEGIN_BOARD_LOCK(fxMesa); - if (ctx->Visual->RedBits == 8) { - /* 32bpp mode */ - ASSERT(grColorMaskExtPtr); - (*grColorMaskExtPtr)(r, g, b, a); - } - else { - /* 16 bpp mode */ - /* we never have an alpha buffer */ - grColorMask(r || g || b, GL_FALSE); - } - END_BOARD_LOCK(fxMesa); -} - - -void -FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g, - GLboolean b, GLboolean a) -{ - if (ctx->Visual->RedBits == 8) { - /* 32bpp mode */ - ASSERT(grColorMaskExtPtr); - (*grColorMaskExtPtr)(r, g, b, a); - } - else { - /* 16 bpp mode */ - /* we never have an alpha buffer */ - grColorMask(r || g || b, GL_FALSE); - } -} - - -/* As above, but pass the mask as an array - */ -void -FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - BEGIN_BOARD_LOCK(fxMesa); - if (ctx->Visual->RedBits == 8) { - /* 32bpp mode */ - ASSERT(grColorMaskExtPtr); - (*grColorMaskExtPtr)(rgba[RCOMP], rgba[GCOMP], - rgba[BCOMP], rgba[ACOMP]); - } - else { - /* 16 bpp mode */ - /* we never have an alpha buffer */ - grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); - } - END_BOARD_LOCK(fxMesa); -} - -void -FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]) -{ - if (ctx->Visual->RedBits == 8) { - /* 32bpp mode */ - ASSERT(grColorMaskExtPtr); - (*grColorMaskExtPtr)(rgba[RCOMP], rgba[GCOMP], - rgba[BCOMP], rgba[ACOMP]); - } - else { - /* 16 bpp mode */ - /* we never have an alpha buffer */ - grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); - } -} - - -FxBool -FX_grLfbLock(fxMesaContext fxMesa, GrLock_t type, GrBuffer_t buffer, - GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, - FxBool pixelPipeline, GrLfbInfo_t * info) -{ - FxBool result; - - BEGIN_BOARD_LOCK(fxMesa); - result = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info); - END_BOARD_LOCK(fxMesa); - return result; -} - -FxU32 -FX_grTexTextureMemRequired(fxMesaContext fxMesa, FxU32 evenOdd, GrTexInfo * info) -{ - FxU32 result; - - BEGIN_BOARD_LOCK(fxMesa); - result = grTexTextureMemRequired(evenOdd, info); - END_BOARD_LOCK(fxMesa); - return result; -} - -FxU32 -FX_grTexMinAddress(fxMesaContext fxMesa, GrChipID_t tmu) -{ - FxU32 result; - - BEGIN_BOARD_LOCK(fxMesa); - result = grTexMinAddress(tmu); - END_BOARD_LOCK(fxMesa); - return result; -} - -extern FxU32 -FX_grTexMaxAddress(fxMesaContext fxMesa, GrChipID_t tmu) -{ - FxU32 result; - - BEGIN_BOARD_LOCK(fxMesa); - result = grTexMaxAddress(tmu); - END_BOARD_LOCK(fxMesa); - return result; -} - - -int -FX_getFogTableSize(fxMesaContext fxMesa) -{ - int result; - BEGIN_BOARD_LOCK(fxMesa); - grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result); - END_BOARD_LOCK(fxMesa); - return result; -} - -int -FX_getGrStateSize(fxMesaContext fxMesa) -{ - int result; - BEGIN_BOARD_LOCK(fxMesa); - grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result); - END_BOARD_LOCK(fxMesa); - return result; -} - -void -FX_grGlideGetVersion(fxMesaContext fxMesa, char *buf) -{ - BEGIN_BOARD_LOCK(fxMesa); - strcpy(buf, grGetString(GR_VERSION)); - END_BOARD_LOCK(fxMesa); -} - -void -FX_grSstPerfStats(GrSstPerfStats_t * st) -{ - FxI32 n; - grGet(GR_STATS_PIXELS_IN, 4, &n); - st->pixelsIn = n; - grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); - st->chromaFail = n; - grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); - st->zFuncFail = n; - grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n); - st->aFuncFail = n; - grGet(GR_STATS_PIXELS_OUT, 4, &n); - st->pixelsOut = n; -} - -void -FX_grAADrawLine(fxMesaContext fxMesa, GrVertex * a, GrVertex * b) -{ - /* ToDo */ - BEGIN_CLIP_LOOP(fxMesa); - grDrawLine(a, b); - END_CLIP_LOOP(fxMesa); -} - -void -FX_grAADrawPoint(fxMesaContext fxMesa, GrVertex * a) -{ - BEGIN_CLIP_LOOP(fxMesa); - grDrawPoint(a); - END_CLIP_LOOP(fxMesa); -} - -void -FX_grDrawPolygonVertexList(fxMesaContext fxMesa, int n, GrVertex * verts) -{ - BEGIN_CLIP_LOOP(fxMesa); - grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); - END_CLIP_LOOP(fxMesa); -} - -#if FX_USE_PARGB -void -FX_setupGrVertexLayout(fxMesaContext fxMesa) -{ - BEGIN_BOARD_LOCK(fxMesa); - grReset(GR_VERTEX_PARAMETER); - - grCoordinateSpace(GR_WINDOW_COORDS); - grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - END_BOARD_LOCK(fxMesa); -} -#else /* FX_USE_PARGB */ -void -FX_setupGrVertexLayout(fxMesaContext fxMesa) -{ - BEGIN_BOARD_LOCK(fxMesa); - grReset(GR_VERTEX_PARAMETER); - - grCoordinateSpace(GR_WINDOW_COORDS); - grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - END_BOARD_LOCK(fxMesa); -} -#endif /* FX_USE_PARGB */ - -void -FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask) -{ - switch (hintType) { - case GR_HINT_STWHINT: - { - if (hintMask & GR_STWHINT_W_DIFF_TMU0) - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, - GR_PARAM_ENABLE); - else - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, - GR_PARAM_DISABLE); - - if (hintMask & GR_STWHINT_ST_DIFF_TMU1) - grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, - GR_PARAM_ENABLE); - else - grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, - GR_PARAM_DISABLE); - - if (hintMask & GR_STWHINT_W_DIFF_TMU1) - grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, - GR_PARAM_ENABLE); - else - grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, - GR_PARAM_DISABLE); - - } - } -} - -void -FX_grHints(fxMesaContext fxMesa, GrHint_t hintType, FxU32 hintMask) -{ - BEGIN_BOARD_LOCK(fxMesa); - FX_grHints_NoLock(hintType, hintMask); - END_BOARD_LOCK(fxMesa); -} - -/* It appears to me that this function is needed either way. */ -FX_GrContext_t -FX_grSstWinOpen(fxMesaContext fxMesa, - FxU32 hWnd, - GrScreenResolution_t screen_resolution, - GrScreenRefresh_t refresh_rate, - GrColorFormat_t color_format, - GrOriginLocation_t origin_location, - int nColBuffers, int nAuxBuffers) -{ - FX_GrContext_t i; - BEGIN_BOARD_LOCK(fxMesa); - i = grSstWinOpen(hWnd, - screen_resolution, - refresh_rate, - color_format, origin_location, nColBuffers, nAuxBuffers); - - /* - fprintf(stderr, - "grSstWinOpen( win %d res %d ref %d fmt %d\n" - " org %d ncol %d naux %d )\n" - " ==> %d\n", - hWnd, - screen_resolution, - refresh_rate, - color_format, - origin_location, - nColBuffers, - nAuxBuffers, - i); - */ - END_BOARD_LOCK(fxMesa); - return i; -} - diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c b/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c deleted file mode 100644 index eaa2ab962..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c +++ /dev/null @@ -1,293 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c,v 1.1 2000/09/24 13:51:16 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include "fxdrv.h" -#include "fxcva.h" -#include "fxpipeline.h" -#include "vbindirect.h" - - -/* We don't handle texcoord-4 in the safe clip routines - maybe we should. - */ -static void -fxDDRenderElements(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (fxMesa->render_index != 0 || - ((ctx->Texture.ReallyEnabled & 0xf) && VB->TexCoordPtr[0]->size > 2) - || ((ctx->Texture.ReallyEnabled & 0xf0) - && VB->TexCoordPtr[1]->size > 2) || (VB->ClipPtr->size != 4)) /* Brokes clipping otherwise */ - gl_render_elts(VB); - else - fxDDRenderElementsDirect(VB); -} - -static void -fxDDCheckRenderVBIndirect(GLcontext * ctx, struct gl_pipeline_stage *d) -{ - d->type = 0; - - if ((ctx->IndirectTriangles & DD_SW_SETUP) == 0 && - ctx->Driver.MultipassFunc == 0) { - d->type = PIPE_IMMEDIATE; - d->inputs = VERT_SETUP_FULL | VERT_ELT | VERT_PRECALC_DATA; - } -} - -static void -fxDDRenderVBIndirect(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - struct vertex_buffer *cvaVB = ctx->CVA.VB; - - if (fxMesa->render_index != 0 || ((ctx->Texture.ReallyEnabled & 0xf) - && cvaVB->TexCoordPtr[0]->size > 2) - || ((ctx->Texture.ReallyEnabled & 0xf0) - && cvaVB->TexCoordPtr[1]->size > 2) || (VB->ClipPtr->size != 4)) /* Brokes clipping otherwise */ - gl_render_vb_indirect(VB); - else - fxDDRenderVBIndirectDirect(VB); -} - - -static void -fxDDRenderVB(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if ((fxMesa->render_index != 0) || - ((ctx->Texture.ReallyEnabled & 0xf) && VB->TexCoordPtr[0]->size > 2) - || ((ctx->Texture.ReallyEnabled & 0xf0) - && VB->TexCoordPtr[1]->size > 2)) - gl_render_vb(VB); - else - fxDDDoRenderVB(VB); -} - - - - -/* This sort of driver-based reconfiguration of the pipeline could be - * used to support accelerated transformation and lighting on capable - * hardware. - * - */ -GLuint -fxDDRegisterPipelineStages(struct gl_pipeline_stage *out, - const struct gl_pipeline_stage *in, GLuint nr) -{ - GLuint i, o; - - for (i = o = 0; i < nr; i++) { - switch (in[i].ops) { - case PIPE_OP_RAST_SETUP_1 | PIPE_OP_RENDER: - out[o] = in[i]; - out[o].state_change = NEW_CLIENT_STATE; - out[o].check = fxDDCheckMergeAndRender; - out[o].run = fxDDMergeAndRender; - o++; - break; - case PIPE_OP_RAST_SETUP_0: - out[o] = in[i]; - out[o].cva_state_change = - NEW_LIGHTING | NEW_TEXTURING | NEW_RASTER_OPS; - out[o].state_change = ~0; - out[o].check = fxDDCheckPartialRasterSetup; - out[o].run = fxDDPartialRasterSetup; - o++; - break; - case PIPE_OP_RAST_SETUP_0 | PIPE_OP_RAST_SETUP_1: - out[o] = in[i]; - out[o].run = fxDDDoRasterSetup; - o++; - break; - case PIPE_OP_RENDER: - out[o] = in[i]; - if (in[i].run == gl_render_elts) { - out[o].run = fxDDRenderElements; - } - else if (in[i].run == gl_render_vb_indirect) { - out[o].check = fxDDCheckRenderVBIndirect; - out[o].run = fxDDRenderVBIndirect; - } - else if (in[i].run == gl_render_vb) { - out[o].run = fxDDRenderVB; - } - - o++; - break; - default: - out[o++] = in[i]; - break; - } - } - - return o; -} - -#define ILLEGAL_ENABLES (TEXTURE0_3D| \ - TEXTURE1_3D| \ - ENABLE_TEXMAT0 | \ - ENABLE_TEXMAT1 | \ - ENABLE_TEXGEN0 | \ - ENABLE_TEXGEN1 | \ - ENABLE_USERCLIP | \ - ENABLE_LIGHT | \ - ENABLE_FOG) - - - -/* Because this is slotted in by the OptimizePipeline function, most - * of the information here is just for gl_print_pipeline(). Only the - * run member is required. - */ -static struct gl_pipeline_stage fx_fast_stage = { - "FX combined vertex transform, setup and rasterization stage", - PIPE_OP_VERT_XFORM | PIPE_OP_RAST_SETUP_0 | PIPE_OP_RAST_SETUP_1 | - PIPE_OP_RENDER, - PIPE_PRECALC, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, /* never called */ - fxDDFastPath -}; - - - - -/* Better than optimizing the pipeline, we can do the whole build very - * quickly with the aid of a new flags member. - */ -GLboolean -fxDDBuildPrecalcPipeline(GLcontext * ctx) -{ - struct gl_pipeline *pipe = &ctx->CVA.pre; - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - - if (fxMesa->is_in_hardware && - fxMesa->render_index == 0 && - (ctx->Enabled & ILLEGAL_ENABLES) == 0 && - (ctx->Array.Flags & (VERT_OBJ_234 | - VERT_TEX0_4 | - VERT_TEX1_4 | - VERT_ELT)) == (VERT_OBJ_23 | VERT_ELT)) { - if (MESA_VERBOSE & (VERBOSE_STATE | VERBOSE_DRIVER)) - if (!fxMesa->using_fast_path) - fprintf(stderr, "fxMesa: using fast path\n"); - - pipe->stages[0] = &fx_fast_stage; - pipe->stages[1] = 0; - pipe->new_inputs = ctx->RenderFlags & VERT_DATA; - pipe->ops = pipe->stages[0]->ops; - fxMesa->using_fast_path = 1; - return 1; - } - - if (fxMesa->using_fast_path) { - if (MESA_VERBOSE & (VERBOSE_STATE | VERBOSE_DRIVER)) - fprintf(stderr, - "fxMesa: fall back to full pipeline %x %x %x %x %x\n", - fxMesa->is_in_hardware, fxMesa->render_index, - (ctx->Enabled & ILLEGAL_ENABLES), - (ctx->Array.Summary & (VERT_OBJ_23)), - (ctx->Array.Summary & (VERT_OBJ_4 | VERT_TEX0_4 | - VERT_TEX1_4))); - - fxMesa->using_fast_path = 0; - ctx->CVA.VB->ClipOrMask = 0; - ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS; - ctx->Array.NewArrayState |= ctx->Array.Summary; - return 0; - } - - return 0; -} - - - - - - -/* Perform global optimizations to the pipeline. The fx driver - * implements a single such fast path, which corresponds to the standard - * quake3 cva pipeline. - * - * This is now handled by the 'build' function above. - */ -void -fxDDOptimizePrecalcPipeline(GLcontext * ctx, struct gl_pipeline *pipe) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - if (fxMesa->is_in_hardware && - fxMesa->render_index == 0 && - (ctx->Enabled & ILLEGAL_ENABLES) == 0 && - (ctx->Array.Summary & VERT_ELT)) { - pipe->stages[0] = &fx_fast_stage; - pipe->stages[1] = 0; - } -} - - - -/* unused? -void -fxDDOptimizeEltPipeline( GLcontext *ctx, struct gl_pipeline *pipe ) -{ - (void) ctx; - (void) pipe; -} -*/ - diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h b/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h deleted file mode 100644 index 49a98320d..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h +++ /dev/null @@ -1,16 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h,v 1.1 2000/09/24 13:51:16 alanh Exp $ */ -#ifndef FXPIPELINE_H -#define FXPIPELINE_H - - -extern GLuint fxDDRegisterPipelineStages(struct gl_pipeline_stage *out, - const struct gl_pipeline_stage *in, - GLuint nr); - -extern GLboolean fxDDBuildPrecalcPipeline(GLcontext * ctx); - -extern void fxDDOptimizePrecalcPipeline(GLcontext * ctx, - struct gl_pipeline *pipe); - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxrender.c b/xc/lib/GL/mesa/src/drv/tdfx/fxrender.c deleted file mode 100644 index 2ec5fa4b3..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxrender.c +++ /dev/null @@ -1,780 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxrender.c,v 1.2 2000/11/13 23:31:32 dawes Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxrender.c - 3Dfx VooDoo RenderVB driver function support */ - -#include "fxdrv.h" -#include "vbcull.h" -#include "fxsetup.h" - - - -/* - * Render a line segment from VB[v1] to VB[v2] when either one or both - * endpoints must be clipped. - */ -#if !defined(__MWERKS__) -INLINE -#endif - void -fxRenderClippedLine(struct vertex_buffer *VB, GLuint v1, GLuint v2) -{ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLubyte mask = VB->ClipMask[v1] | VB->ClipMask[v2]; - - if (!mask || (VB->ctx->line_clip_tab[VB->ClipPtr->size]) (VB, &v1, &v2, - mask)) - FX_grDrawLine(fxMesa, (GrVertex *) gWin[v1].f, (GrVertex *) gWin[v2].f); -} - - - - -/* This is legal for Quads as well as triangles, hence the 'n' parameter. - */ -INLINE void -fxRenderClippedTriangle(struct vertex_buffer *VB, GLuint n, GLuint vlist[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - GLubyte mask = 0; - GLuint i; - - for (i = 0; i < n; i++) - mask |= VB->ClipMask[vlist[i]]; - - if (mask & CLIP_USER_BIT) { - GLubyte *userclipmask = VB->UserClipMask; - if (userclipmask[vlist[0]] & userclipmask[vlist[1]] & - userclipmask[vlist[2]]) - return; - } - - n = (VB->ctx->poly_clip_tab[VB->ClipPtr->size]) (VB, n, vlist, mask); - if (n >= 3) { - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GrVertex *i0 = (GrVertex *) gWin[vlist[0]].f; - GrVertex *i1 = (GrVertex *) gWin[vlist[1]].f; - GrVertex *i2 = (GrVertex *) gWin[vlist[2]].f; - GLuint i; - - for (i = 2; i < n; i++, i1 = i2, i2 = (GrVertex *) gWin[vlist[i]].f) { - FX_grDrawTriangle(fxMesa, i0, i1, i2); - } - } -} - - - - - -static INLINE void -fxSafeClippedLine(struct vertex_buffer *VB, GLuint v1, GLuint v2) -{ - GLubyte mask = VB->ClipMask[v1] | VB->ClipMask[v2]; - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - - if (!mask) { - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - FX_grDrawLine(fxMesa, (GrVertex *) gWin[v1].f, (GrVertex *) gWin[v2].f); - } - else { - fxMesaContext fxMesa = (fxMesaContext) VB->ctx->DriverCtx; - fxLineClipTab[fxMesa->setupindex & 0x7] (VB, v1, v2, mask); - } -} - - -static INLINE void -fxSafeClippedTriangle(struct vertex_buffer *VB, - fxVertex * gWin, - tfxTriClipFunc cliptri, GLuint v2, GLuint v1, GLuint v) -{ - GLubyte *clipmask = VB->ClipMask; - GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v]; - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - - if (!mask) { - FX_grDrawTriangle(fxMesa, (GrVertex *) gWin[v2].f, - (GrVertex *) gWin[v1].f, (GrVertex *) gWin[v].f); - return; - } - - if (!(clipmask[v2] & clipmask[v1] & clipmask[v] & CLIP_ALL_BITS)) { - GLuint vl[3]; - GLuint imask = mask; - - if (imask & CLIP_USER_BIT) { - GLubyte *userclipmask = VB->UserClipMask; - if (userclipmask[v2] & userclipmask[v1] & userclipmask[v]) - return; - imask |= - (userclipmask[v2] | userclipmask[v1] | userclipmask[v]) << 8; - } - - ASSIGN_3V(vl, v2, v1, v); - cliptri(VB, vl, imask); - } -} - - -static INLINE void -fxSafeClippedTriangle2(struct vertex_buffer *VB, - fxVertex * gWin, - tfxTriViewClipFunc cliptri, - GLuint v2, GLuint v1, GLuint v) -{ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - GLubyte *clipmask = VB->ClipMask; - GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v]; - - if (!mask) { - FX_grDrawTriangle(fxMesa, - (GrVertex *) gWin[v2].f, (GrVertex *) gWin[v1].f, - (GrVertex *) gWin[v].f); - } - else if (!(clipmask[v2] & clipmask[v1] & clipmask[v])) { - GLuint vl[3]; - ASSIGN_3V(vl, v2, v1, v); - cliptri(VB, vl, mask); - } -} - - -static INLINE void -fxSafeClippedTriangle3(struct vertex_buffer *VB, - fxVertex * gWin, - tfxTriClipFunc cliptri, GLuint v2, GLuint v1, GLuint v) -{ - GLubyte *clipmask = VB->ClipMask; - GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v]; - GLuint imask = mask; - - if (imask & CLIP_USER_BIT) { - GLubyte *userclipmask = VB->UserClipMask; - if (userclipmask[v2] & userclipmask[v1] & userclipmask[v]) - return; - imask |= (userclipmask[v2] | userclipmask[v1] | userclipmask[v]) << 8; - } - - { - GLuint vl[3]; - ASSIGN_3V(vl, v2, v1, v); - cliptri(VB, vl, imask); - } -} - - - - - -/************************************************************************/ -/************************ RenderVB functions ****************************/ -/************************************************************************/ - - -/* Render front-facing, non-clipped primitives. - */ - -#define RENDER_POINTS( start, count ) \ - (void) gWin; \ - (void) VB; \ - (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count ) - -#define RENDER_LINE( i1, i ) \ - do { \ - RVB_COLOR(i); \ - FX_grDrawLine(fxMesa, (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity ) \ - do { \ - RVB_COLOR(pv); \ - if (parity) { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i].f); \ - } else { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv ) \ - do { \ - RVB_COLOR(pv); \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i3].f, \ - (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i].f); \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } while (0) - - - -#define LOCAL_VARS \ - fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - (void) fxMesa; - -#define INIT(x) - -#define TAG(x) x##_fx_flat_raw -#undef RVB_COLOR -#define RVB_COLOR(pv) FX_VB_COLOR(fxMesa, VB->ColorPtr->data[pv]) -#define PRESERVE_VB_DEFS - -#include "render_tmp.h" - -#define TAG(x) x##_fx_smooth_raw -#undef RVB_COLOR -#define RVB_COLOR(x) - -#include "render_tmp.h" - - - -/* Render with clipped and/or culled primitives with cullmask information. - */ -#define RENDER_POINTS( start, count ) \ - (void) gWin; \ - (void) cullmask; \ - (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count ) - - -#define RENDER_LINE( i1, i ) \ - do { \ - const GLubyte flags = cullmask[i]; \ - \ - if (!(flags & PRIM_NOT_CULLED)) \ - continue; \ - \ - RVB_COLOR(i); \ - if (flags & PRIM_ANY_CLIP) \ - fxRenderClippedLine( VB, i1, i ); \ - else \ - FX_grDrawLine( fxMesa, (GrVertex *)gWin[i1].f, (GrVertex *)gWin[i].f ); \ - } while (0) - - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - const GLubyte flags = cullmask[i]; \ - GLuint e2,e1; \ - \ - if (!(flags & PRIM_NOT_CULLED)) \ - continue; \ - \ - e2=i2, e1=i1; \ - if (parity) { e2=i1; e1=i2; } \ - \ - RVB_COLOR(pv); \ - if (flags & PRIM_ANY_CLIP) { \ - fxSafeClippedTriangle3(VB,gWin,cliptri,e2,e1,i); \ - } else { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e1].f, \ - (GrVertex *)gWin[i].f); \ - } \ - } while (0) - - -#define RENDER_QUAD(i3, i2, i1, i, pv) \ - do { \ - const GLubyte flags = cullmask[i]; \ - \ - if (!(flags & PRIM_NOT_CULLED)) \ - continue; \ - \ - RVB_COLOR(pv); \ - if (flags&PRIM_ANY_CLIP) { \ - fxSafeClippedTriangle3(VB,gWin,cliptri,i3,i2,i); \ - fxSafeClippedTriangle3(VB,gWin,cliptri,i2,i1,i); \ - } else { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i3].f, \ - (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i].f); \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } \ - } while (0) - - - - - -#define LOCAL_VARS \ - fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - const GLubyte *cullmask = VB->CullMask; \ - tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - - - - -#define INIT(x) (void) cliptri; (void) fxMesa; - -#define TAG(x) x##_fx_smooth_culled -#undef RVB_COLOR -#define RVB_COLOR(x) -#define PRESERVE_VB_DEFS -#include "render_tmp.h" - -#define TAG(x) x##_fx_flat_culled -#undef RVB_COLOR -#define RVB_COLOR(pv) FX_VB_COLOR(fxMesa, VB->ColorPtr->data[pv]) - -#include "render_tmp.h" - - - - -/* Direct, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - GLubyte *clipmask = VB->ClipMask; \ - GLuint i; \ - for (i = start ; i < count ; i++) \ - if (clipmask[i] == 0) { \ - RVB_COLOR(i); \ - FX_grDrawPoint( fxMesa, (GrVertex *)gWin[i].f );\ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - RVB_COLOR(i); \ - fxSafeClippedLine( VB, i1, i ); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2=i2, e1=i1; \ - if (parity) { GLuint t=e2; e2=e1; e1=t; } \ - RVB_COLOR(pv); \ - fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,i); \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - RVB_COLOR(pv); \ - fxSafeClippedTriangle(VB,gWin,cliptri,i3,i2,i); \ - fxSafeClippedTriangle(VB,gWin,cliptri,i2,i1,i); \ - } while (0) - -#define LOCAL_VARS \ - fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define INIT(x) (void) cliptri; (void) gWin; - -#define TAG(x) x##_fx_smooth_clipped -#undef RVB_COLOR -#define RVB_COLOR(x) -#define PRESERVE_VB_DEFS -#include "render_tmp.h" - - -#define TAG(x) x##_fx_flat_clipped -#undef RVB_COLOR -#define RVB_COLOR(pv) FX_VB_COLOR(fxMesa, VB->ColorPtr->data[pv]) -#include "render_tmp.h" - - - - - - -/* Indirect, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - GLuint e; \ - GLubyte *clipmask = VB->ClipMask; \ - for(e=start;e<count;e++) \ - if(clipmask[elt[e]]==0) { \ - FX_grDrawPoint(fxMesa, (GrVertex *)gWin[elt[e]].f); \ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - GLuint e1 = elt[i1], e = elt[i]; \ - RVB_COLOR(e); \ - fxSafeClippedLine( VB, e1, e ); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - if (parity) { GLuint t=e2; e2=e1; e1=t; } \ - fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ - fxSafeClippedTriangle(VB,gWin,cliptri,e3,e2,e); \ - fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \ - fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define INIT(x) (void) cliptri; (void) gWin; - -#define TAG(x) x##_fx_smooth_indirect_clipped -#undef RVB_COLOR -#define RVB_COLOR(x) -#include "render_tmp.h" - - -/* Indirect, clipped, but no user clip. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - GLuint e; \ - GLubyte *clipmask = VB->ClipMask; \ - for(e=start;e<count;e++) \ - if(clipmask[elt[e]]==0) { \ - FX_grDrawPoint(fxMesa, (GrVertex *)gWin[elt[e]].f); \ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - GLuint e1 = elt[i1], e = elt[i]; \ - RVB_COLOR(e); \ - fxSafeClippedLine( VB, e1, e ); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - if (parity) { GLuint t=e2; e2=e1; e1=t; } \ - fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ - fxSafeClippedTriangle2(VB,gWin,cliptri,e3,e2,e); \ - fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \ - fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - tfxTriViewClipFunc cliptri = fxMesa->view_clip_tri; - -#define INIT(x) (void) cliptri; (void) gWin; - -#define TAG(x) x##_fx_smooth_indirect_view_clipped -#undef RVB_COLOR -#define RVB_COLOR(x) -#include "render_tmp.h" - - - - - - - -/* Indirect, and no clipping required. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - GLuint e; \ - for(e=start;e<count;e++) { \ - FX_grDrawPoint_NoLock((GrVertex *)gWin[elt[e]].f);\ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - GLuint e1 = elt[i1], e = elt[i]; \ - FX_grDrawLine_NoLock((GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f);\ - } while (0) - - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \ - FX_grDrawTriangle_NoLock((GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e1].f, \ - (GrVertex *)gWin[e].f); \ - } while (0) - - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ - FX_grDrawTriangle_NoLock((GrVertex *)gWin[e3].f, \ - (GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e].f); \ - FX_grDrawTriangle_NoLock((GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e1].f, \ - (GrVertex *)gWin[e].f); \ - } while (0) - -#define LOCAL_VARS \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - const GLuint *elt = VB->EltPtr->data; \ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - -#define INIT(x) BEGIN_CLIP_LOOP(fxMesa); -#define POSTFIX END_CLIP_LOOP(fxMesa); - -#define TAG(x) x##_fx_smooth_indirect -#undef RVB_COLOR -#define RVB_COLOR(x) -#include "render_tmp.h" - - - - - -/* Direct in this context means that triangles, lines, points can be - * rendered simply by calling grDrawTriangle, etc., without any - * additional setup (such as calling grConstantColor). We also use a - * 'safe' set of clipping routines which don't require write-access to - * the arrays in the vertex buffer, and don't care about array - * stride. - * - * Thus there is no call to gl_import_arrays() in this function. - * - * This safe clipping should be generalized to call driver->trianglefunc - * under the appropriate conditions. - * - * We don't handle texcoord-4 in the safe clip routines - maybe we should. - * - */ -void -fxDDRenderElementsDirect(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - struct vertex_buffer *saved_vb = ctx->VB; - GLenum prim = ctx->CVA.elt_mode; - GLuint nr = VB->EltPtr->count; - render_func func = render_tab_fx_smooth_indirect[prim]; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint p = 0; - - if (!nr) - return; - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - if (!nr) - return; - - if (VB->ClipOrMask) { - func = render_tab_fx_smooth_indirect_view_clipped[prim]; - if (VB->ClipOrMask & CLIP_USER_BIT) - func = render_tab_fx_smooth_indirect_clipped[prim]; - } - - ctx->VB = VB; /* kludge */ - - do { - func(VB, 0, nr, 0); - } while (ctx->Driver.MultipassFunc && ctx->Driver.MultipassFunc(VB, ++p)); - - - ctx->VB = saved_vb; -} - - -void -fxDDRenderVBIndirectDirect(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - struct vertex_buffer *cvaVB = ctx->CVA.VB; - struct vertex_buffer *saved_vb = ctx->VB; - GLuint i, next, count = VB->Count; - render_func *tab = render_tab_fx_smooth_indirect; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint p = 0; - - if (cvaVB->ClipOrMask) - tab = render_tab_fx_smooth_indirect_clipped; - - if (!VB->CullDone) - gl_fast_copy_vb(VB); - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - ctx->VB = cvaVB; - cvaVB->EltPtr = VB->EltPtr; - - do { - GLuint parity = VB->Parity; - - for (i = VB->CopyStart; i < count; parity = 0, i = next) { - GLuint prim = VB->Primitive[i]; - next = VB->NextPrimitive[i]; - tab[prim] (cvaVB, i, next, parity); - } - /* loop never taken */ - } while (ctx->Driver.MultipassFunc && - ctx->Driver.MultipassFunc(cvaVB, ++p)); - - cvaVB->EltPtr = 0; - ctx->VB = saved_vb; -} - - -static render_func *fxDDRenderVBSmooth_tables[3] = { - render_tab_fx_smooth_clipped, - render_tab_fx_smooth_culled, - render_tab_fx_smooth_raw -}; - -static render_func *fxDDRenderVBFlat_tables[3] = { - render_tab_fx_flat_clipped, - render_tab_fx_flat_culled, - render_tab_fx_flat_raw -}; - - -static render_func *null_tables[3] = { - 0, - 0, - 0 -}; - -#if defined(FX_GLIDE3) -#include "fxstripdet.c" -#endif - -void -fxDDRenderInit(GLcontext * ctx) -{ - render_init_fx_smooth_indirect_view_clipped(); - render_init_fx_smooth_indirect_clipped(); - render_init_fx_smooth_indirect(); - render_init_fx_smooth_raw(); - render_init_fx_smooth_culled(); - render_init_fx_smooth_clipped(); - render_init_fx_flat_raw(); - render_init_fx_flat_culled(); - render_init_fx_flat_clipped(); -#if defined(FX_GLIDE3) - fxDDRenderInitGlide3(ctx); -#endif -} - - -/* Now used to set an internal var in fxMesa - we hook out at the - * level of gl_render_vb() instead. - */ -render_func ** -fxDDChooseRenderVBTables(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (ctx->IndirectTriangles & DD_SW_SETUP) - return null_tables; - - switch (fxMesa->render_index) { -/* case FX_FLAT: */ -/* return fxDDRenderVBFlat_tables; */ - case 0: - return fxDDRenderVBSmooth_tables; - default: - return null_tables; - } -} - - -void -fxDDDoRenderVB(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint i, next, prim; - GLuint parity = VB->Parity; - render_func *tab; - GLuint count = VB->Count; - GLint p = 0; - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - if (VB->Indirect) { - return; - } - else if (VB->CullMode & CLIP_MASK_ACTIVE) { - tab = fxMesa->RenderVBClippedTab; - } - else { - tab = fxMesa->RenderVBRawTab; - } - - if (!VB->CullDone) - gl_fast_copy_vb(VB); - - do { - for (i = VB->CopyStart; i < count; parity = 0, i = next) { - prim = VB->Primitive[i]; - next = VB->NextPrimitive[i]; - tab[prim] (VB, i, next, parity); - } - - } while (ctx->Driver.MultipassFunc && ctx->Driver.MultipassFunc(VB, ++p)); -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c b/xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c deleted file mode 100644 index 634bb50ed..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include "fxdrv.h" - -/* I have found this quite useful in tracking down transformation & - * clipping bugs. If you get a random graphics card freeze, running - * your triangles through this will probably catch the problem. - */ - -#define WID 640 -#define HI 480 - -#undef grDrawTriangle - -void -fx_sanity_triangle(fxMesaContext fxMesa, - GrVertex * v1, GrVertex * v2, GrVertex * v3) -{ - GLuint rv = 1, print = 0; - - GLfloat area = ((v1->x - v3->x) * (v2->y - v3->y) - - (v1->y - v3->y) * (v2->x - v3->x)); - - if (v1->x < 0 || v1->y < 0 || v1->x > WID || v1->y > HI || - v2->x < 0 || v2->y < 0 || v2->x > WID || v2->y > HI || - v3->x < 0 || v3->y < 0 || v3->x > WID || v3->y > HI) { - fprintf(stderr, "not clipped/set up!!!!!\n"); - rv = 0; - print = 1; - } - - if (area > (WID * HI)) { - fprintf(stderr, "too big\n"); - rv = 0; - } - if (v1->oow == 0 || v2->oow == 0 || v3->oow == 0) { - fprintf(stderr, "zero oow\n"); - rv = 0; - } - if (0 && area == 0) { - fprintf(stderr, "zero area %p %p %p\n", v1, v2, v3); - rv = 0; - } - - if (print) { -#if FX_USE_PARGB - fprintf(stderr, - "v1: %f %f %f %f col %d %d %d %d t0 %f %f %f t1 %f %f %f\n", - v3->x, v3->y, v3->ooz, v3->oow, GET_PR(v1), GET_PG(v1), GET_PB(v1), GET_PA(v1), - v1->tmuvtx[0].sow, v1->tmuvtx[0].tow, v1->tmuvtx[0].oow, - v1->tmuvtx[1].sow, v1->tmuvtx[1].tow, v1->tmuvtx[1].oow); - fprintf(stderr, - "v2: %f %f %f %f col %d %d %d %d t0 %f %f %f t1 %f %f %f\n", - v3->x, v3->y, v3->ooz, v3->oow, GET_PR(v1), GET_PG(v1), GET_PB(v1), GET_PA(v1), - v2->tmuvtx[0].sow, v2->tmuvtx[0].tow, v2->tmuvtx[0].oow, - v2->tmuvtx[1].sow, v2->tmuvtx[1].tow, v2->tmuvtx[1].oow); - fprintf(stderr, - "v3: %f %f %f %f col %d %d %d %d t0 %f %f %f t1 %f %f %f\n", - v3->x, v3->y, v3->ooz, v3->oow, GET_PR(v1), GET_PG(v1), GET_PB(v1), GET_PA(v1), - v3->tmuvtx[0].sow, v3->tmuvtx[0].tow, v3->tmuvtx[0].oow, - v3->tmuvtx[1].sow, v3->tmuvtx[1].tow, v3->tmuvtx[1].oow); -#else - fprintf(stderr, - "v1: %f %f %f %f col %.0f %.0f %.0f %.0f t0 %f %f %f t1 %f %f %f\n", - v1->x, v1->y, v1->ooz, v1->oow, v1->r, v1->g, v1->b, v1->a, - v1->tmuvtx[0].sow, v1->tmuvtx[0].tow, v1->tmuvtx[0].oow, - v1->tmuvtx[1].sow, v1->tmuvtx[1].tow, v1->tmuvtx[1].oow); - fprintf(stderr, - "v2: %f %f %f %f col %.0f %.0f %.0f %.0f t0 %f %f %f t1 %f %f %f\n", - v2->x, v2->y, v2->ooz, v2->oow, v2->r, v2->g, v2->b, v2->a, - v2->tmuvtx[0].sow, v2->tmuvtx[0].tow, v2->tmuvtx[0].oow, - v2->tmuvtx[1].sow, v2->tmuvtx[1].tow, v2->tmuvtx[1].oow); - fprintf(stderr, - "v3: %f %f %f %f col %.0f %.0f %.0f %.0f t0 %f %f %f t1 %f %f %f\n", - v3->x, v3->y, v3->ooz, v3->oow, v3->r, v3->g, v3->b, v3->a, - v3->tmuvtx[0].sow, v3->tmuvtx[0].tow, v3->tmuvtx[0].oow, - v3->tmuvtx[1].sow, v3->tmuvtx[1].tow, v3->tmuvtx[1].oow); -#endif - } - - if (1) - FX_grDrawTriangle(fxMesa, v1, v2, v3); - else - fprintf(stderr, "\n\n\n"); -} - diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h deleted file mode 100644 index 95794538c..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h +++ /dev/null @@ -1,154 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h,v 1.1 2000/09/24 13:51:19 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* - * Notes: the folowing code works only if count is > start. - * Corrently we are looking for the pattern: - * v0,v1,v2 v2,v1,v3, v2,v3,v4.... - * - * For this: - * #define STRIP0 ((u1 == v1) && (u2 == v0)) - * #define STRIP1 ((u0 == v0) && (u2 == v1)) - * - */ - - -static void TAG(render_vb_triangles_smooth_indirect_sd) - (struct vertex_buffer * VB, GLuint start, GLuint count, GLuint parity) -{ - GLint u0, u1, u2; - GLint v0, v1, v2; - GLuint *elt = VB->EltPtr->data; - - int i; - LOCAL_VARS INIT(GL_TRIANGLES); - - elt = &elt[start - 1]; - u0 = *(++elt); - u1 = *(++elt); - u2 = *(++elt); - i = start + 3; - while (i < count) { - v0 = *(++elt); - v1 = *(++elt); - v2 = *(++elt); - - if (CLIPPED(u0, u1, u2)) { - if (!CULLED(u0, u1, u2)) - SENDCLIPTRI(u0, u1, u2); - } - else { - if (STRIP0(u, v)) { - int is_strips = 1; - int parity = 0; - STRIPSLOCAL_VAR FLUSHTRI(); - STARTSTRIPS(u0, u1, u2); - while (is_strips && i < count) { - SENDSTRIPS(v2); - - u0 = v0; - u1 = v1; - u2 = v2; - i += 3; - v0 = *(++elt); - v1 = *(++elt); - v2 = *(++elt); - - if (parity) { - is_strips = STRIP0(u, v); - parity = 0; - } - else { - is_strips = STRIP1(u, v); - parity = 1; - } - } - FLUSHSTRIPS(); - - if (i >= count) - return; - } - else { - SENDTRI(u0, u1, u2); - } - } - u0 = v0; - u1 = v1; - u2 = v2; - i += 3; - } - if (CLIPPED(u0, u1, u2)) { - if (!CULLED(u0, u1, u2)) - SENDCLIPTRI(u0, u1, u2); - } - else { - SENDTRI(u0, u1, u2); - } - FLUSHTRI(); - -} - -#ifndef PRESERVE_VB_DEFS -#undef SENDTRI -#undef STRIP0 -#undef STRIP1 -#undef LOCAL_VARS -#undef STRIPSLOCAL_VAR -#undef INIT -#undef SENDTRI -#undef FLUSHTRI -#undef STARTSTRIPS -#undef SENDSTRIPS -#undef FLUSHSTRIPS -#undef CLIPPED -#undef CULLED -#undef SENDCLIPTRI -#endif - -#ifndef PRESERVE_TAG -#undef TAG -#endif - -#undef PRESERVE_VB_DEFS -#undef PRESERVE_TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c b/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c deleted file mode 100644 index 4dbba6667..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c +++ /dev/null @@ -1,2886 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */ - -#include "fxdrv.h" -#include "fxddtex.h" -#include "fxtexman.h" -#include "fxsetup.h" -#include "enums.h" - - -static GLboolean fxMultipassTexture(struct vertex_buffer *, GLuint); - - - -void -fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - GLint minl, maxl; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxTexValidate(...) Start\n"); - } - - if (ti->validated) { - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, - "fxmesa: fxTexValidate(...) End (validated=GL_TRUE)\n"); - } - return; - } - - ti->tObj = tObj; - minl = ti->minLevel = tObj->BaseLevel; - maxl = ti->maxLevel = MIN2(tObj->MaxLevel, tObj->Image[0]->MaxLog2); - - fxTexGetInfo(ctx, tObj->Image[minl]->Width, tObj->Image[minl]->Height, - &(FX_largeLodLog2(ti->info)), - &(FX_aspectRatioLog2(ti->info)), &(ti->sScale), - &(ti->tScale), &(ti->int_sScale), &(ti->int_tScale), NULL, - NULL); - - if ((tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) - fxTexGetInfo(ctx, tObj->Image[maxl]->Width, tObj->Image[maxl]->Height, - &(FX_smallLodLog2(ti->info)), NULL, - NULL, NULL, NULL, NULL, NULL, NULL); - else - FX_smallLodLog2(ti->info) = FX_largeLodLog2(ti->info); - - fxTexGetFormat(tObj->Image[minl]->IntFormat, &(ti->info.format), - &(ti->baseLevelInternalFormat), NULL, NULL, - fxMesa->isNapalm); - - switch (tObj->WrapS) { - case GL_CLAMP_TO_EDGE: - case GL_CLAMP: - ti->sClamp = 1; - break; - case GL_REPEAT: - ti->sClamp = 0; - break; - default: - ; /* silence compiler warning */ - } - switch (tObj->WrapT) { - case GL_CLAMP_TO_EDGE: - case GL_CLAMP: - ti->tClamp = 1; - break; - case GL_REPEAT: - ti->tClamp = 0; - break; - default: - ; /* silence compiler warning */ - } - - ti->validated = GL_TRUE; - - ti->info.data = NULL; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxTexValidate(...) End\n"); - } -} - -static void -fxPrintUnitsMode(const char *msg, GLuint mode) -{ - fprintf(stderr, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", - msg, - mode, - (mode & FX_UM_E0_REPLACE) ? "E0_REPLACE, " : "", - (mode & FX_UM_E0_MODULATE) ? "E0_MODULATE, " : "", - (mode & FX_UM_E0_DECAL) ? "E0_DECAL, " : "", - (mode & FX_UM_E0_BLEND) ? "E0_BLEND, " : "", - (mode & FX_UM_E1_REPLACE) ? "E1_REPLACE, " : "", - (mode & FX_UM_E1_MODULATE) ? "E1_MODULATE, " : "", - (mode & FX_UM_E1_DECAL) ? "E1_DECAL, " : "", - (mode & FX_UM_E1_BLEND) ? "E1_BLEND, " : "", - (mode & FX_UM_E0_ALPHA) ? "E0_ALPHA, " : "", - (mode & FX_UM_E0_LUMINANCE) ? "E0_LUMINANCE, " : "", - (mode & FX_UM_E0_LUMINANCE_ALPHA) ? "E0_LUMINANCE_ALPHA, " : "", - (mode & FX_UM_E0_INTENSITY) ? "E0_INTENSITY, " : "", - (mode & FX_UM_E0_RGB) ? "E0_RGB, " : "", - (mode & FX_UM_E0_RGBA) ? "E0_RGBA, " : "", - (mode & FX_UM_E1_ALPHA) ? "E1_ALPHA, " : "", - (mode & FX_UM_E1_LUMINANCE) ? "E1_LUMINANCE, " : "", - (mode & FX_UM_E1_LUMINANCE_ALPHA) ? "E1_LUMINANCE_ALPHA, " : "", - (mode & FX_UM_E1_INTENSITY) ? "E1_INTENSITY, " : "", - (mode & FX_UM_E1_RGB) ? "E1_RGB, " : "", - (mode & FX_UM_E1_RGBA) ? "E1_RGBA, " : "", - (mode & FX_UM_COLOR_ITERATED) ? "COLOR_ITERATED, " : "", - (mode & FX_UM_COLOR_CONSTANT) ? "COLOR_CONSTANT, " : "", - (mode & FX_UM_ALPHA_ITERATED) ? "ALPHA_ITERATED, " : "", - (mode & FX_UM_ALPHA_CONSTANT) ? "ALPHA_CONSTANT, " : ""); -} - -static GLuint -fxGetTexSetConfiguration(GLcontext * ctx, - struct gl_texture_object *tObj0, - struct gl_texture_object *tObj1) -{ - GLuint unitsmode = 0; - GLuint envmode = 0; - GLuint ifmt = 0; - - if ((ctx->Light.ShadeModel == GL_SMOOTH) || 1 || - (ctx->Point.SmoothFlag) || - (ctx->Line.SmoothFlag) || - (ctx->Polygon.SmoothFlag)) - unitsmode |= FX_UM_ALPHA_ITERATED; - else - unitsmode |= FX_UM_ALPHA_CONSTANT; - - if (ctx->Light.ShadeModel == GL_SMOOTH || 1) - unitsmode |= FX_UM_COLOR_ITERATED; - else - unitsmode |= FX_UM_COLOR_CONSTANT; - - - - /* - OpenGL Feeds Texture 0 into Texture 1 - Glide Feeds Texture 1 into Texture 0 - */ - if (tObj0) { - tfxTexInfo *ti0 = fxTMGetTexInfo(tObj0); - - switch (ti0->baseLevelInternalFormat) { - case GL_ALPHA: - ifmt |= FX_UM_E0_ALPHA; - break; - case GL_LUMINANCE: - ifmt |= FX_UM_E0_LUMINANCE; - break; - case GL_LUMINANCE_ALPHA: - ifmt |= FX_UM_E0_LUMINANCE_ALPHA; - break; - case GL_INTENSITY: - ifmt |= FX_UM_E0_INTENSITY; - break; - case GL_RGB: - ifmt |= FX_UM_E0_RGB; - break; - case GL_RGBA: - ifmt |= FX_UM_E0_RGBA; - break; - } - - switch (ctx->Texture.Unit[0].EnvMode) { - case GL_DECAL: - envmode |= FX_UM_E0_DECAL; - break; - case GL_MODULATE: - envmode |= FX_UM_E0_MODULATE; - break; - case GL_REPLACE: - envmode |= FX_UM_E0_REPLACE; - break; - case GL_BLEND: - envmode |= FX_UM_E0_BLEND; - break; - case GL_ADD: - envmode |= FX_UM_E0_ADD; - break; - default: - /* do nothing */ - break; - } - } - - if (tObj1) { - tfxTexInfo *ti1 = fxTMGetTexInfo(tObj1); - - switch (ti1->baseLevelInternalFormat) { - case GL_ALPHA: - ifmt |= FX_UM_E1_ALPHA; - break; - case GL_LUMINANCE: - ifmt |= FX_UM_E1_LUMINANCE; - break; - case GL_LUMINANCE_ALPHA: - ifmt |= FX_UM_E1_LUMINANCE_ALPHA; - break; - case GL_INTENSITY: - ifmt |= FX_UM_E1_INTENSITY; - break; - case GL_RGB: - ifmt |= FX_UM_E1_RGB; - break; - case GL_RGBA: - ifmt |= FX_UM_E1_RGBA; - break; - default: - /* do nothing */ - break; - } - - switch (ctx->Texture.Unit[1].EnvMode) { - case GL_DECAL: - envmode |= FX_UM_E1_DECAL; - break; - case GL_MODULATE: - envmode |= FX_UM_E1_MODULATE; - break; - case GL_REPLACE: - envmode |= FX_UM_E1_REPLACE; - break; - case GL_BLEND: - envmode |= FX_UM_E1_BLEND; - break; - case GL_ADD: - envmode |= FX_UM_E1_ADD; - break; - default: - /* do nothing */ - break; - } - } - - unitsmode |= (ifmt | envmode); - - if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) - fxPrintUnitsMode("unitsmode", unitsmode); - - return unitsmode; -} - -/************************************************************************/ -/************************* Rendering Mode SetUp *************************/ -/************************************************************************/ - -/************************* Single Texture Set ***************************/ - -static void -fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj) -{ - struct TdfxSharedState *shared = (struct TdfxSharedState *) fxMesa->glCtx->Shared->DriverData; - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - const GLcontext *ctx = fxMesa->glCtx; - - /* Make sure we're not loaded incorrectly */ - if (ti->isInTM && !shared->umaTexMemory) { - /* if doing filtering between mipmap levels, alternate mipmap levels - * must be in alternate TMUs. - */ - if (ti->LODblend) { - if (ti->whichTMU != FX_TMU_SPLIT) - fxTMMoveOutTM(fxMesa, tObj); - } - else { - if (ti->whichTMU == FX_TMU_SPLIT) - fxTMMoveOutTM(fxMesa, tObj); - } - } - - /* Make sure we're loaded correctly */ - if (!ti->isInTM) { - /* Have to download the texture */ - if (shared->umaTexMemory) { - fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0); - } - else { - /* Voodoo3 (split texture memory) */ - if (ti->LODblend) { - fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU_SPLIT); - } - else { - if (fxMesa->haveTwoTMUs) { - GLint memReq = FX_grTexTextureMemRequired_NoLock( - GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); - if (shared->freeTexMem[FX_TMU0] > memReq) { - fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0); - } - else { - fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU1); - } - } - else - fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0); - } - } - } - - if (ti->LODblend && ti->whichTMU == FX_TMU_SPLIT) { - /* mipmap levels split between texture banks */ - if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: uploading texture palette\n"); - } - FX_grTexDownloadTable_NoLock(GR_TMU0, GR_TEXTABLE_PALETTE_6666_EXT, - &(ti->palette)); - FX_grTexDownloadTable_NoLock(GR_TMU1, GR_TEXTABLE_PALETTE_6666_EXT, - &(ti->palette)); - } - - FX_grTexClampMode_NoLock(GR_TMU0, ti->sClamp, ti->tClamp); - FX_grTexClampMode_NoLock(GR_TMU1, ti->sClamp, ti->tClamp); - FX_grTexFilterMode_NoLock(GR_TMU0, ti->minFilt, ti->maxFilt); - FX_grTexFilterMode_NoLock(GR_TMU1, ti->minFilt, ti->maxFilt); - FX_grTexMipMapMode_NoLock(GR_TMU0, ti->mmMode, ti->LODblend); - FX_grTexMipMapMode_NoLock(GR_TMU1, ti->mmMode, ti->LODblend); - - FX_grTexSource_NoLock(GR_TMU0, ti->tm[FX_TMU0]->startAddr, - GR_MIPMAPLEVELMASK_ODD, &(ti->info)); - FX_grTexSource_NoLock(GR_TMU1, ti->tm[FX_TMU1]->startAddr, - GR_MIPMAPLEVELMASK_EVEN, &(ti->info)); - } - else { - FxU32 tmu; - - if (ti->whichTMU == FX_TMU_BOTH) - tmu = FX_TMU0; - else - tmu = ti->whichTMU; - - if (shared->umaTexMemory) { - assert(ti->whichTMU == FX_TMU0); - assert(tmu == FX_TMU0); - } - - if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: uploading texture palette\n"); - } - FX_grTexDownloadTable_NoLock(tmu, GR_TEXTABLE_PALETTE_6666_EXT, - &(ti->palette)); - } - - /* KW: The alternative is to do the download to the other tmu. If - * we get to this point, I think it means we are thrashing the - * texture memory, so perhaps it's not a good idea. - */ - if (ti->LODblend && (MESA_VERBOSE & VERBOSE_DRIVER)) - fprintf(stderr, - "fxmesa: not blending texture - only on one tmu\n"); - - FX_grTexClampMode_NoLock(tmu, ti->sClamp, ti->tClamp); - FX_grTexFilterMode_NoLock(tmu, ti->minFilt, ti->maxFilt); - FX_grTexMipMapMode_NoLock(tmu, ti->mmMode, FXFALSE); - - if (ti->tm[tmu]) { - FX_grTexSource_NoLock(tmu, ti->tm[tmu]->startAddr, - GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); - } - } -} - -static void -fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend) -{ - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSelectSingleTMUSrc(%d,%d)\n", tmu, - LODblend); - } - - if (LODblend) { - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, - FXFALSE, FXFALSE); - - if (fxMesa->haveTwoTMUs) { - const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - const struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; - int tmu; - - if (shared->umaTexMemory) - tmu = GR_TMU0; - else - tmu = GR_TMU1; - - FX_grTexCombine_NoLock(tmu, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - } - fxMesa->tmuSrc = FX_TMU_SPLIT; - } - else { - if (tmu != FX_TMU1) { - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - if (fxMesa->haveTwoTMUs) { - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, FXFALSE, - FXFALSE); - } - fxMesa->tmuSrc = FX_TMU0; - } - else { - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */ - - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE); - - fxMesa->tmuSrc = FX_TMU1; - } - } -} - - -/* - * Setup the texture env mode for a texture unit on Banshee/Voodoo3 - */ -static void -SetupTexEnvVoodoo3(GLcontext *ctx, FxU32 unit, GLboolean iteratedRGBA, - GLenum envMode, GLenum baseFormat) -{ - GrCombineLocal_t localc, locala; - if (iteratedRGBA) - localc = locala = GR_COMBINE_LOCAL_ITERATED; - else - localc = locala = GR_COMBINE_LOCAL_CONSTANT; - - switch (envMode) { - case GL_DECAL: - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_TEXTURE_ALPHA, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - break; - case GL_MODULATE: - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - - if (baseFormat == GL_ALPHA) - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); - else - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - localc, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - break; - case GL_BLEND: -#if 0 - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - if (baseFormat == GL_ALPHA) - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); - else - FX_grColorCombine_NoLock - (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_LOCAL, localc, GR_COMBINE_OTHER_TEXTURE, - FXTRUE); - ctx->Driver.MultipassFunc = fxMultipassBlend; -#else - if (MESA_VERBOSE & VERBOSE_DRIVER) - fprintf(stderr, "fx Driver: GL_BLEND not yet supported\n"); -#endif - break; - case GL_REPLACE: - if ((baseFormat == GL_RGB) || (baseFormat == GL_LUMINANCE)) - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - else - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - locala, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - - if (baseFormat == GL_ALPHA) - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); - else - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - localc, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - break; - case GL_ADD: - if (baseFormat == GL_ALPHA || - baseFormat == GL_LUMINANCE_ALPHA || - baseFormat == GL_RGBA) { - /* product of texel and fragment alpha */ - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - } - else if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { - /* fragment alpha is unchanged */ - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - } - else { - ASSERT(baseFormat == GL_INTENSITY); - /* sum of texel and fragment alpha */ - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, - locala, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - } - if (baseFormat == GL_ALPHA) { - /* rgb unchanged */ - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); - } - else { - /* sum of texel and fragment rgb */ - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, - localc, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - } - break; - default: - gl_problem(ctx, "Bad baseFormat in SetupTexEnvVoodoo3"); - } -} - - -/* - * These macros are used below when handling COMBINE_EXT. - */ -#define TEXENV_OPERAND_INVERTED(operand) \ - (((operand) == GL_ONE_MINUS_SRC_ALPHA) \ - || ((operand) == GL_ONE_MINUS_SRC_COLOR)) -#define TEXENV_OPERAND_ALPHA(operand) \ - (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA)) -#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \ - switch (source) { \ - case GL_TEXTURE: \ - param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ - break; \ - case GL_CONSTANT_EXT: \ - param = GR_CMBX_TMU_CALPHA; \ - break; \ - case GL_PRIMARY_COLOR_EXT: \ - param = GR_CMBX_ITALPHA; \ - break; \ - case GL_PREVIOUS_EXT: \ - param = iteratedAlpha; \ - break; \ - default: \ - /* \ - * This is here just to keep from getting \ - * compiler warnings. \ - */ \ - param = GR_CMBX_ZERO; \ - break; \ - } - -#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \ - if (!TEXENV_OPERAND_ALPHA(operand)) { \ - switch (source) { \ - case GL_TEXTURE: \ - param = GR_CMBX_LOCAL_TEXTURE_RGB; \ - break; \ - case GL_CONSTANT_EXT: \ - param = GR_CMBX_TMU_CCOLOR; \ - break; \ - case GL_PRIMARY_COLOR_EXT: \ - param = GR_CMBX_ITRGB; \ - break; \ - case GL_PREVIOUS_EXT: \ - param = iteratedColor; \ - break; \ - default: \ - /* \ - * This is here just to keep from getting \ - * compiler warnings. \ - */ \ - param = GR_CMBX_ZERO; \ - break; \ - } \ - } else { \ - switch (source) { \ - case GL_TEXTURE: \ - param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ - break; \ - case GL_CONSTANT_EXT: \ - param = GR_CMBX_TMU_CALPHA; \ - break; \ - case GL_PRIMARY_COLOR_EXT: \ - param = GR_CMBX_ITALPHA; \ - break; \ - case GL_PREVIOUS_EXT: \ - param = iteratedAlpha; \ - break; \ - default: \ - /* \ - * This is here just to keep from getting \ - * compiler warnings. \ - */ \ - param = GR_CMBX_ZERO; \ - break; \ - } \ - } - -#define TEXENV_SETUP_MODE_RGB(param, operand) \ - switch (operand) { \ - case GL_SRC_COLOR: \ - case GL_SRC_ALPHA: \ - param = GR_FUNC_MODE_X; \ - break; \ - case GL_ONE_MINUS_SRC_ALPHA: \ - case GL_ONE_MINUS_SRC_COLOR: \ - param = GR_FUNC_MODE_ONE_MINUS_X; \ - break; \ - default: \ - param = GR_FUNC_MODE_ZERO; \ - break; \ - } - -#define TEXENV_SETUP_MODE_A(param, operand) \ - switch (operand) { \ - case GL_SRC_ALPHA: \ - param = GR_FUNC_MODE_X; \ - break; \ - case GL_ONE_MINUS_SRC_ALPHA: \ - param = GR_FUNC_MODE_ONE_MINUS_X; \ - break; \ - default: \ - param = GR_FUNC_MODE_ZERO; \ - break; \ - } - -/* - * Setup the texture env mode for a texture unit on Napalm. - * If useIteratedRGBA is true, we'll feed the interpolated fragment - * color into the combiner, else we'll feed in the upstream texture - * unit's resultant color. - */ -static void -SetupTexEnvNapalm(GLcontext *ctx, FxU32 unit, GLboolean useIteratedRGBA, - struct gl_texture_unit *texUnit, GLenum baseFormat) -{ - GrTCCUColor_t incomingRGB, incomingAlpha; - GLenum envMode = texUnit->EnvMode; - - if (useIteratedRGBA) { - incomingRGB = GR_CMBX_ITRGB; - incomingAlpha = GR_CMBX_ITALPHA; - } - else { - incomingRGB = GR_CMBX_OTHER_TEXTURE_RGB; - incomingAlpha = GR_CMBX_OTHER_TEXTURE_ALPHA; - } - - switch (envMode) { - case GL_REPLACE: - /* Setup RGB combiner */ - if (baseFormat == GL_ALPHA) { - /* Rv = Rf */ - (*grTexColorCombineExtPtr)(unit, - incomingRGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else { - /* Rv = Rt */ - (*grTexColorCombineExtPtr)(unit, - GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_X, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - /* Setup Alpha combiner */ - if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { - /* Av = Af */ - (*grTexAlphaCombineExtPtr)(unit, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXFALSE, - incomingAlpha, FXFALSE, - 0, FXFALSE); - } - else { - /* Av = At */ - (*grTexAlphaCombineExtPtr)(unit, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXFALSE, - GR_CMBX_LOCAL_TEXTURE_ALPHA, FXFALSE, - 0, FXFALSE); - } - break; - case GL_MODULATE: - /* Setup RGB combiner */ - if (baseFormat == GL_ALPHA) { - /* Rv = Rf */ - (*grTexColorCombineExtPtr)(unit, - incomingRGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else { - /* Result = Frag * Tex */ - (*grTexColorCombineExtPtr)(unit, - incomingRGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_ZERO, - GR_CMBX_LOCAL_TEXTURE_RGB, FXFALSE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - /* Setup Alpha combiner */ - if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { - /* Av = Af */ - (*grTexAlphaCombineExtPtr)(unit, - incomingAlpha, GR_FUNC_MODE_X, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else { - /* Av = Af * At */ - (*grTexAlphaCombineExtPtr)(unit, - GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - incomingAlpha, FXFALSE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - break; - case GL_DECAL: - /* Setup RGB combiner */ - if (baseFormat == GL_RGB) { - /* Rv = Rt */ - (*grTexColorCombineExtPtr)(unit, - GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_X, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else { - /* Rv = Rf * (1 - At) + Rt * At */ - (*grTexColorCombineExtPtr)(unit, - GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, - incomingRGB, GR_FUNC_MODE_NEGATIVE_X, - GR_CMBX_LOCAL_TEXTURE_ALPHA, FXFALSE, - GR_CMBX_B, FXFALSE, - 0, FXFALSE); - } - /* Setup Alpha combiner */ - /* Av = Af */ - (*grTexAlphaCombineExtPtr)(unit, - incomingAlpha, GR_FUNC_MODE_X, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - break; - case GL_BLEND: - /* Setup RGB combiner */ - if (baseFormat == GL_ALPHA) { - /* Rv = Rf */ - (*grTexColorCombineExtPtr)(unit, - incomingRGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else { - /* Rv = Rf * (1 - Rt) + Rc * Rt */ - (*grTexColorCombineExtPtr)(unit, - GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X, - incomingRGB, GR_FUNC_MODE_NEGATIVE_X, - GR_CMBX_LOCAL_TEXTURE_RGB, FXFALSE, - GR_CMBX_B, FXFALSE, - 0, FXFALSE); - } - /* Setup Alpha combiner */ - if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { - /* Av = Af */ - (*grTexAlphaCombineExtPtr)(unit, - incomingAlpha, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else if (baseFormat == GL_INTENSITY) { - /* Av = Af * (1 - It) + Ac * It */ - (*grTexAlphaCombineExtPtr)(unit, - GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_X, - incomingAlpha, GR_FUNC_MODE_NEGATIVE_X, - GR_CMBX_LOCAL_TEXTURE_ALPHA, FXFALSE, - GR_CMBX_B, FXFALSE, - 0, FXFALSE); - } - else { - /* Av = Af * At */ - (*grTexAlphaCombineExtPtr)(unit, - GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - incomingAlpha, FXFALSE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - /* Also have to set up the tex env constant color */ - { - GrColor_t constColor; - GLubyte *abgr = (GLubyte *) &constColor; - abgr[0] = ctx->Texture.Unit[0].EnvColor[0] * 255.0F; - abgr[1] = ctx->Texture.Unit[0].EnvColor[1] * 255.0F; - abgr[2] = ctx->Texture.Unit[0].EnvColor[2] * 255.0F; - abgr[3] = ctx->Texture.Unit[0].EnvColor[3] * 255.0F; - (*grConstantColorValueExtPtr)(unit, constColor); - } - break; - case GL_ADD: - /* Setup RGB combiner */ - if (baseFormat == GL_ALPHA) { - /* Rv = Rf */ - (*grTexColorCombineExtPtr)(unit, - incomingRGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else { - /* Rv = Rf + Tt */ - (*grTexColorCombineExtPtr)(unit, - incomingRGB, GR_FUNC_MODE_X, - GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - /* Setup Alpha combiner */ - if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { - /* Av = Af */ - (*grTexAlphaCombineExtPtr)(unit, - incomingAlpha, GR_FUNC_MODE_X, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else if (baseFormat == GL_INTENSITY) { - /* Av = Af + It */ - (*grTexAlphaCombineExtPtr)(unit, - incomingAlpha, GR_FUNC_MODE_X, - GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - else { - /* Av = Af * At */ - (*grTexAlphaCombineExtPtr)(unit, - GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X, - GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO, - incomingAlpha, FXFALSE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - } - break; - case GL_COMBINE_EXT: - { - FxU32 A_RGB, B_RGB, C_RGB, D_RGB; - FxU32 Amode_RGB, Bmode_RGB; - FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB; - FxU32 Shift_RGB; - FxU32 A_A, B_A, C_A, D_A; - FxU32 Amode_A, Bmode_A; - FxBool Cinv_A, Dinv_A, Ginv_A; - FxU32 Shift_A; - /* - * - * In the formulas below, we write: - * o "1(x)" for the identity function applied to x, - * so 1(x) = x. - * o "0(x)" for the constant function 0, so - * 0(x) = 0 for all values of x. - * - * Calculate the color combination. - */ - Shift_RGB = texUnit->CombineScaleShiftRGB; - Shift_A = texUnit->CombineScaleShiftA; - switch (texUnit->CombineModeRGB) { - case GL_REPLACE: - /* - * The formula is: Arg0 - * We implement this by the formula: - * (Arg0 + 0(0))*(1-0) + 0 - */ - TEXENV_SETUP_ARG_RGB(A_RGB, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], - incomingRGB, incomingAlpha); - TEXENV_SETUP_MODE_RGB(Amode_RGB, - texUnit->CombineOperandRGB[0]); - B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; - Bmode_RGB = GR_FUNC_MODE_ZERO; - Cinv_RGB = FXTRUE; - Dinv_RGB = Ginv_RGB = FXFALSE; - break; - case GL_MODULATE: - /* - * The formula is: Arg0 * Arg1 - * - * We implement this by the formula - * (Arg0 + 0(0)) * Arg1 + 0(0) - */ - TEXENV_SETUP_ARG_RGB(A_RGB, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], - incomingRGB, incomingAlpha); - TEXENV_SETUP_MODE_RGB(Amode_RGB, - texUnit->CombineOperandRGB[0]); - B_RGB = GR_CMBX_ZERO; - Bmode_RGB = GR_CMBX_ZERO; - TEXENV_SETUP_ARG_RGB(C_RGB, - texUnit->CombineSourceRGB[1], - texUnit->CombineOperandRGB[1], - incomingRGB, incomingAlpha); - Cinv_RGB = TEXENV_OPERAND_INVERTED - (texUnit->CombineOperandRGB[1]); - D_RGB = GR_CMBX_ZERO; - Dinv_RGB = Ginv_RGB = FXFALSE; - break; - case GL_ADD: - /* - * The formula is Arg0 + Arg1 - */ - TEXENV_SETUP_ARG_RGB(A_RGB, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], - incomingRGB, incomingAlpha); - TEXENV_SETUP_MODE_RGB(Amode_RGB, - texUnit->CombineOperandRGB[0]); - TEXENV_SETUP_ARG_RGB(B_RGB, - texUnit->CombineSourceRGB[1], - texUnit->CombineOperandRGB[1], - incomingRGB, incomingAlpha); - TEXENV_SETUP_MODE_RGB(Bmode_RGB, - texUnit->CombineOperandRGB[1]); - C_RGB = D_RGB = GR_CMBX_ZERO; - Cinv_RGB = FXTRUE; - Dinv_RGB = Ginv_RGB = FXFALSE; - break; - case GL_ADD_SIGNED_EXT: - /* - * The formula is: Arg0 + Arg1 - 0.5. - * We compute this by calculating: - * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} - * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} - * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} - * we cannot implement the formula properly. - */ - TEXENV_SETUP_ARG_RGB(A_RGB, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], - incomingRGB, incomingAlpha); - TEXENV_SETUP_ARG_RGB(B_RGB, - texUnit->CombineSourceRGB[1], - texUnit->CombineOperandRGB[1], - incomingRGB, incomingAlpha); - if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) { - /* - * A is not inverted. So, choose it. - */ - Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF; - if (!TEXENV_OPERAND_INVERTED - (texUnit->CombineOperandRGB[1])) { - Bmode_RGB = GR_FUNC_MODE_X; - } else { - Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; - } - } else { - /* - * A is inverted, so try to subtract 1/2 - * from B. - */ - Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X; - if (!TEXENV_OPERAND_INVERTED - (texUnit->CombineOperandRGB[1])) { - Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF; - } else { - /* - * Both are inverted. This is the case - * we cannot handle properly. We just - * choose to not add the - 1/2. - */ - Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; - } - } - C_RGB = D_RGB = GR_CMBX_ZERO; - Cinv_RGB = FXTRUE; - Dinv_RGB = Ginv_RGB = FXFALSE; - break; - case GL_INTERPOLATE_EXT: - /* - * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). - * We compute this by the formula: - * (Arg0 - Arg1) * Arg2 + Arg1 - * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 - * == Arg0 * Arg2 + Arg1 * (1 - Arg2) - * However, if both Arg1 is ONE_MINUS_X, the HW does - * not support it properly. - */ - TEXENV_SETUP_ARG_RGB(A_RGB, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], - incomingRGB, incomingAlpha); - TEXENV_SETUP_MODE_RGB(Amode_RGB, - texUnit->CombineOperandRGB[0]); - TEXENV_SETUP_ARG_RGB(B_RGB, - texUnit->CombineSourceRGB[1], - texUnit->CombineOperandRGB[1], - incomingRGB, incomingAlpha); - if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) { - Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; - } else { - /* - * This case is wrong. - */ - Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; - } - /* - * The Source/Operand for the C value must - * specify some kind of alpha value. - */ - TEXENV_SETUP_ARG_A(C_RGB, - texUnit->CombineSourceRGB[2], - texUnit->CombineOperandRGB[2], - incomingAlpha); - Cinv_RGB = FXFALSE; - D_RGB = GR_CMBX_B; - Dinv_RGB = Ginv_RGB = FXFALSE; - break; - default: - /* - * This is here mostly to keep from getting - * a compiler warning about these not being set. - * However, this should set all the texture values - * to zero. - */ - A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; - Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X; - Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE; - break; - } - /* - * Calculate the alpha combination. - */ - switch (texUnit->CombineModeA) { - case GL_REPLACE: - /* - * The formula is: Arg0 - * We implement this by the formula: - * (Arg0 + 0(0))*(1-0) + 0 - */ - TEXENV_SETUP_ARG_A(A_A, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], - incomingAlpha); - TEXENV_SETUP_MODE_A(Amode_A, - texUnit->CombineOperandA[0]); - B_A = C_A = D_A = GR_CMBX_ZERO; - Bmode_A = GR_FUNC_MODE_ZERO; - Cinv_A = FXTRUE; - Dinv_A = Ginv_A = FXFALSE; - break; - case GL_MODULATE: - /* - * The formula is: Arg0 * Arg1 - * - * We implement this by the formula - * (Arg0 + 0(0)) * Arg1 + 0(0) - */ - TEXENV_SETUP_ARG_A(A_A, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], - incomingAlpha); - TEXENV_SETUP_MODE_A(Amode_A, - texUnit->CombineOperandA[0]); - B_A = GR_CMBX_ZERO; - Bmode_A = GR_CMBX_ZERO; - TEXENV_SETUP_ARG_A(C_A, - texUnit->CombineSourceA[1], - texUnit->CombineOperandA[1], - incomingAlpha); - Cinv_A = TEXENV_OPERAND_INVERTED - (texUnit->CombineOperandA[1]); - D_A = GR_CMBX_ZERO; - Dinv_A = Ginv_A = FXFALSE; - break; - case GL_ADD: - /* - * The formula is Arg0 + Arg1 - */ - TEXENV_SETUP_ARG_A(A_A, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], - incomingAlpha); - TEXENV_SETUP_MODE_A(Amode_A, - texUnit->CombineOperandA[0]); - TEXENV_SETUP_ARG_A(B_A, - texUnit->CombineSourceA[1], - texUnit->CombineOperandA[1], - incomingAlpha); - TEXENV_SETUP_MODE_A(Bmode_A, - texUnit->CombineOperandA[0]); - C_A = D_A = GR_CMBX_ZERO; - Cinv_A = FXTRUE; - Dinv_A = Ginv_A = FXFALSE; - break; - case GL_ADD_SIGNED_EXT: - /* - * The formula is: Arg0 + Arg1 - 0.5. - * We compute this by calculating: - * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} - * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} - * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} - * we cannot implement the formula properly. - */ - TEXENV_SETUP_ARG_A(A_A, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], - incomingAlpha); - TEXENV_SETUP_ARG_A(B_A, - texUnit->CombineSourceA[1], - texUnit->CombineOperandA[1], - incomingAlpha); - if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) { - /* - * A is not inverted. So, choose it. - */ - Amode_A = GR_FUNC_MODE_X_MINUS_HALF; - if (!TEXENV_OPERAND_INVERTED - (texUnit->CombineOperandA[1])) { - Bmode_A = GR_FUNC_MODE_X; - } else { - Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; - } - } else { - /* - * A is inverted, so try to subtract 1/2 - * from B. - */ - Amode_A = GR_FUNC_MODE_ONE_MINUS_X; - if (!TEXENV_OPERAND_INVERTED - (texUnit->CombineOperandA[1])) { - Bmode_A = GR_FUNC_MODE_X_MINUS_HALF; - } else { - /* - * Both are inverted. This is the case - * we cannot handle properly. We just - * choose to not add the - 1/2. - */ - Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; - } - } - C_A = D_A = GR_CMBX_ZERO; - Cinv_A = FXTRUE; - Dinv_A = Ginv_A = FXFALSE; - break; - case GL_INTERPOLATE_EXT: - /* - * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). - * We compute this by the formula: - * (Arg0 - Arg1) * Arg2 + Arg1 - * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 - * == Arg0 * Arg2 + Arg1 * (1 - Arg2) - * However, if both Arg1 is ONE_MINUS_X, the HW does - * not support it properly. - */ - TEXENV_SETUP_ARG_A(A_A, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], - incomingAlpha); - TEXENV_SETUP_MODE_A(Amode_A, - texUnit->CombineOperandA[0]); - TEXENV_SETUP_ARG_A(B_A, - texUnit->CombineSourceA[1], - texUnit->CombineOperandA[1], - incomingAlpha); - if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) { - Bmode_A = GR_FUNC_MODE_NEGATIVE_X; - } else { - /* - * This case is wrong. - */ - Bmode_A = GR_FUNC_MODE_NEGATIVE_X; - } - /* - * The Source/Operand for the C value must - * specify some kind of alpha value. - */ - TEXENV_SETUP_ARG_A(C_A, - texUnit->CombineSourceA[2], - texUnit->CombineOperandA[2], - incomingAlpha); - Cinv_A = FXFALSE; - D_A = GR_CMBX_ZERO; - Dinv_A = Ginv_A = FXFALSE; - break; - default: - /* - * This is here mostly to keep from getting - * a compiler warning about these not being set. - * However, this should set all the alpha values - * to one. - */ - A_A = B_A = C_A = D_A = GR_CMBX_ZERO; - Amode_A = Bmode_A = GR_FUNC_MODE_X; - Cinv_A = Dinv_A = FXFALSE; - Ginv_A = FXTRUE; - break; - } - /* - * Call the functions. - */ - (*grTexColorCombineExtPtr)(unit, - A_RGB, Amode_RGB, - B_RGB, Bmode_RGB, - C_RGB, Cinv_RGB, - D_RGB, Dinv_RGB, - Shift_RGB, Ginv_RGB); - (*grTexAlphaCombineExtPtr)(unit, - A_A, Amode_A, - B_A, Bmode_A, - C_A, Cinv_A, - D_A, Dinv_A, - Shift_A, Ginv_A); - } - break; - default: - gl_problem(ctx, "Bad baseFormat in SetupTexEnvNapalm"); - } - - /* setup Color and Alpha combine always the same */ - (*grColorCombineExtPtr)(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_X, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); - (*grAlphaCombineExtPtr)(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X, - GR_CMBX_ZERO, GR_FUNC_MODE_X, - GR_CMBX_ZERO, FXTRUE, - GR_CMBX_ZERO, FXFALSE, - 0, FXFALSE); -} - - -static void -fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint unitsmode; - GLint ifmt; - tfxTexInfo *ti; - struct gl_texture_object *tObj = - ctx->Texture.Unit[textureset].CurrentD[2]; - int tmu; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) Start\n"); - } - - ti = fxTMGetTexInfo(tObj); - fxTexValidate(ctx, tObj); - - fxSetupSingleTMU_NoLock(fxMesa, tObj); - - if (ti->whichTMU == FX_TMU_BOTH) - tmu = FX_TMU0; - else - tmu = ti->whichTMU; - - if (fxMesa->tmuSrc != tmu) - fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend); - - fxMesa->stw_hint_state = 0; - FX_grHints_NoLock(GR_HINT_STWHINT, 0); - - ifmt = ti->baseLevelInternalFormat; - - if (/*0*/fxMesa->isNapalm) { - SetupTexEnvNapalm(ctx, tmu, GL_TRUE, - &(ctx->Texture.Unit[textureset]), - ti->baseLevelInternalFormat); - } - else { - GLboolean iteratedRGBA = GL_FALSE; - if (textureset == 0 || !fxMesa->haveTwoTMUs) - unitsmode = fxGetTexSetConfiguration(ctx, tObj, NULL); - else - unitsmode = fxGetTexSetConfiguration(ctx, NULL, tObj); - if ((unitsmode & FX_UM_ALPHA_ITERATED) || - (unitsmode & FX_UM_COLOR_ITERATED)) { - iteratedRGBA = GL_TRUE; - } - SetupTexEnvVoodoo3(ctx, tmu, iteratedRGBA, - ctx->Texture.Unit[textureset].EnvMode, - ti->baseLevelInternalFormat); - } - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) End\n"); - } -} - - -static void -fxSetupTextureSingleTMU(GLcontext * ctx, GLuint textureset) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - BEGIN_BOARD_LOCK(fxMesa); - fxSetupTextureSingleTMU_NoLock(ctx, textureset); - END_BOARD_LOCK(fxMesa); -} - -/************************* Double Texture Set ***************************/ - -static void -fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa, - struct gl_texture_object *tObj0, - struct gl_texture_object *tObj1) -{ -#define T0_NOT_IN_TMU 0x01 -#define T1_NOT_IN_TMU 0x02 -#define T0_IN_TMU0 0x04 -#define T1_IN_TMU0 0x08 -#define T0_IN_TMU1 0x10 -#define T1_IN_TMU1 0x20 - - const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - const struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; - const GLcontext *ctx = fxMesa->glCtx; - tfxTexInfo *ti0 = fxTMGetTexInfo(tObj0); - tfxTexInfo *ti1 = fxTMGetTexInfo(tObj1); - GLuint tstate = 0; - int tmu0 = 0, tmu1 = 1; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupDoubleTMU(...)\n"); - } - - /* We shouldn't need to do this. There is something wrong with - mutlitexturing when the TMUs are swapped. So, we're forcing - them to always be loaded correctly. !!! */ - if (ti0->whichTMU == FX_TMU1) - fxTMMoveOutTM_NoLock(fxMesa, tObj0); - if (ti1->whichTMU == FX_TMU0) - fxTMMoveOutTM_NoLock(fxMesa, tObj1); - - if (ti0->isInTM) { - switch (ti0->whichTMU) { - case FX_TMU0: - tstate |= T0_IN_TMU0; - break; - case FX_TMU1: - tstate |= T0_IN_TMU1; - break; - case FX_TMU_BOTH: - tstate |= T0_IN_TMU0 | T0_IN_TMU1; - break; - case FX_TMU_SPLIT: - tstate |= T0_NOT_IN_TMU; - break; - } - } - else - tstate |= T0_NOT_IN_TMU; - - if (ti1->isInTM) { - switch (ti1->whichTMU) { - case FX_TMU0: - tstate |= T1_IN_TMU0; - break; - case FX_TMU1: - tstate |= T1_IN_TMU1; - break; - case FX_TMU_BOTH: - tstate |= T1_IN_TMU0 | T1_IN_TMU1; - break; - case FX_TMU_SPLIT: - tstate |= T1_NOT_IN_TMU; - break; - } - } - else - tstate |= T1_NOT_IN_TMU; - - ti0->lastTimeUsed = fxMesa->texBindNumber; - ti1->lastTimeUsed = fxMesa->texBindNumber; - - /* Move texture maps into TMUs */ - - if (!(((tstate & T0_IN_TMU0) && (tstate & T1_IN_TMU1)) || - ((tstate & T0_IN_TMU1) && (tstate & T1_IN_TMU0)))) { - if (tObj0 == tObj1) { - if (shared->umaTexMemory) - fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0); - else - fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU_BOTH); - } - else { - /* Find the minimal way to correct the situation */ - if ((tstate & T0_IN_TMU0) || (tstate & T1_IN_TMU1)) { - /* We have one in the standard order, setup the other */ - if (tstate & T0_IN_TMU0) { /* T0 is in TMU0, put T1 in TMU1 */ - if (shared->umaTexMemory) - fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0); - else - fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1); - } - else { - fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0); - } - /* tmu0 and tmu1 are setup */ - } - else if ((tstate & T0_IN_TMU1) || (tstate & T1_IN_TMU0)) { - /* we have one in the reverse order, setup the other */ - if (tstate & T1_IN_TMU0) { /* T1 is in TMU0, put T0 in TMU1 */ - if (shared->umaTexMemory) - fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0); - else - fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU1); - } - else { - fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0); - } - tmu0 = 1; - tmu1 = 0; - } - else { /* Nothing is loaded */ - fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0); - if (shared->umaTexMemory) - fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0); - else - fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1); - /* tmu0 and tmu1 are setup */ - } - } - } - - if (!ctx->Texture.SharedPalette) { - if (ti0->info.format == GR_TEXFMT_P_8) { - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: uploading texture palette TMU0\n"); - } - FX_grTexDownloadTable_NoLock(tmu0, GR_TEXTABLE_PALETTE_6666_EXT, - &(ti0->palette)); - } - - if (ti1->info.format == GR_TEXFMT_P_8) { - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: uploading texture palette TMU1\n"); - } - FX_grTexDownloadTable_NoLock(tmu1, GR_TEXTABLE_PALETTE_6666_EXT, - &(ti1->palette)); - } - } - - FX_grTexSource_NoLock(tmu0, ti0->tm[tmu0]->startAddr, - GR_MIPMAPLEVELMASK_BOTH, &(ti0->info)); - FX_grTexClampMode_NoLock(tmu0, ti0->sClamp, ti0->tClamp); - FX_grTexFilterMode_NoLock(tmu0, ti0->minFilt, ti0->maxFilt); - FX_grTexMipMapMode_NoLock(tmu0, ti0->mmMode, FXFALSE); - - if (shared->umaTexMemory) - FX_grTexSource_NoLock(tmu1, ti1->tm[tmu0]->startAddr, - GR_MIPMAPLEVELMASK_BOTH, &(ti1->info)); - else - FX_grTexSource_NoLock(tmu1, ti1->tm[tmu1]->startAddr, - GR_MIPMAPLEVELMASK_BOTH, &(ti1->info)); - - FX_grTexClampMode_NoLock(tmu1, ti1->sClamp, ti1->tClamp); - FX_grTexFilterMode_NoLock(tmu1, ti1->minFilt, ti1->maxFilt); - FX_grTexMipMapMode_NoLock(tmu1, ti1->mmMode, FXFALSE); - -#undef T0_NOT_IN_TMU -#undef T1_NOT_IN_TMU -#undef T0_IN_TMU0 -#undef T1_IN_TMU0 -#undef T0_IN_TMU1 -#undef T1_IN_TMU1 -} - -static void -fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GrCombineLocal_t localc, locala; - tfxTexInfo *ti0, *ti1; - struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; - struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; - GLuint envmode, ifmt, unitsmode; - int tmu0 = 0, tmu1 = 1; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupTextureDoubleTMU(...) Start\n"); - } - - ti0 = fxTMGetTexInfo(tObj0); - fxTexValidate(ctx, tObj0); - - ti1 = fxTMGetTexInfo(tObj1); - fxTexValidate(ctx, tObj1); - - fxSetupDoubleTMU_NoLock(fxMesa, tObj0, tObj1); - - unitsmode = fxGetTexSetConfiguration(ctx, tObj0, tObj1); - - fxMesa->stw_hint_state |= GR_STWHINT_ST_DIFF_TMU1; - FX_grHints_NoLock(GR_HINT_STWHINT, fxMesa->stw_hint_state); - - envmode = unitsmode & FX_UM_E_ENVMODE; - ifmt = unitsmode & FX_UM_E_IFMT; - - if (unitsmode & FX_UM_ALPHA_ITERATED) - locala = GR_COMBINE_LOCAL_ITERATED; - else - locala = GR_COMBINE_LOCAL_CONSTANT; - - if (unitsmode & FX_UM_COLOR_ITERATED) - localc = GR_COMBINE_LOCAL_ITERATED; - else - localc = GR_COMBINE_LOCAL_CONSTANT; - - - if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) - fprintf(stderr, "fxMesa: fxSetupTextureDoubleTMU, envmode is %s/%s\n", - gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode), - gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode)); - - - if ((ti0->whichTMU == FX_TMU1) || (ti1->whichTMU == FX_TMU0)) { - tmu0 = 1; - tmu1 = 0; - } - fxMesa->tmuSrc = FX_TMU_BOTH; - - if (fxMesa->isNapalm) { - /* Remember, Glide has its texture units numbered in backward - * order compared to OpenGL. - */ - SetupTexEnvNapalm(ctx, FX_TMU1, GL_TRUE, &(ctx->Texture.Unit[0]), - ti0->baseLevelInternalFormat); - SetupTexEnvNapalm(ctx, FX_TMU0, GL_FALSE, &(ctx->Texture.Unit[1]), - ti1->baseLevelInternalFormat); - } - else { - switch (envmode) { - case (FX_UM_E0_MODULATE | FX_UM_E1_MODULATE): - { - GLboolean isalpha[FX_NUM_TMU]; - - if (ti0->baseLevelInternalFormat == GL_ALPHA) - isalpha[tmu0] = GL_TRUE; - else - isalpha[tmu0] = GL_FALSE; - - if (ti1->baseLevelInternalFormat == GL_ALPHA) - isalpha[tmu1] = GL_TRUE; - else - isalpha[tmu1] = GL_FALSE; - - if (isalpha[FX_TMU1]) - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXTRUE, - FXFALSE); - else - FX_grTexCombine_NoLock(GR_TMU1, GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, - FXFALSE); - - if (isalpha[FX_TMU0]) - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, - FXFALSE); - else - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, - FXFALSE); - - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - localc, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - break; - } - case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */ - if (tmu1 == FX_TMU1) { - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXTRUE, FXFALSE); - - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE); - } - else { - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE_MINUS_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE_MINUS_LOCAL, - FXFALSE, FXFALSE); - } - - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - break; - case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */ - if (tmu1 == FX_TMU1) { - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXTRUE); - - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE); - - } - else { - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE); - } - - if (ti0->baseLevelInternalFormat == GL_RGB) - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - else - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - - - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - break; - - - case (FX_UM_E0_MODULATE | FX_UM_E1_ADD): /* Quake 3 Sky */ - { - GLboolean isalpha[FX_NUM_TMU]; - - if (ti0->baseLevelInternalFormat == GL_ALPHA) - isalpha[tmu0] = GL_TRUE; - else - isalpha[tmu0] = GL_FALSE; - - if (ti1->baseLevelInternalFormat == GL_ALPHA) - isalpha[tmu1] = GL_TRUE; - else - isalpha[tmu1] = GL_FALSE; - - if (isalpha[FX_TMU1]) - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXTRUE, - FXFALSE); - else - FX_grTexCombine_NoLock(GR_TMU1, GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, - FXFALSE); - - if (isalpha[FX_TMU0]) - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, FXFALSE, - FXFALSE); - else - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, FXFALSE, - FXFALSE); - - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - localc, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, - FXFALSE); - break; - } - default: - fprintf(stderr, "Unexpected dual texture mode encountered\n"); - break; - } - } - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupTextureDoubleTMU(...) End\n"); - } -} - -/************************* No Texture ***************************/ - -static void -fxSetupTextureNone_NoLock(GLcontext * ctx) -{ - /*fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;*/ - GrCombineLocal_t localc, locala; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupTextureNone(...)\n"); - } - - if ((ctx->Light.ShadeModel == GL_SMOOTH) || 1 || - (ctx->Point.SmoothFlag) || - (ctx->Line.SmoothFlag) || - (ctx->Polygon.SmoothFlag)) locala = GR_COMBINE_LOCAL_ITERATED; - else - locala = GR_COMBINE_LOCAL_CONSTANT; - - if (ctx->Light.ShadeModel == GL_SMOOTH || 1) - localc = GR_COMBINE_LOCAL_ITERATED; - else - localc = GR_COMBINE_LOCAL_CONSTANT; - - FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - - FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); -} - -/************************************************************************/ -/************************** Texture Mode SetUp **************************/ -/************************************************************************/ - -static void -fxSetupTexture_NoLock(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint tex2Denabled; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxSetupTexture(...)\n"); - } - - /* Disable multipass texturing. - */ - ctx->Driver.MultipassFunc = 0; - - /* Texture Combine, Color Combine and Alpha Combine. - */ - tex2Denabled = (ctx->Texture.ReallyEnabled & TEXTURE0_2D); - - if (fxMesa->emulateTwoTMUs) - tex2Denabled |= (ctx->Texture.ReallyEnabled & TEXTURE1_2D); - - switch (tex2Denabled) { - case TEXTURE0_2D: - fxSetupTextureSingleTMU_NoLock(ctx, 0); - break; - case TEXTURE1_2D: - fxSetupTextureSingleTMU_NoLock(ctx, 1); - break; - case (TEXTURE0_2D | TEXTURE1_2D): - if (fxMesa->haveTwoTMUs) - fxSetupTextureDoubleTMU_NoLock(ctx); - else { - if (MESA_VERBOSE & VERBOSE_DRIVER) - fprintf(stderr, "fxmesa: enabling fake multitexture\n"); - - fxSetupTextureSingleTMU_NoLock(ctx, 0); - ctx->Driver.MultipassFunc = fxMultipassTexture; - } - break; - default: - fxSetupTextureNone_NoLock(ctx); - break; - } -} - -static void -fxSetupTexture(GLcontext * ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - BEGIN_BOARD_LOCK(fxMesa); - fxSetupTexture_NoLock(ctx); - END_BOARD_LOCK(fxMesa); -} - -/************************************************************************/ -/**************************** Blend SetUp *******************************/ -/************************************************************************/ - -void -fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - tfxUnitsState *us = &fxMesa->unitsState; - GrAlphaBlendFnc_t sfact, dfact, asfact, adfact; - - /* From the Glide documentation: - For alpha source and destination blend function factor - parameters, Voodoo Graphics supports only - GR_BLEND_ZERO and GR_BLEND_ONE. - */ - - switch (sfactor) { - case GL_ZERO: - asfact = sfact = GR_BLEND_ZERO; - break; - case GL_ONE: - asfact = sfact = GR_BLEND_ONE; - break; - case GL_DST_COLOR: - sfact = GR_BLEND_DST_COLOR; - asfact = GR_BLEND_ONE; - break; - case GL_ONE_MINUS_DST_COLOR: - sfact = GR_BLEND_ONE_MINUS_DST_COLOR; - asfact = GR_BLEND_ONE; - break; - case GL_SRC_ALPHA: - sfact = GR_BLEND_SRC_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_ONE_MINUS_SRC_ALPHA: - sfact = GR_BLEND_ONE_MINUS_SRC_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_DST_ALPHA: - sfact = GR_BLEND_DST_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_ONE_MINUS_DST_ALPHA: - sfact = GR_BLEND_ONE_MINUS_DST_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_SRC_ALPHA_SATURATE: - sfact = GR_BLEND_ALPHA_SATURATE; - asfact = GR_BLEND_ONE; - break; - case GL_SRC_COLOR: - case GL_ONE_MINUS_SRC_COLOR: - /* USELESS */ - asfact = sfact = GR_BLEND_ONE; - break; - default: - asfact = sfact = GR_BLEND_ONE; - break; - } - - if ((sfact != us->blendSrcFuncRGB) || (asfact != us->blendSrcFuncAlpha)) { - us->blendSrcFuncRGB = sfact; - us->blendSrcFuncAlpha = asfact; - fxMesa->new_state |= FX_NEW_BLEND; - ctx->Driver.RenderStart = fxSetupFXUnits; - } - - switch (dfactor) { - case GL_ZERO: - adfact = dfact = GR_BLEND_ZERO; - break; - case GL_ONE: - adfact = dfact = GR_BLEND_ONE; - break; - case GL_SRC_COLOR: - dfact = GR_BLEND_SRC_COLOR; - adfact = GR_BLEND_ZERO; - break; - case GL_ONE_MINUS_SRC_COLOR: - dfact = GR_BLEND_ONE_MINUS_SRC_COLOR; - adfact = GR_BLEND_ZERO; - break; - case GL_SRC_ALPHA: - dfact = GR_BLEND_SRC_ALPHA; - adfact = GR_BLEND_ZERO; - break; - case GL_ONE_MINUS_SRC_ALPHA: - dfact = GR_BLEND_ONE_MINUS_SRC_ALPHA; - adfact = GR_BLEND_ZERO; - break; - case GL_DST_ALPHA: - /* dfact=GR_BLEND_DST_ALPHA; */ - /* We can't do DST_ALPHA */ - dfact = GR_BLEND_ONE; - adfact = GR_BLEND_ZERO; - break; - case GL_ONE_MINUS_DST_ALPHA: - /* dfact=GR_BLEND_ONE_MINUS_DST_ALPHA; */ - /* We can't do DST_ALPHA */ - dfact = GR_BLEND_ZERO; - adfact = GR_BLEND_ZERO; - break; - case GL_SRC_ALPHA_SATURATE: - case GL_DST_COLOR: - case GL_ONE_MINUS_DST_COLOR: - /* USELESS */ - adfact = dfact = GR_BLEND_ZERO; - break; - default: - adfact = dfact = GR_BLEND_ZERO; - break; - } - - if ((dfact != us->blendDstFuncRGB) || (adfact != us->blendDstFuncAlpha)) { - us->blendDstFuncRGB = dfact; - us->blendDstFuncAlpha = adfact; - fxMesa->new_state |= FX_NEW_BLEND; - ctx->Driver.RenderStart = fxSetupFXUnits; - } -} - - -/* XXX not done yet, but it looks do-able in the hardware */ -void -fxDDBlendFuncSeparate(GLcontext *ctx, - GLenum sfactorRGB, GLenum sfactorA, - GLenum dfactorRGB, GLenum dfactorA) -{ -#if 000 - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - tfxUnitsState *us = &fxMesa->unitsState; - GrAlphaBlendFnc_t sfact, dfact, asfact, adfact; - - /* From the Glide documentation: - For alpha source and destination blend function factor - parameters, Voodoo Graphics supports only - GR_BLEND_ZERO and GR_BLEND_ONE. - */ - - switch (sfactor) { - case GL_ZERO: - asfact = sfact = GR_BLEND_ZERO; - break; - case GL_ONE: - asfact = sfact = GR_BLEND_ONE; - break; - case GL_DST_COLOR: - sfact = GR_BLEND_DST_COLOR; - asfact = GR_BLEND_ONE; - break; - case GL_ONE_MINUS_DST_COLOR: - sfact = GR_BLEND_ONE_MINUS_DST_COLOR; - asfact = GR_BLEND_ONE; - break; - case GL_SRC_ALPHA: - sfact = GR_BLEND_SRC_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_ONE_MINUS_SRC_ALPHA: - sfact = GR_BLEND_ONE_MINUS_SRC_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_DST_ALPHA: - sfact = GR_BLEND_DST_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_ONE_MINUS_DST_ALPHA: - sfact = GR_BLEND_ONE_MINUS_DST_ALPHA; - asfact = GR_BLEND_ONE; - break; - case GL_SRC_ALPHA_SATURATE: - sfact = GR_BLEND_ALPHA_SATURATE; - asfact = GR_BLEND_ONE; - break; - case GL_SRC_COLOR: - case GL_ONE_MINUS_SRC_COLOR: - /* USELESS */ - asfact = sfact = GR_BLEND_ONE; - break; - default: - asfact = sfact = GR_BLEND_ONE; - break; - } - - if ((sfact != us->blendSrcFuncRGB) || (asfact != us->blendSrcFuncAlpha)) { - us->blendSrcFuncRGB = sfact; - us->blendSrcFuncAlpha = asfact; - fxMesa->new_state |= FX_NEW_BLEND; - ctx->Driver.RenderStart = fxSetupFXUnits; - } - - switch (dfactor) { - case GL_ZERO: - adfact = dfact = GR_BLEND_ZERO; - break; - case GL_ONE: - adfact = dfact = GR_BLEND_ONE; - break; - case GL_SRC_COLOR: - dfact = GR_BLEND_SRC_COLOR; - adfact = GR_BLEND_ZERO; - break; - case GL_ONE_MINUS_SRC_COLOR: - dfact = GR_BLEND_ONE_MINUS_SRC_COLOR; - adfact = GR_BLEND_ZERO; - break; - case GL_SRC_ALPHA: - dfact = GR_BLEND_SRC_ALPHA; - adfact = GR_BLEND_ZERO; - break; - case GL_ONE_MINUS_SRC_ALPHA: - dfact = GR_BLEND_ONE_MINUS_SRC_ALPHA; - adfact = GR_BLEND_ZERO; - break; - case GL_DST_ALPHA: - /* dfact=GR_BLEND_DST_ALPHA; */ - /* We can't do DST_ALPHA */ - dfact = GR_BLEND_ONE; - adfact = GR_BLEND_ZERO; - break; - case GL_ONE_MINUS_DST_ALPHA: - /* dfact=GR_BLEND_ONE_MINUS_DST_ALPHA; */ - /* We can't do DST_ALPHA */ - dfact = GR_BLEND_ZERO; - adfact = GR_BLEND_ZERO; - break; - case GL_SRC_ALPHA_SATURATE: - case GL_DST_COLOR: - case GL_ONE_MINUS_DST_COLOR: - /* USELESS */ - adfact = dfact = GR_BLEND_ZERO; - break; - default: - adfact = dfact = GR_BLEND_ZERO; - break; - } - - if ((dfact != us->blendDstFuncRGB) || (adfact != us->blendDstFuncAlpha)) { - us->blendDstFuncRGB = dfact; - us->blendDstFuncAlpha = adfact; - fxMesa->new_state |= FX_NEW_BLEND; - ctx->Driver.RenderStart = fxSetupFXUnits; - } -#endif -} - - -static void -fxSetupBlend(GLcontext * ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - tfxUnitsState *us = &fxMesa->unitsState; - - if (us->blendEnabled) - FX_grAlphaBlendFunction(us->blendSrcFuncRGB, us->blendDstFuncRGB, - us->blendSrcFuncAlpha, us->blendDstFuncAlpha); - else - FX_grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, - GR_BLEND_ONE, GR_BLEND_ZERO); -} - - -/************************************************************************/ -/************************** Alpha Test SetUp ****************************/ -/************************************************************************/ - -void -fxDDAlphaFunc(GLcontext * ctx, GLenum func, GLclampf ref) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - tfxUnitsState *us = &fxMesa->unitsState; - GrCmpFnc_t newfunc; - - switch (func) { - case GL_NEVER: - newfunc = GR_CMP_NEVER; - break; - case GL_LESS: - newfunc = GR_CMP_LESS; - break; - case GL_EQUAL: - newfunc = GR_CMP_EQUAL; - break; - case GL_LEQUAL: - newfunc = GR_CMP_LEQUAL; - break; - case GL_GREATER: - newfunc = GR_CMP_GREATER; - break; - case GL_NOTEQUAL: - newfunc = GR_CMP_NOTEQUAL; - break; - case GL_GEQUAL: - newfunc = GR_CMP_GEQUAL; - break; - case GL_ALWAYS: - newfunc = GR_CMP_ALWAYS; - break; - default: - gl_problem(ctx, "fx Driver: internal error in fxDDAlphaFunc()\n"); - return; - } - - if (newfunc != us->alphaTestFunc) { - us->alphaTestFunc = newfunc; - fxMesa->new_state |= FX_NEW_ALPHA; - ctx->Driver.RenderStart = fxSetupFXUnits; - } - - if (ctx->Color.AlphaRef != us->alphaTestRefValue) { - us->alphaTestRefValue = ctx->Color.AlphaRef; - fxMesa->new_state |= FX_NEW_ALPHA; - ctx->Driver.RenderStart = fxSetupFXUnits; - } -} - -static void -fxSetupAlphaTest(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - tfxUnitsState *us = &fxMesa->unitsState; - - if (us->alphaTestEnabled) { - FX_grAlphaTestFunction(fxMesa, us->alphaTestFunc); - FX_grAlphaTestReferenceValue(fxMesa, us->alphaTestRefValue); - } - else - FX_grAlphaTestFunction(fxMesa, GR_CMP_ALWAYS); -} - - -/* - * Evaluate all depth-test state and make the Glide calls. - */ -static void -fxSetupDepthTest(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - if (ctx->Depth.Test) { - GrCmpFnc_t dfunc; - switch (ctx->Depth.Func) { - case GL_NEVER: - dfunc = GR_CMP_NEVER; - break; - case GL_LESS: - dfunc = GR_CMP_LESS; - break; - case GL_GEQUAL: - dfunc = GR_CMP_GEQUAL; - break; - case GL_LEQUAL: - dfunc = GR_CMP_LEQUAL; - break; - case GL_GREATER: - dfunc = GR_CMP_GREATER; - break; - case GL_NOTEQUAL: - dfunc = GR_CMP_NOTEQUAL; - break; - case GL_EQUAL: - dfunc = GR_CMP_EQUAL; - break; - case GL_ALWAYS: - dfunc = GR_CMP_ALWAYS; - break; - default: - gl_problem(ctx, "bad depth mode in fxSetupDepthTest"); - dfunc = GR_CMP_ALWAYS; - } - FX_grDepthBufferFunction(fxMesa, dfunc); - FX_grDepthMask(fxMesa, ctx->Depth.Mask); - } - else { - /* depth test always passes, don't update Z buffer */ - FX_grDepthBufferFunction(fxMesa, GR_CMP_ALWAYS); - FX_grDepthMask(fxMesa, FXFALSE); - } -} - - -/* - * Evaluate all stencil state and make the Glide calls. - */ -GrStencil_t -fxConvertGLStencilOp(GLenum op) -{ - switch (op) { - case GL_KEEP: - return GR_STENCILOP_KEEP; - case GL_ZERO: - return GR_STENCILOP_ZERO; - case GL_REPLACE: - return GR_STENCILOP_REPLACE; - case GL_INCR: - return GR_STENCILOP_INCR_CLAMP; - case GL_DECR: - return GR_STENCILOP_DECR_CLAMP; - case GL_INVERT: - return GR_STENCILOP_INVERT; - default: - gl_problem(NULL, "bad stencil op in fxConvertGLStencilOp"); - } - return GR_STENCILOP_KEEP; /* never get, silence compiler warning */ -} - -/* - * This function is called just before any rendering is done. - * It will validate the stencil parameters. - */ -static void -fxSetupStencilTest(GLcontext * ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - if (fxMesa->haveHwStencil) { - if (ctx->Stencil.Enabled) { - GrStencil_t sfail = fxConvertGLStencilOp(ctx->Stencil.FailFunc); - GrStencil_t zfail = fxConvertGLStencilOp(ctx->Stencil.ZFailFunc); - GrStencil_t zpass = fxConvertGLStencilOp(ctx->Stencil.ZPassFunc); - FX_grStencilOp(fxMesa, sfail, zfail, zpass); - FX_grStencilFunc(fxMesa, ctx->Stencil.Function - GL_NEVER, - ctx->Stencil.Ref, ctx->Stencil.ValueMask); - FX_grStencilMask(fxMesa, ctx->Stencil.WriteMask); - FX_grEnable(fxMesa, GR_STENCIL_MODE_EXT); - } - else { - FX_grDisable(fxMesa, GR_STENCIL_MODE_EXT); - } - } -} - - -/* - * Set the state so that stencil is either enabled or disabled. - * This is called from Mesa only. Glide is invoked at - * setup time, not now. - */ -static void -fxDDEnableStencil(GLcontext * ctx, GLboolean state) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - (void) state; - fxMesa->new_state |= FX_NEW_STENCIL; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - - -/************************************************************************/ -/**************************** Color Mask SetUp **************************/ -/************************************************************************/ - -GLboolean -fxDDColorMask(GLcontext *ctx, - GLboolean r, GLboolean g, GLboolean b, GLboolean a) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxMesa->new_state |= FX_NEW_COLOR_MASK; - ctx->Driver.RenderStart = fxSetupFXUnits; - (void) r; - (void) g; - (void) b; - (void) a; - return GL_FALSE; -} - -static void -fxSetupColorMask(GLcontext *ctx) -{ - if (ctx->Color.DrawBuffer == GL_NONE) { - FX_grColorMask(ctx, GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - } - else { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - /* XXX need to call grRenderBuffer to work around strange mask bug */ - FX_grRenderBuffer(fxMesa, fxMesa->currentFB); - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - } -} - - -/************************************************************************/ -/**************************** Fog Mode SetUp ****************************/ -/************************************************************************/ - -/* - * This is called during state update in order to update the Glide fog state. - */ -static void -fxSetupFog(GLcontext * ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - if (ctx->Fog.Enabled && ctx->FogMode == FOG_FRAGMENT) { - - /* update fog color */ - GLubyte col[4]; - col[0] = (unsigned int) (255 * ctx->Fog.Color[0]); - col[1] = (unsigned int) (255 * ctx->Fog.Color[1]); - col[2] = (unsigned int) (255 * ctx->Fog.Color[2]); - col[3] = (unsigned int) (255 * ctx->Fog.Color[3]); - FX_grFogColorValue(fxMesa, FXCOLOR4(col)); - - if (fxMesa->fogTableMode != ctx->Fog.Mode || - fxMesa->fogDensity != ctx->Fog.Density || - fxMesa->fogStart != ctx->Fog.Start || - fxMesa->fogEnd != ctx->Fog.End) { - /* reload the fog table */ - switch (ctx->Fog.Mode) { - case GL_LINEAR: - guFogGenerateLinear(fxMesa->fogTable, ctx->Fog.Start, - ctx->Fog.End); - break; - case GL_EXP: - guFogGenerateExp(fxMesa->fogTable, ctx->Fog.Density); - break; - case GL_EXP2: - guFogGenerateExp2(fxMesa->fogTable, ctx->Fog.Density); - break; - default: - ; - } - fxMesa->fogTableMode = ctx->Fog.Mode; - fxMesa->fogDensity = ctx->Fog.Density; - fxMesa->fogStart = ctx->Fog.Start; - fxMesa->fogEnd = ctx->Fog.End; - } - - FX_grFogTable(fxMesa, fxMesa->fogTable); - FX_grFogMode(fxMesa, GR_FOG_WITH_TABLE); - } - else { - FX_grFogMode(fxMesa, GR_FOG_DISABLE); - } -} - -void -fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params) -{ - FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG; - ctx->Driver.RenderStart = fxSetupFXUnits; /* XXX why is this here? */ -} - -/************************************************************************/ -/************************** Scissor Test SetUp **************************/ -/************************************************************************/ - -/* This routine is used in managing the lock state, and therefore can't lock */ -void -fxSetScissorValues(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - int xmin, xmax, ymin, ymax; - - if (ctx->Scissor.Enabled) { - xmin = ctx->Scissor.X; - xmax = ctx->Scissor.X + ctx->Scissor.Width; - ymin = ctx->Scissor.Y; - ymax = ctx->Scissor.Y + ctx->Scissor.Height; - } - else { - xmin = 0; - ymin = 0; - xmax = fxMesa->width; - ymax = fxMesa->height; - } - /* translate to screen coords */ - xmin += fxMesa->x_offset; - xmax += fxMesa->x_offset; - ymin += fxMesa->y_delta; - ymax += fxMesa->y_delta; - - /* intersect scissor region with first clip rect */ - if (xmin < fxMesa->clipMinX) - xmin = fxMesa->clipMinX; - else if (xmin > fxMesa->clipMaxX) - xmin = fxMesa->clipMaxX; - - if (xmax > fxMesa->clipMaxX) - xmax = fxMesa->clipMaxX; - - if (ymin < fxMesa->screen_height - fxMesa->clipMaxY) - ymin = fxMesa->screen_height - fxMesa->clipMaxY; - else if (ymin > fxMesa->screen_height - fxMesa->clipMinY) - ymin = fxMesa->screen_height - fxMesa->clipMinY; - - if (ymax > fxMesa->screen_height - fxMesa->clipMinY) - ymax = fxMesa->screen_height - fxMesa->clipMinY; - - /* prevent wrap-around problems */ - if (xmax < xmin) - xmax = xmin; - if (ymax < ymin) - ymax = ymin; - - FX_grClipWindow_NoLock(xmin, ymin, xmax, ymax); -} - -static void -fxSetupScissor(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - if (!fxMesa->needClip) { - BEGIN_BOARD_LOCK(fxMesa); - fxSetScissorValues(ctx); - END_BOARD_LOCK(fxMesa); - } -} - -void -fxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) -{ - FX_CONTEXT(ctx)->new_state |= FX_NEW_SCISSOR; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - -/************************************************************************/ -/*************************** Cull mode setup ****************************/ -/************************************************************************/ - - -void -fxDDCullFace(GLcontext * ctx, GLenum mode) -{ - (void) mode; - FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - -void -fxDDFrontFace(GLcontext * ctx, GLenum mode) -{ - (void) mode; - FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - - -static void -fxSetupCull(GLcontext * ctx) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - if (ctx->Polygon.CullFlag) { - switch (ctx->Polygon.CullFaceMode) { - case GL_BACK: - if (ctx->Polygon.FrontFace == GL_CCW) - FX_CONTEXT(ctx)->cullMode = GR_CULL_NEGATIVE; - else - FX_CONTEXT(ctx)->cullMode = GR_CULL_POSITIVE; - break; - case GL_FRONT: - if (ctx->Polygon.FrontFace == GL_CCW) - FX_CONTEXT(ctx)->cullMode = GR_CULL_POSITIVE; - else - FX_CONTEXT(ctx)->cullMode = GR_CULL_NEGATIVE; - break; - case GL_FRONT_AND_BACK: - FX_CONTEXT(ctx)->cullMode = GR_CULL_DISABLE; - break; - default: - break; - } - } - else { - FX_CONTEXT(ctx)->cullMode = GR_CULL_DISABLE; - } - FX_grCullMode(fxMesa, FX_CONTEXT(ctx)->cullMode); -} - - -/************************************************************************/ -/****************************** DD Enable ******************************/ -/************************************************************************/ - -void -fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - tfxUnitsState *us = &fxMesa->unitsState; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDEnable(...)\n"); - } - - switch (cap) { - case GL_ALPHA_TEST: - if (state != us->alphaTestEnabled) { - us->alphaTestEnabled = state; - fxMesa->new_state |= FX_NEW_ALPHA; - ctx->Driver.RenderStart = fxSetupFXUnits; - } - break; - case GL_BLEND: - if (state != us->blendEnabled) { - us->blendEnabled = state; - fxMesa->new_state |= FX_NEW_BLEND; - ctx->Driver.RenderStart = fxSetupFXUnits; - } - break; - case GL_DEPTH_TEST: - fxMesa->new_state |= FX_NEW_DEPTH; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_DITHER: - if (state) - FX_grDitherMode(fxMesa, GR_DITHER_4x4); - else - FX_grDitherMode(fxMesa, GR_DITHER_DISABLE); - break; - case GL_SCISSOR_TEST: - fxMesa->new_state |= FX_NEW_SCISSOR; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - fxDDTexUseGlbPalette(ctx, state); - break; - case GL_FOG: - fxMesa->new_state |= FX_NEW_FOG; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_CULL_FACE: - fxMesa->new_state |= FX_NEW_CULL; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_LINE_SMOOTH: - case GL_LINE_STIPPLE: - case GL_POINT_SMOOTH: - case GL_POLYGON_SMOOTH: - case GL_TEXTURE_2D: - fxMesa->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_STENCIL_TEST: - fxMesa->new_state |= FX_NEW_STENCIL; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - default: - ; /* no-op */ - } -} - - -#if 0 -/* - Multipass to do GL_BLEND texture functions - Cf*(1-Ct) has already been written to the buffer during the first pass - Cc*Ct gets written during the second pass (in this function) - Everything gets reset in the third call (in this function) -*/ -static GLboolean -fxMultipassBlend(struct vertex_buffer *VB, GLuint pass) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - switch (pass) { - case 1: - /* Add Cc*Ct */ - fxMesa->restoreUnitsState = fxMesa->unitsState; - if (ctx->Depth.Mask) { - /* We don't want to check or change the depth buffers */ - switch (ctx->Depth.Func) { - case GL_NEVER: - case GL_ALWAYS: - break; - default: - fxDDDepthFunc(ctx, GL_EQUAL); - break; - } - fxDDDepthMask(ctx, FALSE); - } - /* - * Disable stencil as well. - */ - if (ctx->Stencil.Enabled) { - fxDDEnableStencil(ctx, GL_FALSE); - } - /* Enable Cc*Ct mode */ - /* XXX Set the Constant Color ? */ - fxDDEnable(ctx, GL_BLEND, GL_TRUE); - fxDDBlendFunc(ctx, XXX, XXX); - fxSetupTextureSingleTMU(ctx, XXX); - fxSetupBlend(ctx); - fxSetupDepthTest(ctx); - break; - - case 2: - /* Reset everything back to normal */ - fxMesa->unitsState = fxMesa->restoreUnitsState; - fxMesa->setupdone &= XXX; - fxSetupTextureSingleTMU(ctx, XXX); - fxSetupBlend(ctx); - fxSetupDepthTest(ctx); - fxSetupStencilText(ctx); - break; - } - - return pass == 1; -} -#endif - -/************************************************************************/ -/******************** Fake Multitexture Support *************************/ -/************************************************************************/ - -/* Its considered cheeky to try to fake ARB multitexture by doing - * multipass rendering, because it is not possible to emulate the full - * spec in this way. The fact is that the voodoo 2 supports only a - * subset of the possible multitexturing modes, and it is possible to - * support almost the same subset using multipass blending on the - * voodoo 1. In all other cases for both voodoo 1 and 2, we fall back - * to software rendering, satisfying the spec if not the user. - */ -static GLboolean -fxMultipassTexture(struct vertex_buffer *VB, GLuint pass) -{ - GLcontext *ctx = VB->ctx; - fxVertex *v = FX_DRIVER_DATA(VB)->verts; - fxVertex *last = FX_DRIVER_DATA(VB)->last_vert; - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - switch (pass) { - case 1: - if (MESA_VERBOSE & - (VERBOSE_DRIVER | VERBOSE_PIPELINE | VERBOSE_TEXTURE)) - fprintf(stderr, "fxmesa: Second texture pass\n"); - - for (; v != last; v++) { - v->f[S0COORD] = v->f[S1COORD]; - v->f[T0COORD] = v->f[T1COORD]; - } - - fxMesa->restoreUnitsState = fxMesa->unitsState; - fxMesa->tmu_source[0] = 1; - - if (ctx->Depth.Mask) { - switch (ctx->Depth.Func) { - case GL_NEVER: - case GL_ALWAYS: - break; - default: - /*fxDDDepthFunc( ctx, GL_EQUAL ); */ - FX_grDepthBufferFunction(fxMesa, GR_CMP_EQUAL); - break; - } - - /*fxDDDepthMask( ctx, GL_FALSE ); */ - FX_grDepthMask(fxMesa, FXFALSE); - } - fxDDEnableStencil(ctx, GL_FALSE); - if (ctx->Texture.Unit[1].EnvMode == GL_MODULATE) { - fxDDEnable(ctx, GL_BLEND, GL_TRUE); - fxDDBlendFunc(ctx, GL_DST_COLOR, GL_ZERO); - } - - fxSetupTextureSingleTMU(ctx, 1); - fxSetupBlend(ctx); - fxSetupDepthTest(ctx); - break; - - case 2: - /* Restore original state. - */ - fxMesa->tmu_source[0] = 0; - fxMesa->unitsState = fxMesa->restoreUnitsState; - fxMesa->setupdone &= ~SETUP_TMU0; - fxSetupTextureSingleTMU(ctx, 0); - fxSetupBlend(ctx); - fxSetupDepthTest(ctx); - fxSetupStencilTest(ctx); - break; - } - - return pass == 1; -} - - -/************************************************************************/ -/************************** Changes to units state **********************/ -/************************************************************************/ - - -/* All units setup is handled under texture setup. - */ -void -fxDDShadeModel(GLcontext * ctx, GLenum mode) -{ - FX_CONTEXT(ctx)->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; -} - - - -/************************************************************************/ -/****************************** Units SetUp *****************************/ -/************************************************************************/ -static void -gl_print_fx_state_flags(const char *msg, GLuint flags) -{ - fprintf(stderr, - "%s: (0x%x) %s%s%s%s%s%s%s\n", - msg, - flags, - (flags & FX_NEW_TEXTURING) ? "texture, " : "", - (flags & FX_NEW_BLEND) ? "blend, " : "", - (flags & FX_NEW_ALPHA) ? "alpha, " : "", - (flags & FX_NEW_FOG) ? "fog, " : "", - (flags & FX_NEW_SCISSOR) ? "scissor, " : "", - (flags & FX_NEW_COLOR_MASK) ? "colormask, " : "", - (flags & FX_NEW_CULL) ? "cull, " : ""); -} - -void -fxSetupFXUnits(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint newstate = fxMesa->new_state; - - if (MESA_VERBOSE & VERBOSE_DRIVER) - gl_print_fx_state_flags("fxmesa: fxSetupFXUnits", newstate); - - if (newstate) { - if (newstate & FX_NEW_TEXTURING) - fxSetupTexture(ctx); - - if (newstate & FX_NEW_BLEND) - fxSetupBlend(ctx); - - if (newstate & FX_NEW_ALPHA) - fxSetupAlphaTest(ctx); - - if (newstate & FX_NEW_DEPTH) - fxSetupDepthTest(ctx); - - if (newstate & FX_NEW_STENCIL) - fxSetupStencilTest(ctx); - - if (newstate & FX_NEW_FOG) - fxSetupFog(ctx); - - if (newstate & FX_NEW_SCISSOR) - fxSetupScissor(ctx); - - if (newstate & FX_NEW_COLOR_MASK) - fxSetupColorMask(ctx); - - if (newstate & FX_NEW_CULL) - fxSetupCull(ctx); - fxMesa->new_state = 0; -/* ctx->Driver.RenderStart = 0; */ - } -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h b/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h deleted file mode 100644 index 4b71e5ea2..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h +++ /dev/null @@ -1,36 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -#ifndef FXSETUP_H -#define FXSETUP_H - -extern void fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj); - -extern void fxDDEnable(GLcontext *, GLenum, GLboolean); - -extern void fxDDAlphaFunc(GLcontext *, GLenum, GLclampf); - -extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum); - -extern void fxDDBlendFuncSeparate(GLcontext *ctx, - GLenum sfactorRGB, GLenum sfactorA, - GLenum dfactorRGB, GLenum dfactorA); - -extern GrStencil_t fxConvertGLStencilOp(GLenum op); - -extern void fxDDScissor(GLcontext *ctx, - GLint x, GLint y, GLsizei w, GLsizei h); - -extern void fxDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat * params); - -extern GLboolean fxDDColorMask(GLcontext *ctx, - GLboolean r, GLboolean g, - GLboolean b, GLboolean a); - -extern void fxDDShadeModel(GLcontext * ctx, GLenum mode); - -extern void fxDDCullFace(GLcontext * ctx, GLenum mode); - -extern void fxDDFrontFace(GLcontext * ctx, GLenum mode); - -extern void fxSetupFXUnits(GLcontext *); - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c b/xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c deleted file mode 100644 index 98e62b1ff..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c +++ /dev/null @@ -1,161 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c,v 1.1 2000/09/24 13:51:19 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include "fxdrv.h" -#include "vbcull.h" - - -#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) -#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) - -#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ - GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b;\ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - - -#define STRIPSLOCAL_VAR int sc = 0; - -#define INIT(a) - -#define SENDTRI(u0,u1,u2) FX_grDrawTriangle(fxMesa, (GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) -#define FLUSHTRI() /* No-Op */ -#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } -#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } -#define FLUSHSTRIPS() FX_grDrawVertexArray(fxMesa, GR_TRIANGLE_STRIP,sc,sb) - -#define CLIPPED(a,b,c) 0 -#define CULLED(a,b,c) 0 -#define SENDCLIPTRI(a,b,c) /* NoOp */ - -#define TAG(x) x##_fx - -#include "fxsdettmp.h" - - -/* Clipped but no userclip */ -#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2] -#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2] - -#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ - GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ - const GLubyte *const clipmask = VB->ClipMask; \ - const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define STRIPSLOCAL_VAR int sc = 0; - -#define INIT(a) - -#define SENDTRI(u0,u1,u2) FX_grDrawTriangle(fxMesa, (GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) -#define FLUSHTRI() /* No-Op */ -#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } -#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } -#define FLUSHSTRIPS() FX_grDrawVertexArray(fxMesa, GR_TRIANGLE_STRIP,sc,sb) - -#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) -#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2]) -#define SENDCLIPTRI(u0,u1,u2) { \ - GLuint vl[3]; \ - ASSIGN_3V(vl, u0, u1, u2 ); \ - cliptri(VB,vl,clipmask[u0] | clipmask[u1] | clipmask[u2]); \ - } - -#define TAG(x) x##_fx_view_clipped - -#include "fxsdettmp.h" - -/* Clipped and might be userclip */ -#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2] -#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2] - -#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ - GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ - const GLubyte *const clipmask = VB->ClipMask; \ - const GLubyte *userclipmask = VB->UserClipMask; \ - const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define STRIPSLOCAL_VAR int sc = 0; - -#define INIT(a) - -#define SENDTRI(u0,u1,u2) FX_grDrawTriangle(fxMesa, (GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) -#define FLUSHTRI() /* No-Op */ -#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } -#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } -#define FLUSHSTRIPS() FX_grDrawVertexArray(fxMesa, GR_TRIANGLE_STRIP,sc,sb) - -#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) -#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2] & CLIP_ALL_BITS) -#define SENDCLIPTRI(u0,u1,u2) { \ - GLuint vl[3]; \ - GLuint imask = (clipmask[u0] | clipmask[u1] | clipmask[u2]); \ - \ - if (imask & CLIP_USER_BIT) { \ - if (!(userclipmask[u2] & userclipmask[u1] & userclipmask[u0])) \ - { ASSIGN_3V(vl, u2, u1, u0 ); \ - imask |= (userclipmask[u2] | userclipmask[u1] | userclipmask[u0]) << 8; \ - cliptri( VB, vl, imask );} \ - } \ - else { ASSIGN_3V(vl, u2, u1, u0 ); \ - cliptri( VB, vl, imask ); } \ - } - -#define TAG(x) x##_fx_clipped - -#include "fxsdettmp.h" - - -void -fxDDRenderInitGlide3(GLcontext * ctx) -{ -#if 0 - render_tab_fx_smooth_indirect[GL_TRIANGLES] = - render_vb_triangles_smooth_indirect_sd_fx; - render_tab_fx_smooth_indirect_view_clipped[GL_TRIANGLES] = - render_vb_triangles_smooth_indirect_sd_fx_view_clipped; - render_tab_fx_smooth_indirect_clipped[GL_TRIANGLES] = - render_vb_triangles_smooth_indirect_sd_fx_clipped; -#endif -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c b/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c deleted file mode 100644 index 63a9b8922..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c +++ /dev/null @@ -1,959 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c,v 1.3 2000/12/08 21:34:20 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxtexman.c - 3Dfx VooDoo texture memory functions */ - - -#include "fxdrv.h" -#include "fxtexman.h" -#include "fxddtex.h" - - -#define BAD_ADDRESS ((FxU32) -1) - - -#ifdef TEXSANITY -static void -fubar(void) -{ -} - -/* - * Sanity Check - */ -static void -sanity(fxMesaContext fxMesa) -{ - MemRange *tmp, *prev, *pos; - - prev = 0; - tmp = fxMesa->tmFree[0]; - while (tmp) { - if (!tmp->startAddr && !tmp->endAddr) { - fprintf(stderr, "Textures fubar\n"); - fubar(); - } - if (tmp->startAddr >= tmp->endAddr) { - fprintf(stderr, "Node fubar\n"); - fubar(); - } - if (prev && (prev->startAddr >= tmp->startAddr || - prev->endAddr > tmp->startAddr)) { - fprintf(stderr, "Sorting fubar\n"); - fubar(); - } - prev = tmp; - tmp = tmp->next; - } - prev = 0; - tmp = fxMesa->tmFree[1]; - while (tmp) { - if (!tmp->startAddr && !tmp->endAddr) { - fprintf(stderr, "Textures fubar\n"); - fubar(); - } - if (tmp->startAddr >= tmp->endAddr) { - fprintf(stderr, "Node fubar\n"); - fubar(); - } - if (prev && (prev->startAddr >= tmp->startAddr || - prev->endAddr > tmp->startAddr)) { - fprintf(stderr, "Sorting fubar\n"); - fubar(); - } - prev = tmp; - tmp = tmp->next; - } -} -#endif - - -/* - * Allocate and initialize a new MemRange struct. - * Try to allocate it from the pool of free MemRange nodes rather than malloc. - */ -static MemRange * -NewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end) -{ - struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; - MemRange *result; - - _glthread_LOCK_MUTEX(mesaShared->Mutex); - if (shared && shared->tmPool) { - result = shared->tmPool; - shared->tmPool = shared->tmPool->next; - } - else { - result = MALLOC(sizeof(MemRange)); - - } - _glthread_UNLOCK_MUTEX(mesaShared->Mutex); - - if (!result) { - /*fprintf(stderr, "fxDriver: out of memory!\n");*/ - return NULL; - } - - result->startAddr = start; - result->endAddr = end; - result->next = NULL; - - return result; -} - - -/* - * Delete a MemRange struct. - * We keep a linked list of free/available MemRange structs to - * avoid extra malloc/free calls. - */ -#if 0 -static void -DeleteRangeNode_NoLock(struct TdfxSharedState *shared, MemRange *range) -{ - /* insert at head of list */ - range->next = shared->tmPool; - shared->tmPool = range; -} -#endif - -#define DELETE_RANGE_NODE(shared, range) \ - (range)->next = (shared)->tmPool; \ - (shared)->tmPool = (range) - - -/* - * When we've run out of texture memory we have to throw out an - * existing texture to make room for the new one. This function - * determins the texture to throw out. - */ -static struct gl_texture_object * -FindOldestObject(fxMesaContext fxMesa, FxU32 tmu) -{ - const GLuint bindnumber = fxMesa->texBindNumber; - struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj; - GLfloat lowestPriority; - GLuint oldestAge; - - oldestObj = NULL; - oldestAge = 0; - - lowestPriority = 1.0F; - lowestPriorityObj = NULL; - - for (obj = fxMesa->glCtx->Shared->TexObjectList; obj; obj = obj->Next) { - tfxTexInfo *info = fxTMGetTexInfo(obj); - - if (info && info->isInTM && - ((info->whichTMU == tmu) || (info->whichTMU == FX_TMU_BOTH) || - (info->whichTMU == FX_TMU_SPLIT))) { - GLuint age, lasttime; - - lasttime = info->lastTimeUsed; - - if (lasttime > bindnumber) - age = bindnumber + (UINT_MAX - lasttime + 1); /* TO DO: check wrap around */ - else - age = bindnumber - lasttime; - - if (age >= oldestAge) { - oldestAge = age; - oldestObj = obj; - } - - /* examine priority */ - if (obj->Priority < lowestPriority) { - lowestPriority = obj->Priority; - lowestPriorityObj = obj; - } - } - } - - if (lowestPriority < 1.0) { - ASSERT(lowestPriorityObj); - /* - printf("discard %d pri=%f\n", lowestPriorityObj->Name, lowestPriority); - */ - return lowestPriorityObj; - } - else { - /* - printf("discard %d age=%d\n", oldestObj->Name, oldestAge); - */ - return oldestObj; - } -} - - -/* - * Find the address (offset?) at which we can store a new texture. - * <tmu> is the texture unit. - * <size> is the texture size in bytes. - */ -static FxU32 -FindStartAddr(fxMesaContext fxMesa, FxU32 tmu, FxU32 size) -{ - struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; - MemRange *prev, *block; - FxU32 result; - struct gl_texture_object *obj; - - if (shared->umaTexMemory) { - assert(tmu == FX_TMU0); - } - - _glthread_LOCK_MUTEX(mesaShared->Mutex); - while (1) { - prev = NULL; - block = shared->tmFree[tmu]; - while (block) { - if (block->endAddr - block->startAddr >= size) { - /* The texture will fit here */ - result = block->startAddr; - block->startAddr += size; - if (block->startAddr == block->endAddr) { - /* Remove this node since it's empty */ - if (prev) { - prev->next = block->next; - } - else { - shared->tmFree[tmu] = block->next; - } - DELETE_RANGE_NODE(shared, block); - } - shared->freeTexMem[tmu] -= size; - _glthread_UNLOCK_MUTEX(mesaShared->Mutex); - return result; - } - prev = block; - block = block->next; - } - /* No free space. Discard oldest */ - obj = FindOldestObject(fxMesa, tmu); - if (!obj) { - /*gl_problem(NULL, "fx Driver: No space for texture\n");*/ - _glthread_UNLOCK_MUTEX(mesaShared->Mutex); - return BAD_ADDRESS; - } - fxTMMoveOutTM_NoLock(fxMesa, obj); - fxMesa->stats.texSwaps++; - } - - /* never get here, but play it safe */ - _glthread_UNLOCK_MUTEX(mesaShared->Mutex); - return BAD_ADDRESS; -} - - -/* - * Remove the given MemRange node from hardware texture memory. - */ -static void -RemoveRange_NoLock(fxMesaContext fxMesa, FxU32 tmu, MemRange *range) -{ - struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; - MemRange *block, *prev; - - if (shared->umaTexMemory) { - assert(tmu == FX_TMU0); - } - - if (!range) - return; - - if (range->startAddr == range->endAddr) { - DELETE_RANGE_NODE(shared, range); - return; - } - shared->freeTexMem[tmu] += range->endAddr - range->startAddr; - - /* find position in linked list to insert this MemRange node */ - prev = NULL; - block = shared->tmFree[tmu]; - while (block) { - if (range->startAddr > block->startAddr) { - prev = block; - block = block->next; - } - else { - break; - } - } - - /* Insert the free block, combine with adjacent blocks when possible */ - range->next = block; - if (block) { - if (range->endAddr == block->startAddr) { - /* Combine */ - block->startAddr = range->startAddr; - DELETE_RANGE_NODE(shared, range); - range = block; - } - } - if (prev) { - if (prev->endAddr == range->startAddr) { - /* Combine */ - prev->endAddr = range->endAddr; - prev->next = range->next; - DELETE_RANGE_NODE(shared, range); - } - else { - prev->next = range; - } - } - else { - shared->tmFree[tmu] = range; - } -} - - -static void -RemoveRange(fxMesaContext fxMesa, FxU32 tmu, MemRange *range) -{ - struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - _glthread_LOCK_MUTEX(mesaShared->Mutex); - RemoveRange_NoLock(fxMesa, tmu, range); - _glthread_UNLOCK_MUTEX(mesaShared->Mutex); -} - - -/* - * Allocate space for a texture image. - * <tmu> is the texture unit - * <texmemsize> is the number of bytes to allocate - */ -static MemRange * -AllocTexMem(fxMesaContext fxMesa, FxU32 tmu, FxU32 texmemsize) -{ - FxU32 startAddr = FindStartAddr(fxMesa, tmu, texmemsize); - if (startAddr == BAD_ADDRESS) { - return NULL; - } - else { - MemRange *range; - range = NewRangeNode(fxMesa, startAddr, startAddr + texmemsize); - return range; - } -} - - -/* - * Download (copy) the given texture data into the Voodoo's texture memory. - * The texture memory must have already been allocated. - * Called by fxTMMoveInTM_NoLock() and fxTMRestoreTextures(). - */ -static void -DownloadTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj) -{ - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - int i, l; - FxU32 targetTMU; - - assert(tObj); - assert(ti); - - targetTMU = ti->whichTMU; - - switch (targetTMU) { - case FX_TMU0: - case FX_TMU1: - if (ti->tm[targetTMU]) { - for (i = FX_largeLodValue(ti->info), l = ti->minLevel; - i <= FX_smallLodValue(ti->info); i++, l++) - FX_grTexDownloadMipMapLevel_NoLock(targetTMU, - ti->tm[targetTMU]->startAddr, - FX_valueToLod(i), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, - ti->mipmapLevel[l].data); - } - break; - case FX_TMU_SPLIT: - if (ti->tm[FX_TMU0] && ti->tm[FX_TMU1]) { - for (i = FX_largeLodValue(ti->info), l = ti->minLevel; - i <= FX_smallLodValue(ti->info); i++, l++) { - FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, - ti->tm[FX_TMU0]->startAddr, - FX_valueToLod(i), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_ODD, - ti->mipmapLevel[l].data); - - FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, - ti->tm[FX_TMU1]->startAddr, - FX_valueToLod(i), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_EVEN, - ti->mipmapLevel[l].data); - } - } - break; - case FX_TMU_BOTH: - if (ti->tm[FX_TMU0] && ti->tm[FX_TMU1]) { - for (i = FX_largeLodValue(ti->info), l = ti->minLevel; - i <= FX_smallLodValue(ti->info); i++, l++) { - FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, - ti->tm[FX_TMU0]->startAddr, - FX_valueToLod(i), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, - ti->mipmapLevel[l].data); - - FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, - ti->tm[FX_TMU1]->startAddr, - FX_valueToLod(i), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, - ti->mipmapLevel[l].data); - } - } - break; - default: - fprintf(stderr, - "fx Driver: internal error in DownloadTexture -> bad tmu (%d)\n", - (int) targetTMU); - return; /* used to abort here */ - } -} - - - -/* - * Allocate space for the given texture in texture memory then - * download (copy) it into that space. - */ -void -fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, - FxU32 targetTMU) -{ - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - FxU32 texmemsize; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxTMMoveInTM(%d)\n", tObj->Name); - } - - fxMesa->stats.reqTexUpload++; - - if (!ti->validated) { - gl_problem(NULL, - "fx Driver: internal error in fxTMMoveInTM() -> not validated\n"); - return; /* used to abort here */ - } - - if (ti->isInTM) { - if (ti->whichTMU == targetTMU) - return; - if (targetTMU == FX_TMU_SPLIT || ti->whichTMU == FX_TMU_SPLIT) { - fxTMMoveOutTM_NoLock(fxMesa, tObj); - } - else { - if (ti->whichTMU == FX_TMU_BOTH) - return; - targetTMU = FX_TMU_BOTH; - } - } - - if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) { - fprintf(stderr, - "fxmesa: downloading %x (%d) in texture memory in %d\n", - tObj, tObj->Name, (int) targetTMU); - } - - ti->whichTMU = targetTMU; - - switch (targetTMU) { - case FX_TMU0: - case FX_TMU1: - texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, - &(ti->info)); - ti->tm[targetTMU] = AllocTexMem(fxMesa, targetTMU, texmemsize); - DownloadTexture(fxMesa, tObj); - break; - case FX_TMU_SPLIT: - texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD, - &(ti->info)); - ti->tm[FX_TMU0] = AllocTexMem(fxMesa, FX_TMU0, texmemsize); - if (ti->tm[FX_TMU0]) - fxMesa->stats.memTexUpload += texmemsize; - - texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_EVEN, - &(ti->info)); - ti->tm[FX_TMU1] = AllocTexMem(fxMesa, FX_TMU1, texmemsize); - DownloadTexture(fxMesa, tObj); - break; - case FX_TMU_BOTH: - texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, - &(ti->info)); - ti->tm[FX_TMU0] = AllocTexMem(fxMesa, FX_TMU0, texmemsize); - if (ti->tm[FX_TMU0]) - fxMesa->stats.memTexUpload += texmemsize; - - texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, - &(ti->info)); - ti->tm[FX_TMU1] = AllocTexMem(fxMesa, FX_TMU1, texmemsize); - DownloadTexture(fxMesa, tObj); - break; - default: - fprintf(stderr, - "fx Driver: internal error in fxTMMoveInTM() -> bad tmu (%d)\n", - (int) targetTMU); - return; /* used to abort here */ - } - - fxMesa->stats.texUpload++; - - ti->isInTM = GL_TRUE; -} - - -void -fxTMMoveInTM(fxMesaContext fxMesa, struct gl_texture_object *tObj, - FxU32 targetTMU) -{ - BEGIN_BOARD_LOCK(fxMesa); - fxTMMoveInTM_NoLock(fxMesa, tObj, targetTMU); - END_BOARD_LOCK(fxMesa); -} - - -void -fxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, - GLint level) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - GrLOD_t lodlevel; - FxU32 tmu; - - if (!ti->validated) { - gl_problem(ctx, "internal error in fxTMReloadMipMapLevel() -> not validated\n"); - return; - } - - tmu = ti->whichTMU; - fxTMMoveInTM(fxMesa, tObj, tmu); - - fxTexGetInfo(ctx, ti->mipmapLevel[0].width, ti->mipmapLevel[0].height, - &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - -#ifdef FX_GLIDE3 - lodlevel -= level; -#else - lodlevel += level; -#endif - switch (tmu) { - case FX_TMU0: - case FX_TMU1: - FX_grTexDownloadMipMapLevel(fxMesa, tmu, - ti->tm[tmu]->startAddr, - FX_valueToLod(FX_lodToValue(lodlevel)), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, - ti->mipmapLevel[level].data); - break; - case FX_TMU_SPLIT: - FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU0, - ti->tm[GR_TMU0]->startAddr, - FX_valueToLod(FX_lodToValue(lodlevel)), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_ODD, - ti->mipmapLevel[level].data); - - FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU1, - ti->tm[GR_TMU1]->startAddr, - FX_valueToLod(FX_lodToValue(lodlevel)), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_EVEN, - ti->mipmapLevel[level].data); - break; - case FX_TMU_BOTH: - FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU0, - ti->tm[GR_TMU0]->startAddr, - FX_valueToLod(FX_lodToValue(lodlevel)), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, - ti->mipmapLevel[level].data); - - FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU1, - ti->tm[GR_TMU1]->startAddr, - FX_valueToLod(FX_lodToValue(lodlevel)), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, - ti->mipmapLevel[level].data); - break; - - default: - fprintf(stderr, - "fx Driver: internal error in fxTMReloadMipMapLevel() -> wrong tmu (%d)\n", - (int) tmu); - break; - } -} - -#if 0 -/* - * This doesn't work. It can't work for compressed textures. - */ -void -fxTMReloadSubMipMapLevel(GLcontext *ctx, - struct gl_texture_object *tObj, - GLint level, GLint yoffset, GLint height) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - GrLOD_t lodlevel; - unsigned short *data; - GLint tmu; - - if (!ti->validated) { - gl_problem(ctx, "fx Driver: internal error in fxTMReloadSubMipMapLevel() -> not validated\n"); - return; - } - - tmu = (int) ti->whichTMU; - fxTMMoveInTM(fxMesa, tObj, tmu); - - fxTexGetInfo(ctx, ti->mipmapLevel[0].width, ti->mipmapLevel[0].height, - &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - data = ti->mipmapLevel[level].data + - yoffset * ti->mipmapLevel[level].width * - ti->mipmapLevel[level].texelSize; - - switch (tmu) { - case FX_TMU0: - case FX_TMU1: - FX_grTexDownloadMipMapLevelPartial(fxMesa, tmu, - ti->tm[tmu]->startAddr, - FX_valueToLod(FX_lodToValue - (lodlevel) + level), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, data, - yoffset, yoffset + height - 1); - break; - case FX_TMU_SPLIT: - FX_grTexDownloadMipMapLevelPartial(fxMesa, GR_TMU0, - ti->tm[FX_TMU0]->startAddr, - FX_valueToLod(FX_lodToValue - (lodlevel) + level), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_ODD, data, - yoffset, yoffset + height - 1); - - FX_grTexDownloadMipMapLevelPartial(fxMesa, GR_TMU1, - ti->tm[FX_TMU1]->startAddr, - FX_valueToLod(FX_lodToValue - (lodlevel) + level), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_EVEN, data, - yoffset, yoffset + height - 1); - break; - case FX_TMU_BOTH: - FX_grTexDownloadMipMapLevelPartial(fxMesa, GR_TMU0, - ti->tm[FX_TMU0]->startAddr, - FX_valueToLod(FX_lodToValue - (lodlevel) + level), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, data, - yoffset, yoffset + height - 1); - - FX_grTexDownloadMipMapLevelPartial(fxMesa, GR_TMU1, - ti->tm[FX_TMU1]->startAddr, - FX_valueToLod(FX_lodToValue - (lodlevel) + level), - FX_largeLodLog2(ti->info), - FX_aspectRatioLog2(ti->info), - ti->info.format, - GR_MIPMAPLEVELMASK_BOTH, data, - yoffset, yoffset + height - 1); - break; - default: - fprintf(stderr, - "fx Driver: internal error in fxTMReloadSubMipMapLevel() -> wrong tmu (%d)\n", - tmu); - return; - } -} -#endif - - -/* - * Move the given texture out of hardware texture memory. - * This deallocates the texture's memory space. - */ -void -fxTMMoveOutTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj) -{ - struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxTMMoveOutTM(%x (%d))\n", - tObj, tObj->Name); - } - - if (!ti->isInTM) - return; - - switch (ti->whichTMU) { - case FX_TMU0: - case FX_TMU1: - RemoveRange_NoLock(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]); - break; - case FX_TMU_SPLIT: - case FX_TMU_BOTH: - assert(!shared->umaTexMemory); - RemoveRange_NoLock(fxMesa, FX_TMU0, ti->tm[FX_TMU0]); - RemoveRange_NoLock(fxMesa, FX_TMU1, ti->tm[FX_TMU1]); - break; - default: - fprintf(stderr, "fx Driver: internal error in fxTMMoveOutTM()\n"); - return; - } - - ti->isInTM = GL_FALSE; - ti->whichTMU = FX_TMU_NONE; -} - -void -fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj) -{ - struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxTMMoveOutTM(%x (%d))\n", - tObj, tObj->Name); - } - - if (!ti->isInTM) - return; - - switch (ti->whichTMU) { - case FX_TMU0: - case FX_TMU1: - RemoveRange(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]); - break; - case FX_TMU_SPLIT: - case FX_TMU_BOTH: - assert(!shared->umaTexMemory); - RemoveRange(fxMesa, FX_TMU0, ti->tm[FX_TMU0]); - RemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]); - break; - default: - fprintf(stderr, "fx Driver: internal error in fxTMMoveOutTM()\n"); - return; - } - - ti->isInTM = GL_FALSE; - ti->whichTMU = FX_TMU_NONE; -} - - -/* - * Called via glDeleteTexture to delete a texture object. - */ -void -fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj) -{ - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - if (ti) { - int i; - fxTMMoveOutTM(fxMesa, tObj); - for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { - if (ti->mipmapLevel[i].data) { - FREE(ti->mipmapLevel[i].data); - ti->mipmapLevel[i].data = NULL; - } - } - FREE(ti); - tObj->DriverData = NULL; - } -} - - -/* - * Initialize texture memory. - * We take care of one or both TMU's here. - */ -void -fxTMInit(fxMesaContext fxMesa) -{ - if (!fxMesa->glCtx->Shared->DriverData) { - const char *extensions; - struct TdfxSharedState *shared = CALLOC_STRUCT(TdfxSharedState); - if (!shared) - return; - - extensions = FX_grGetString(fxMesa, GR_EXTENSION); - if (strstr(extensions, "TEXUMA")) { - FxU32 start, end; - shared->umaTexMemory = GL_TRUE; - FX_grEnable(fxMesa, GR_TEXTURE_UMA_EXT); - start = FX_grTexMinAddress(fxMesa, 0); - end = FX_grTexMaxAddress(fxMesa, 0); - shared->totalTexMem[0] = end - start; - shared->totalTexMem[1] = 0; - shared->freeTexMem[0] = end - start; - shared->tmFree[0] = NewRangeNode(fxMesa, start, end); - /*printf("UMA tex memory: %d\n", (int) (end - start));*/ - } - else { - const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1; - int tmu; - shared->umaTexMemory = GL_FALSE; - for (tmu = 0; tmu < numTMUs; tmu++) { - FxU32 start = FX_grTexMinAddress(fxMesa, tmu); - FxU32 end = FX_grTexMaxAddress(fxMesa, tmu); - shared->totalTexMem[tmu] = end - start; - shared->freeTexMem[tmu] = end - start; - shared->tmFree[tmu] = NewRangeNode(fxMesa, start, end); - /*printf("Split tex memory: %d\n", (int) (end - start));*/ - } - } - - shared->tmPool = NULL; - fxMesa->glCtx->Shared->DriverData = shared; - /*printf("Texture memory init UMA: %d\n", shared->umaTexMemory);*/ - } -} - - -/* - * Clean-up texture memory before destroying context. - */ -void -fxTMClose(fxMesaContext fxMesa) -{ - if (fxMesa->glCtx->Shared->RefCount == 1) { - /* refcount will soon go to zero, free our 3dfx stuff */ - struct TdfxSharedState *shared = (struct TdfxSharedState *) fxMesa->glCtx->Shared->DriverData; - - const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1; - int tmu; - MemRange *tmp, *next; - - /* Deallocate the pool of free MemRange nodes */ - tmp = shared->tmPool; - while (tmp) { - next = tmp->next; - FREE(tmp); - tmp = next; - } - - /* Delete the texture memory block MemRange nodes */ - for (tmu = 0; tmu < numTMUs; tmu++) { - tmp = shared->tmFree[tmu]; - while (tmp) { - next = tmp->next; - FREE(tmp); - tmp = next; - } - } - - FREE(shared); - fxMesa->glCtx->Shared->DriverData = NULL; - } -} - - -/* - * After a context switch this function will be called to restore - * texture memory for the new context. - */ -void -fxTMRestoreTextures_NoLock(fxMesaContext ctx) -{ - struct gl_texture_object *tObj; - - for (tObj = ctx->glCtx->Shared->TexObjectList; tObj; tObj = tObj->Next) { - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - if (ti && ti->isInTM) { - int i; - for (i = 0; i < MAX_TEXTURE_UNITS; i++) { - if (ctx->glCtx->Texture.Unit[i].Current == tObj) { - DownloadTexture(ctx, tObj); - break; - } - } - if (i == MAX_TEXTURE_UNITS) { - fxTMMoveOutTM_NoLock(ctx, tObj); - } - } - } -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h b/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h deleted file mode 100644 index c9af7ae48..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h +++ /dev/null @@ -1,29 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -#ifndef FXTEXMAN_H -#define FXTEXMAN_H - - -#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData)) - -extern void fxTMReloadMipMapLevel(GLcontext *, struct gl_texture_object *, - GLint); -extern void fxTMReloadSubMipMapLevel(GLcontext *, - struct gl_texture_object *, GLint, GLint, - GLint); - -extern void fxTMInit(fxMesaContext ctx); - -extern void fxTMClose(fxMesaContext ctx); - -extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx); - -extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, FxU32); - -extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *); - -extern void fxTMMoveOutTM_NoLock(fxMesaContext, struct gl_texture_object *); - -extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *); - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c b/xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c deleted file mode 100644 index 0980a7ad7..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c +++ /dev/null @@ -1,365 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c,v 1.1 2000/09/24 13:51:20 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxtris.c - 3Dfx VooDoo triangle functions */ - - -#include "fxdrv.h" -#include "../mmath.h" - - - -/* Is this enough? Do we need more triangle funcs? - */ -static triangle_func tri_tab[0x40]; /* only 0x20 actually used */ -static quad_func quad_tab[0x40]; /* only 0x20 actually used */ -static line_func line_tab[0x40]; /* less than 0x20 used */ -static points_func points_tab[0x40]; /* less than 0x20 used */ - -#define IND (0) -#define TAG(x) x -#include "fxtritmp.h" - -#define IND (FX_OFFSET) -#define TAG(x) x##_offset -#include "fxtritmp.h" - -#define IND (FX_TWOSIDE) -#define TAG(x) x##_twoside -#include "fxtritmp.h" - -#define IND (FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK) -#define TAG(x) x##_front_back -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_front_back_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT) -#define TAG(x) x##_flat -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_OFFSET) -#define TAG(x) x##_flat_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_TWOSIDE) -#define TAG(x) x##_flat_twoside -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_flat_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK) -#define TAG(x) x##_flat_front_back -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_flat_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_flat_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_flat_front_back_twoside_offset -#include "fxtritmp.h" - -/* We don't actually do antialiasing correctly. Geometry has to be - sorted for glide's antialiasing to operate */ -#if 0 -#define IND (FX_ANTIALIAS) -#define TAG(x) x##_aa -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_OFFSET) -#define TAG(x) x##_aa_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_TWOSIDE) -#define TAG(x) x##_aa_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK) -#define TAG(x) x##_aa_front_back -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_aa_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_aa_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_front_back_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT) -#define TAG(x) x##_aa_flat -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_OFFSET) -#define TAG(x) x##_aa_flat_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_TWOSIDE) -#define TAG(x) x##_aa_flat_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_flat_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK) -#define TAG(x) x##_aa_flat_front_back -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_aa_flat_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_aa_flat_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_flat_front_back_twoside_offset -#include "fxtritmp.h" -#endif - -void -fxDDTrifuncInit() -{ - init(); - init_offset(); - init_twoside(); - init_twoside_offset(); - init_front_back(); - init_front_back_offset(); - init_front_back_twoside(); - init_front_back_twoside_offset(); - init_flat(); - init_flat_offset(); - init_flat_twoside(); - init_flat_twoside_offset(); - init_flat_front_back(); - init_flat_front_back_offset(); - init_flat_front_back_twoside(); - init_flat_front_back_twoside_offset(); -#if 0 - init_aa(); - init_aa_offset(); - init_aa_twoside(); - init_aa_twoside_offset(); - init_aa_front_back(); - init_aa_front_back_offset(); - init_aa_front_back_twoside(); - init_aa_front_back_twoside_offset(); - init_aa_flat(); - init_aa_flat_offset(); - init_aa_flat_twoside(); - init_aa_flat_twoside_offset(); - init_aa_flat_front_back(); - init_aa_flat_front_back_offset(); - init_aa_flat_front_back_twoside(); - init_aa_flat_front_back_twoside_offset(); -#endif -} - -void -fxPrintRenderState(const char *msg, GLuint state) -{ - fprintf(stderr, "%s: (%x) %s%s%s%s%s%s\n", - msg, state, - (state & FX_ANTIALIAS) ? "antialias, " : "", - (state & FX_FLAT) ? "flat, " : "", - (state & FX_TWOSIDE) ? "twoside, " : "", - (state & FX_OFFSET) ? "offset, " : "", - (state & FX_FRONT_BACK) ? "front-back, " : "", - (state & FX_FALLBACK) ? "fallback" : ""); -} - - -void -fxPrintHintState(const char *msg, GLuint state) -{ - fprintf(stderr, "%s: (%x) %s %s%s %s%s\n", - msg, state, - (state & GR_STWHINT_W_DIFF_FBI) ? "w-fbi, " : "", - (state & GR_STWHINT_W_DIFF_TMU0) ? "w-tmu0, " : "", - (state & GR_STWHINT_ST_DIFF_TMU0) ? "st-tmu0, " : "", - (state & GR_STWHINT_W_DIFF_TMU1) ? "w-tmu1, " : "", - (state & GR_STWHINT_ST_DIFF_TMU1) ? "st-tmu1, " : ""); - -} - - -void -fxDDChooseRenderState(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint ind = 0; - GLuint flags = ctx->TriangleCaps; - - ctx->IndirectTriangles &= ~DD_SW_RASTERIZE; - - if (flags) { - if (fxMesa->render_index & FX_OFFSET) - FX_grDepthBiasLevel(fxMesa, 0); - - if (flags & (DD_SELECT | DD_FEEDBACK)) { - fxMesa->PointsFunc = 0; - fxMesa->LineFunc = 0; - fxMesa->TriangleFunc = 0; - fxMesa->QuadFunc = 0; - fxMesa->render_index = FX_FALLBACK; - ctx->IndirectTriangles |= DD_SW_RASTERIZE; -#if 0 - fprintf(stderr, "Fallback select|feeback\n"); -#endif - return; - } - - if (flags & DD_FLATSHADE) - ind |= FX_FLAT; - if (flags & DD_TRI_LIGHT_TWOSIDE) - ind |= FX_TWOSIDE; -#if 000 - /* XXX this is rather broken, don't use it. */ - if (flags & DD_MULTIDRAW) - ind |= FX_FRONT_BACK; -#else - if (flags & DD_MULTIDRAW) - ctx->IndirectTriangles |= DD_SW_RASTERIZE; -#endif - - if (flags & (DD_POINT_ATTEN | DD_POINT_SMOOTH)) { - ind |= FX_FALLBACK; -#if 0 - if (flags & DD_POINT_ATTEN) - fprintf(stderr, "Fallback point atten\n"); - if (flags & DD_POINT_SMOOTH) - fprintf(stderr, "Fallback point smooth\n"); -#endif - } - - fxMesa->render_index = ind; - fxMesa->PointsFunc = points_tab[ind]; - if (ind & FX_FALLBACK) - ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE; - ind &= ~(FX_ANTIALIAS | FX_FALLBACK); - - if (flags & (DD_LINE_STIPPLE | DD_LINE_SMOOTH)) { - ind |= FX_FALLBACK; -#if 0 - if (flags & DD_LINE_STIPPLE) - fprintf(stderr, "Fallback line stipple\n"); - if (flags & DD_LINE_SMOOTH) - fprintf(stderr, "Fallback line smooth\n"); -#endif - } - - fxMesa->render_index |= ind; - fxMesa->LineFunc = line_tab[ind]; - if (ind & FX_FALLBACK) - ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE; - ind &= ~(FX_ANTIALIAS | FX_FALLBACK); - - if (flags & DD_TRI_OFFSET) - ind |= FX_OFFSET; - if (flags & (DD_TRI_UNFILLED | DD_TRI_STIPPLE | DD_TRI_SMOOTH)) { - ind |= FX_FALLBACK; -#if 0 - if (flags & DD_TRI_UNFILLED) - fprintf(stderr, "Fallback tri unfilled\n"); - if (flags & DD_TRI_STIPPLE) - fprintf(stderr, "Fallback tri stippled\n"); - if (flags & DD_TRI_SMOOTH) - fprintf(stderr, "Fallback tri smooth\n"); -#endif - } - - fxMesa->render_index |= ind; - fxMesa->TriangleFunc = tri_tab[ind]; - fxMesa->QuadFunc = quad_tab[ind]; - - if (ind & FX_FALLBACK) - ctx->IndirectTriangles |= - DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE; - } - else if (fxMesa->render_index) { - if (fxMesa->render_index & FX_OFFSET) - FX_grDepthBiasLevel(fxMesa, 0); - - fxMesa->render_index = 0; - fxMesa->PointsFunc = points_tab[0]; - fxMesa->LineFunc = line_tab[0]; - fxMesa->TriangleFunc = tri_tab[0]; - fxMesa->QuadFunc = quad_tab[0]; - } - - if (MESA_VERBOSE & (VERBOSE_STATE | VERBOSE_DRIVER)) - fxPrintRenderState("fxmesa: Render state", fxMesa->render_index); -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h deleted file mode 100644 index d7fa30792..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h +++ /dev/null @@ -1,441 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h,v 1.3 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -static void TAG(fx_tri) (GLcontext * ctx, GLuint e1, GLuint e2, GLuint e3, - GLuint pv) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GrVertex *v1 = (GrVertex *) gWin[e1].f; - GrVertex *v2 = (GrVertex *) gWin[e2].f; - GrVertex *v3 = (GrVertex *) gWin[e3].f; - - (void) fxMesa; - - if (IND & (FX_TWOSIDE | FX_OFFSET)) { - GLfloat ex = v1->x - v3->x; - GLfloat ey = v1->y - v3->y; - GLfloat fx = v2->x - v3->x; - GLfloat fy = v2->y - v3->y; - GLfloat c = ex * fy - ey * fx; - - if (IND & FX_TWOSIDE) { - GLuint facing = (c < 0.0) ^ ctx->Polygon.FrontBit; - GLubyte(*color)[4] = VB->Color[facing]->data; - if (IND & FX_FLAT) { - GOURAUD2(v1, color[pv]); - GOURAUD2(v2, color[pv]); - GOURAUD2(v3, color[pv]); - } - else { - GOURAUD2(v1, color[e1]); - GOURAUD2(v2, color[e2]); - GOURAUD2(v3, color[e3]); - } - } - - /* Should apply a factor to ac to compensate for different x/y - * scaling introduced in the Viewport matrix. - * - * The driver should supply scaling factors for 'factor' and 'units'. - */ - if (IND & FX_OFFSET) { - GLfloat offset = ctx->Polygon.OffsetUnits; - - if (c * c > 1e-16) { - GLfloat factor = ctx->Polygon.OffsetFactor; - GLfloat ez = v1->ooz - v3->ooz; - GLfloat fz = v2->ooz - v3->ooz; - GLfloat a = ey * fz - ez * fy; - GLfloat b = ez * fx - ex * fz; - GLfloat ic = 1.0 / c; - GLfloat ac = a * ic; - GLfloat bc = b * ic; - if (ac < 0.0F) - ac = -ac; - if (bc < 0.0F) - bc = -bc; - offset += MAX2(ac, bc) * factor; - } - /* Probably a lot quicker just to nudge the z values and put - * them back afterwards. - */ - FX_grDepthBiasLevel(fxMesa, (int) offset); - } - } - else if (IND & FX_FLAT) { - GLubyte(*color)[4] = VB->Color[0]->data; - GOURAUD2(v1, color[pv]); - GOURAUD2(v2, color[pv]); - GOURAUD2(v3, color[pv]); - } - - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - FX_grDepthMask(fxMesa, FXFALSE); - FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER); - } - - if (IND & FX_ANTIALIAS) - FX_grAADrawTriangle(fxMesa, v1, v2, v3, FXTRUE, FXTRUE, FXTRUE); - else - FX_grDrawTriangle(fxMesa, v1, v2, v3); - - /* Might be quicker to do two passes, one for each buffer? - */ - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - - if (ctx->Depth.Mask) - FX_grDepthMask(fxMesa, FXTRUE); - - FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER); - - if (IND & FX_ANTIALIAS) - FX_grAADrawTriangle(fxMesa, v1, v2, v3, FXTRUE, FXTRUE, FXTRUE); - else - FX_grDrawTriangle(fxMesa, v1, v2, v3); - } -} - - -/* Not worth the space? - */ -static void TAG(fx_quad) (GLcontext * ctx, GLuint e1, GLuint e2, GLuint e3, - GLuint e4, GLuint pv) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GrVertex *v1 = (GrVertex *) gWin[e1].f; - GrVertex *v2 = (GrVertex *) gWin[e2].f; - GrVertex *v3 = (GrVertex *) gWin[e3].f; - GrVertex *v4 = (GrVertex *) gWin[e4].f; - - (void) fxMesa; - - if (IND & (FX_TWOSIDE | FX_OFFSET)) { - GLfloat ex = v3->x - v1->x; - GLfloat ey = v3->y - v1->y; - GLfloat fx = v4->x - v2->x; - GLfloat fy = v4->y - v2->y; - GLfloat c = ex * fy - ey * fx; - - if (IND & FX_TWOSIDE) { - GLuint facing = (c < 0.0) ^ ctx->Polygon.FrontBit; - GLubyte(*color)[4] = VB->Color[facing]->data; - if (IND & FX_FLAT) { - GOURAUD2(v1, color[pv]); - GOURAUD2(v2, color[pv]); - GOURAUD2(v3, color[pv]); - GOURAUD2(v4, color[pv]); - } - else { - GOURAUD2(v1, color[e1]); - GOURAUD2(v2, color[e2]); - GOURAUD2(v3, color[e3]); - GOURAUD2(v4, color[e4]); - } - } - - /* Should apply a factor to ac to compensate for different x/y - * scaling introduced in the Viewport matrix. - * - * The driver should supply scaling factors for 'factor' and 'units'. - */ - if (IND & FX_OFFSET) { - GLfloat offset = ctx->Polygon.OffsetUnits; - - if (c * c > 1e-16) { - GLfloat factor = ctx->Polygon.OffsetFactor; - GLfloat ez = v3->ooz - v1->ooz; - GLfloat fz = v4->ooz - v2->ooz; - GLfloat a = ey * fz - ez * fy; - GLfloat b = ez * fx - ex * fz; - GLfloat ic = 1.0 / c; - GLfloat ac = a * ic; - GLfloat bc = b * ic; - if (ac < 0.0F) - ac = -ac; - if (bc < 0.0F) - bc = -bc; - offset += MAX2(ac, bc) * factor; - } - /* Probably a lot quicker just to nudge the z values and put - * them back afterwards. - */ - FX_grDepthBiasLevel(fxMesa, (int) offset); - } - } - else if (IND & FX_FLAT) { - GLubyte(*color)[4] = VB->Color[0]->data; - GOURAUD2(v1, color[pv]); - GOURAUD2(v2, color[pv]); - GOURAUD2(v3, color[pv]); - GOURAUD2(v4, color[pv]); - } - - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - FX_grDepthMask(fxMesa, FXFALSE); - FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER); - } - - if (IND & FX_ANTIALIAS) { - FX_grAADrawTriangle(fxMesa, v1, v2, v4, FXTRUE, FXTRUE, FXTRUE); - FX_grAADrawTriangle(fxMesa, v2, v3, v4, FXTRUE, FXTRUE, FXTRUE); - } - else { - FX_grDrawTriangle(fxMesa, v1, v2, v4); - FX_grDrawTriangle(fxMesa, v2, v3, v4); - } - - /* Might be quicker to do two passes, one for each buffer? - */ - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - - if (ctx->Depth.Mask) - FX_grDepthMask(fxMesa, FXTRUE); - - FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER); - - if (IND & FX_ANTIALIAS) { - FX_grAADrawTriangle(fxMesa, v1, v2, v4, FXTRUE, FXTRUE, FXTRUE); - FX_grAADrawTriangle(fxMesa, v2, v3, v4, FXTRUE, FXTRUE, FXTRUE); - } - else { - FX_grDrawTriangle(fxMesa, v1, v2, v4); - FX_grDrawTriangle(fxMesa, v2, v3, v4); - } - } -} - -#define DRAW_LINE(fxMesa, tmp0, tmp1, width) \ - if (width <= 1.0) { \ - FX_grDrawLine(fxMesa, tmp0, tmp1); \ - } \ - else { \ - GrVertex verts[4]; \ - float dx, dy, ix, iy; \ - \ - dx = tmp0->x - tmp1->x; \ - dy = tmp0->y - tmp1->y; \ - \ - if (dx * dx > dy * dy) { \ - iy = width * .5; \ - ix = 0; \ - } \ - else { \ - iy = 0; \ - ix = width * .5; \ - } \ - \ - verts[0] = *tmp0; \ - verts[1] = *tmp0; \ - verts[2] = *tmp1; \ - verts[3] = *tmp1; \ - \ - verts[0].x = tmp0->x - ix; \ - verts[0].y = tmp0->y - iy; \ - \ - verts[1].x = tmp0->x + ix; \ - verts[1].y = tmp0->y + iy; \ - \ - verts[2].x = tmp1->x + ix; \ - verts[2].y = tmp1->y + iy; \ - \ - verts[3].x = tmp1->x - ix; \ - verts[3].y = tmp1->y - iy; \ - \ - FX_grDrawPolygonVertexList(fxMesa, 4, verts); \ - } - - -#if (IND & FX_OFFSET) == 0 -static void TAG(fx_line) (GLcontext * ctx, GLuint e1, GLuint e2, GLuint pv) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLubyte(*const color)[4] = VB->ColorPtr->data; - GrVertex *v1 = (GrVertex *) gWin[e1].f; - GrVertex *v2 = (GrVertex *) gWin[e2].f; - GLfloat w = ctx->Line.Width * .5; - - if (IND & FX_FLAT) { - GOURAUD2(v1, color[pv]); - GOURAUD2(v2, color[pv]); - } - else if (IND & FX_TWOSIDE) { - /* XXX use signed area of the polygon to determine front/back color choice */ - GOURAUD2(v1, color[e1]); - GOURAUD2(v2, color[e2]); - } - - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - FX_grDepthMask(fxMesa, FXFALSE); - FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER); - } - - if (IND & FX_ANTIALIAS) - FX_grAADrawLine(fxMesa, v1, v2); - else - DRAW_LINE(fxMesa, v1, v2, w); - - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - - if (ctx->Depth.Mask) - FX_grDepthMask(fxMesa, FXTRUE); - - FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER); - - if (IND & FX_ANTIALIAS) - FX_grAADrawLine(fxMesa, v1, v2); - else - DRAW_LINE(fxMesa, v1, v2, w); - } -} -#endif - - -#if (IND & FX_OFFSET) == 0 - -/* - * Draw large points (size > 1) with a polygon. - */ -#define DRAW_POINT(i, radius, color) \ - do { \ - GrVertex verts[4], *tmp; \ - tmp = (GrVertex *) gWin[i].f; \ - GOURAUD2(tmp, color); \ - verts[0] = *tmp; \ - verts[1] = *tmp; \ - verts[2] = *tmp; \ - verts[3] = *tmp; \ - verts[0].x = verts[3].x = tmp->x + radius; \ - verts[0].y = verts[1].y = tmp->y + radius; \ - verts[2].x = verts[1].x = tmp->x - radius; \ - verts[2].y = verts[3].y = tmp->y - radius; \ - FX_grDrawPolygonVertexList(fxMesa, 4, verts); \ - } while (0) - - -static void TAG(fx_points) (GLcontext * ctx, GLuint first, GLuint last) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - const struct vertex_buffer *VB = ctx->VB; - const fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLubyte (*color)[4] = VB->ColorPtr->data; - GLuint i; - const GLfloat radius = ctx->Point.Size * .5; - - (void) color; - (void) fxMesa; - - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - FX_grDepthMask(fxMesa, FXFALSE); - FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER); - } - - if (!VB->ClipOrMask) { - for (i = first; i < last; i++) { - DRAW_POINT(i, radius, color[i]); - } - } - else { - for (i = first; i < last; i++) { - if (VB->ClipMask[i] == 0) { - DRAW_POINT(i, radius, color[i]); - } - } - } - - if (IND & FX_FRONT_BACK) { - FX_grColorMaskv(ctx, ctx->Color.ColorMask); - if (ctx->Depth.Mask) - FX_grDepthMask(fxMesa, FXTRUE); - FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER); - - if (!VB->ClipOrMask) { - for (i = first; i < last; i++) { - DRAW_POINT(i, radius, color[i]); - } - } - else { - for (i = first; i < last; i++) { - if (VB->ClipMask[i] == 0) { - DRAW_POINT(i, radius, color[i]); - } - } - } - } -} - -#endif - - - -static void TAG(init) (void) -{ - tri_tab[IND] = TAG(fx_tri); - quad_tab[IND] = TAG(fx_quad); - -#if ((IND & FX_OFFSET) == 0) - line_tab[IND] = TAG(fx_line); - points_tab[IND] = TAG(fx_points); -#else - line_tab[IND] = line_tab[IND & ~FX_OFFSET]; - points_tab[IND] = points_tab[IND & ~FX_OFFSET]; -#endif -} - -#undef IND -#undef TAG -#undef FLAT_COLOR -#undef DRAW_POINT diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h deleted file mode 100644 index bc7621aa1..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h +++ /dev/null @@ -1,215 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h,v 1.1 2000/09/24 13:51:20 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#if (IND & (SETUP_XY|SETUP_W|SETUP_Z)) -#define V1 VARS_XY -#define I1 , INCR_XY -#else -#define V1 -#define I1 -#endif - -#if (IND & SETUP_XY) -#define S1 DO_SETUP_XY -#else -#define S1 -#endif - -#if (IND & SETUP_W) -#define S2 S1 DO_SETUP_W -#define V2 V1 VARS_W -#else -#define S2 S1 -#define V2 V1 -#endif - -#if (IND & SETUP_Z) -#define S3 S2 DO_SETUP_Z -#else -#define S3 S2 -#endif - -#if (IND & SETUP_RGBA) -#define V4 V2 VARS_RGBA -#define S4 S3 DO_SETUP_RGBA -#define I4 I1 , INCR_RGBA -#else -#define V4 V2 -#define S4 S3 -#define I4 I1 -#endif - -#if (IND & SETUP_TMU0) -#define V5 V4 VARS_TMU0 -#define S5 S4 DO_SETUP_TMU0 -#define I5 I4 , INCR_TMU0 -#define F5 FIXUP_TMU0 -#else -#define V5 V4 -#define S5 S4 -#define I5 I4 -#define F5 -#endif - -#if (IND & SETUP_TMU1) -#define V6 V5 VARS_TMU1 -#define S6 S5 DO_SETUP_TMU1 -#define I6 I5 , INCR_TMU1 -#define F6 F5 FIXUP_TMU1 -#else -#define V6 V5 -#define S6 S5 -#define I6 I5 -#define F6 F5 -#endif - -#if (IND & SETUP_TMU0) && (IND & SETUP_TMU1) -#define F7 FIXUP_TMU01 -#else -#define F7 F6 -#endif - -#define VARS V6 -#define DO_SETUP S6 -#define INCR I6 -#define FIXUP F7 - -static void -NAME(struct vertex_buffer *VB, GLuint start, GLuint end) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - { - const float snapper = (3L << 18); - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLfloat *v = gWin[start].f; - GLfloat *vend = gWin[end].f; - VARS; - - (void) gWin; - (void) fxMesa; - (void) snapper; - - if (VB->ClipOrMask) { - GLubyte *clipmask = &VB->ClipMask[start]; - for (; v != vend; v += 16, clipmask++ INCR) { - if (*clipmask == 0) { - DO_SETUP; - } - } - } - else { - for (; v != vend; v += 16 INCR) { - DO_SETUP; - } - } - - if (ctx->FogMode == FOG_FRAGMENT - && ctx->ProjectionMatrix.m[15] != 0.0F) { - /* need to compute W values for fogging purposes */ - const GLfloat m10 = ctx->ProjectionMatrix.m[10]; - const GLfloat m14 = ctx->ProjectionMatrix.m[14]; - const GLfloat v10 = ctx->Viewport.WindowMap.m[10]; - const GLfloat v14 = ctx->Viewport.WindowMap.m[14]; - GLfloat *v = gWin[start].f; - GLfloat *win = VB->Win.data[start]; - if (VB->ClipOrMask) { - GLubyte *clipmask = &VB->ClipMask[start]; - for (; v != vend; v += 16, clipmask++, win += 4) { - if (*clipmask == 0) { - GLfloat zNDC = (win[2] - v14) / v10; - GLfloat zEye = (zNDC - m14) / m10; - v[OOWCOORD] = -1.0F / zEye; - } - } - } - else { - for (; v != vend; v += 16, win += 4) { - GLfloat zNDC = (win[2] - v14) / v10; - GLfloat zEye = (zNDC - m14) / m10; - v[OOWCOORD] = -1.0F / zEye; - } - } - } - - /* rare - I hope */ - FIXUP; - } -} - - -#undef V1 -#undef V2 -#undef V3 -#undef V4 -#undef V5 -#undef V6 -#undef VARS - -#undef S1 -#undef S2 -#undef S3 -#undef S4 -#undef S5 -#undef S6 -#undef DO_SETUP - -#undef I1 -#undef I4 -#undef I5 -#undef I6 -#undef INCR - -#undef F5 -#undef F6 -#undef F7 -#undef FIXUP - - -#undef IND -#undef NAME diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c b/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c deleted file mode 100644 index eb26fbaca..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c +++ /dev/null @@ -1,578 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxvsetup.c - 3Dfx VooDoo vertices setup functions */ - - -#include "fxdrv.h" -#include "fxtexman.h" -#include "fxsetup.h" -#include "mmath.h" -#include "pipeline.h" -#include "fxvsetup.h" - - -void -fxPrintSetupFlags(const char *msg, GLuint flags) -{ - fprintf(stderr, "%s: %d %s%s%s%s%s%s\n", - msg, - flags, - (flags & SETUP_XY) ? " xy," : "", - (flags & SETUP_Z) ? " z," : "", - (flags & SETUP_W) ? " w," : "", - (flags & SETUP_RGBA) ? " rgba," : "", - (flags & SETUP_TMU0) ? " tmu0," : "", - (flags & SETUP_TMU1) ? " tmu1," : ""); -} - -static void -project_texcoords(struct vertex_buffer *VB, - GLuint tmu_nr, GLuint tc_nr, GLuint start, GLuint count) -{ - fxVertex *v = FX_DRIVER_DATA(VB)->verts + start; - GrTmuVertex *tmu = &(((GrVertex *) v->f)->tmuvtx[tmu_nr]); - GLvector4f *vec = VB->TexCoordPtr[tc_nr]; - - GLuint i; - GLuint stride = vec->stride; - GLfloat *data = VEC_ELT(vec, GLfloat, start); - - for (i = start; i < count; i++, STRIDE_F(data, stride), v++) { - tmu->oow = v->f[OOWCOORD] * data[3]; - tmu = (GrTmuVertex *) ((char *) tmu + sizeof(fxVertex)); - } -} - - -static void -copy_w(struct vertex_buffer *VB, GLuint tmu_nr, GLuint start, GLuint count) -{ - fxVertex *v = FX_DRIVER_DATA(VB)->verts + start; - GrTmuVertex *tmu = &(((GrVertex *) v->f)->tmuvtx[tmu_nr]); - GLuint i; - - for (i = start; i < count; i++, v++) { - tmu->oow = v->f[OOWCOORD]; - tmu = (GrTmuVertex *) ((char *) tmu + sizeof(fxVertex)); - } -} - - -static tfxSetupFunc setupfuncs[0x40]; - - - - -#define IND SETUP_XY -#define NAME fxsetupXY -#include "fxvs_tmp.h" - -#define IND (SETUP_XY|SETUP_Z) -#define NAME fxsetupXYZ -#include "fxvs_tmp.h" - -#define IND (SETUP_XY|SETUP_W) -#define NAME fxsetupXYW -#include "fxvs_tmp.h" - -#define IND (SETUP_XY|SETUP_Z|SETUP_W) -#define NAME fxsetupXYZW -#include "fxvs_tmp.h" - -#define IND (SETUP_RGBA|SETUP_XY) -#define NAME fxsetupXYRGBA -#include "fxvs_tmp.h" - -#define IND (SETUP_RGBA|SETUP_XY|SETUP_Z) -#define NAME fxsetupXYZRGBA -#include "fxvs_tmp.h" - -#define IND (SETUP_RGBA|SETUP_XY|SETUP_W) -#define NAME fxsetupXYWRGBA -#include "fxvs_tmp.h" - -#define IND (SETUP_RGBA|SETUP_XY|SETUP_Z|SETUP_W) -#define NAME fxsetupXYZWRGBA -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU0|SETUP_XY|SETUP_W) -#define NAME fxsetupXYWT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU0|SETUP_XY|SETUP_Z|SETUP_W) -#define NAME fxsetupXYZWT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1|SETUP_TMU0|SETUP_XY|SETUP_W) -#define NAME fxsetupXYWT0T1 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1|SETUP_TMU0|SETUP_XY|SETUP_Z|SETUP_W) -#define NAME fxsetupXYZWT0T1 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU0|SETUP_RGBA|SETUP_XY|SETUP_W) -#define NAME fxsetupXYWRGBAT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU0|SETUP_RGBA|SETUP_XY|SETUP_Z|SETUP_W) -#define NAME fxsetupXYZWRGBAT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1|SETUP_TMU0|SETUP_RGBA|SETUP_XY|SETUP_W) -#define NAME fxsetupXYWRGBAT0T1 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1|SETUP_TMU0|SETUP_RGBA|SETUP_XY|SETUP_Z|SETUP_W) -#define NAME fxsetupXYZWRGBAT0T1 -#include "fxvs_tmp.h" - -#define IND (SETUP_RGBA) -#define NAME fxsetupRGBA -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU0) -#define NAME fxsetupT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1) -#define NAME fxsetupT1 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1|SETUP_TMU0) -#define NAME fxsetupT0T1 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU0|SETUP_RGBA) -#define NAME fxsetupRGBAT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1|SETUP_RGBA) -#define NAME fxsetupRGBAT1 -#include "fxvs_tmp.h" - -#define IND (SETUP_TMU1|SETUP_TMU0|SETUP_RGBA) -#define NAME fxsetupRGBAT0T1 -#include "fxvs_tmp.h" - -#define IND (SETUP_W|SETUP_RGBA) -#define NAME fxsetupWRGBA -#include "fxvs_tmp.h" - -#define IND (SETUP_W|SETUP_TMU0) -#define NAME fxsetupWT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_W|SETUP_TMU1) -#define NAME fxsetupWT1 -#include "fxvs_tmp.h" - -#define IND (SETUP_W|SETUP_TMU1|SETUP_TMU0) -#define NAME fxsetupWT0T1 -#include "fxvs_tmp.h" - -#define IND (SETUP_W|SETUP_TMU0|SETUP_RGBA) -#define NAME fxsetupWRGBAT0 -#include "fxvs_tmp.h" - -#define IND (SETUP_W|SETUP_TMU1|SETUP_RGBA) -#define NAME fxsetupWRGBAT1 -#include "fxvs_tmp.h" - -#define IND (SETUP_W|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA) -#define NAME fxsetupWRGBAT0T1 -#include "fxvs_tmp.h" - - - -void -fxDDSetupInit(void) -{ - setupfuncs[SETUP_XY] = fxsetupXY; - setupfuncs[SETUP_XY | SETUP_Z] = fxsetupXYZ; - setupfuncs[SETUP_XY | SETUP_W] = fxsetupXYW; - setupfuncs[SETUP_XY | SETUP_Z | SETUP_W] = fxsetupXYZW; - - setupfuncs[SETUP_RGBA | SETUP_XY] = fxsetupXYRGBA; - setupfuncs[SETUP_RGBA | SETUP_XY | SETUP_Z] = fxsetupXYZRGBA; - setupfuncs[SETUP_RGBA | SETUP_XY | SETUP_W] = fxsetupXYWRGBA; - setupfuncs[SETUP_RGBA | SETUP_XY | SETUP_Z | SETUP_W] = fxsetupXYZWRGBA; - - /* If we have texture and xy then we must have w. - * If we have texture1 and w then we must have texture 0. - */ - setupfuncs[SETUP_TMU0 | SETUP_XY | SETUP_W] = fxsetupXYWT0; - setupfuncs[SETUP_TMU0 | SETUP_XY | SETUP_Z | SETUP_W] = fxsetupXYZWT0; - - setupfuncs[SETUP_TMU1 | SETUP_TMU0 | SETUP_XY | SETUP_W] = fxsetupXYWT0T1; - setupfuncs[SETUP_TMU1 | SETUP_TMU0 | SETUP_XY | SETUP_Z | SETUP_W] = - fxsetupXYZWT0T1; - - setupfuncs[SETUP_TMU0 | SETUP_RGBA | SETUP_XY | SETUP_W] = - fxsetupXYWRGBAT0; - setupfuncs[SETUP_TMU0 | SETUP_RGBA | SETUP_XY | SETUP_Z | SETUP_W] = - fxsetupXYZWRGBAT0; - - setupfuncs[SETUP_TMU1 | SETUP_TMU0 | SETUP_RGBA | SETUP_XY | SETUP_W] = - fxsetupXYWRGBAT0T1; - setupfuncs[SETUP_TMU1 | SETUP_TMU0 | SETUP_RGBA | SETUP_XY | SETUP_Z | - SETUP_W] = fxsetupXYZWRGBAT0T1; - - /* If we don't have xy then we can't have z... w is still a possibility. - */ - setupfuncs[SETUP_RGBA] = fxsetupRGBA; - setupfuncs[SETUP_TMU0] = fxsetupT0; - setupfuncs[SETUP_TMU1] = fxsetupT1; - setupfuncs[SETUP_TMU1 | SETUP_TMU0] = fxsetupT0T1; - setupfuncs[SETUP_TMU0 | SETUP_RGBA] = fxsetupRGBAT0; - setupfuncs[SETUP_TMU1 | SETUP_RGBA] = fxsetupRGBAT1; - setupfuncs[SETUP_TMU1 | SETUP_TMU0 | SETUP_RGBA] = fxsetupRGBAT0T1; - - setupfuncs[SETUP_W | SETUP_RGBA] = fxsetupWRGBA; - setupfuncs[SETUP_W | SETUP_TMU0] = fxsetupWT0; - setupfuncs[SETUP_W | SETUP_TMU1] = fxsetupWT1; - setupfuncs[SETUP_W | SETUP_TMU1 | SETUP_TMU0] = fxsetupWT0T1; - setupfuncs[SETUP_W | SETUP_TMU0 | SETUP_RGBA] = fxsetupWRGBAT0; - setupfuncs[SETUP_W | SETUP_TMU1 | SETUP_RGBA] = fxsetupWRGBAT1; - setupfuncs[SETUP_W | SETUP_TMU1 | SETUP_TMU0 | SETUP_RGBA] = - fxsetupWRGBAT0T1; - -} - - - -tfxSetupFunc -fxDDChooseSetupFunction(GLcontext * ctx) -{ - GLuint setupindex = SETUP_XY | SETUP_Z; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - fxMesa->setupindex = 0; - - if (ctx->RenderMode != GL_RENDER) - return 0; - - fxMesa->tmu_source[0] = 0; - fxMesa->tmu_source[1] = 1; - - fxMesa->tex_dest[0] = SETUP_TMU0; - fxMesa->tex_dest[1] = SETUP_TMU1; - - if (ctx->Light.ShadeModel == GL_SMOOTH && !ctx->Light.Model.TwoSide) - setupindex |= SETUP_RGBA; - - if (ctx->Fog.Enabled && ctx->FogMode == FOG_FRAGMENT) - setupindex |= SETUP_RGBA | SETUP_W; - - if ((ctx->Texture.ReallyEnabled & (TEXTURE0_2D | TEXTURE0_3D)) == - TEXTURE0_2D) { - /* This doesn't work for non-RGBA textures - if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) - setupindex &= ~SETUP_RGBA; - */ - setupindex |= SETUP_TMU0 | SETUP_W; - } - - if ((ctx->Texture.ReallyEnabled & (TEXTURE1_2D | TEXTURE1_3D)) == - TEXTURE1_2D) { - setupindex |= SETUP_TMU1 | SETUP_W; - if (setupindex & SETUP_TMU0) { /* both TMUs in use */ - struct gl_texture_object *tObj = ctx->Texture.Unit[0].CurrentD[2]; - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - - if (ti->whichTMU != FX_TMU0) { /* TMU0 and TMU1 are swapped */ - fxMesa->tmu_source[0] = 1; - fxMesa->tex_dest[1] = SETUP_TMU0; - fxMesa->tmu_source[1] = 0; - fxMesa->tex_dest[0] = SETUP_TMU1; - } - } - } - - if (ctx->Color.BlendEnabled) - setupindex |= SETUP_RGBA; - - if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_PIPELINE | VERBOSE_STATE)) - fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); - - fxMesa->setupindex = setupindex; - fxMesa->view_clip_tri = fxTriViewClipTab[setupindex & 0x7]; - fxMesa->clip_tri_stride = fxTriClipStrideTab[setupindex & 0x7]; - return setupfuncs[setupindex]; -} - -void -fxDDDoRasterSetup(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - FX_DRIVER_DATA(VB)->last_vert = FX_DRIVER_DATA(VB)->verts + VB->Count; - -#if 0 /* leaving this out fixes the Heretic2 stray polygon bug */ - if ((ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxMesa->setupdone = 0; - return; - } -#endif - - if (VB->Type == VB_CVA_PRECALC) - fxDDPartialRasterSetup(VB); - else if (ctx->Driver.RasterSetup) /* NULL if in feedback/selection mode */ - ctx->Driver.RasterSetup(VB, VB->CopyStart, VB->Count); - -} - - -/* - * Need to check that merge&render will work before allowing this to - * happen here. Therefore - need to know that this will be fired when - * we get a forbidden input in the elt pipeline - and therefore need to check - * whether we have one *now*. Similarly need to know if state changes cause - * size4 texcoords to be introduced. - */ -void -fxDDCheckPartialRasterSetup(GLcontext * ctx, struct gl_pipeline_stage *d) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint tmp = fxMesa->setupdone; - - d->type = 0; - d->pre_forbidden_inputs = 0; - fxMesa->setupdone = 0; /* cleared if we return */ - - /* Indirect triangles must be rendered via the immediate pipeline. - * If all rasterization is software, no need to set up. - */ - if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0) - return; - - if ((ctx->IndirectTriangles & DD_SW_SETUP) || - (ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) - return; - - if ((ctx->Texture.ReallyEnabled & 0xf) && - !(ctx->Array.Flags & VERT_TEX0_ANY)) { - if (ctx->TextureMatrix[0].type == MATRIX_GENERAL || - ctx->TextureMatrix[0].type == MATRIX_PERSPECTIVE || - (ctx->Texture.Unit[0].TexGenEnabled & Q_BIT)) - return; - - d->pre_forbidden_inputs |= VERT_TEX0_4; - } - - if ((ctx->Texture.ReallyEnabled & 0xf0) && - !(ctx->Array.Flags & VERT_TEX1_ANY)) { - if (ctx->TextureMatrix[1].type == MATRIX_GENERAL || - ctx->TextureMatrix[1].type == MATRIX_PERSPECTIVE || - (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT)) - return; - - d->pre_forbidden_inputs |= VERT_TEX1_4; - } - - - fxMesa->setupdone = tmp; - d->inputs = 0; - d->outputs = VERT_SETUP_PART; - d->type = PIPE_PRECALC; -} - - -/* Will be different every time - no point in trying to precalc the - * function to call. - */ -void -fxDDPartialRasterSetup(struct vertex_buffer *VB) -{ - GLuint new = VB->pipeline->new_outputs; - fxMesaContext fxMesa = (fxMesaContext) VB->ctx->DriverCtx; - GLuint ind = 0; - - FX_DRIVER_DATA(VB)->last_vert = FX_DRIVER_DATA(VB)->verts + VB->Count; - - if (new & VERT_WIN) { - new = VB->pipeline->outputs; - ind |= SETUP_XY | SETUP_W | SETUP_Z; - } - - if (new & VERT_TEX0_ANY) - ind |= SETUP_W | fxMesa->tex_dest[0]; - - if (new & VERT_TEX1_ANY) - ind |= SETUP_W | fxMesa->tex_dest[1]; - - if (new & VERT_RGBA) - ind |= SETUP_W | SETUP_RGBA; - - if ((new & VERT_WIN) == 0) - ind &= ~(fxMesa->setupdone & SETUP_W); - - fxMesa->setupdone &= ~ind; - ind &= fxMesa->setupindex; - fxMesa->setupdone |= ind; - - if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_PIPELINE)) { - gl_print_vert_flags("new outputs", VB->pipeline->new_outputs); - fxPrintSetupFlags("fxmesa: partial setup function", ind); - } - - if (ind) - setupfuncs[ind] (VB, VB->Start, VB->Count); -} - - -/* - * This is called by the fastpath code if we need to resize a vertex buffer. - * (Almost certainly never called.) - */ -void -fxDDResizeVB(struct vertex_buffer *VB, GLuint size) -{ - struct tfxMesaVertexBuffer *fvb = FX_DRIVER_DATA(VB); - - while (fvb->size < size) - fvb->size *= 2; - - ALIGN_FREE(VB->ClipMask); - VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * fvb->size, 4); - - ALIGN_FREE(fvb->verts); - fvb->verts = (fxVertex *) ALIGN_MALLOC(sizeof(fxVertex) * fvb->size, 32); - - gl_vector1ui_free(&fvb->clipped_elements); - gl_vector1ui_alloc(&fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32); - - if (!fvb->verts || !VB->ClipMask || !fvb->clipped_elements.start) { - gl_problem(NULL, "tdfx driver out of memory in fxDDResizeVB"); - return; - } -} - - -/* - * This is called by Mesa when it creates a new vertex buffer. - * Here, we allocate a tfxMesaVertexBuffer and hook it to VB->driver_data. - */ -void -fxDDRegisterVB(struct vertex_buffer *VB) -{ - struct tfxMesaVertexBuffer *fvb; - - fvb = (struct tfxMesaVertexBuffer *) calloc(1, sizeof(*fvb)); - - /* This looks like it allocates a lot of memory, but it basically - * just sets an upper limit on how much can be used - nothing like - * this amount will ever be turned into 'real' memory. - */ - if (VB->Type == VB_CVA_PRECALC) { - fvb->size = VB->Size * 5; - fvb->verts = (fxVertex *) ALIGN_MALLOC(sizeof(fxVertex)*fvb->size, 32); - if (!fvb->verts) - goto memerror; - -#if defined(FX_GLIDE3) - fvb->triangle_b = MALLOC(sizeof(GrVertex *) * 4 * fvb->size + 31); - if (!fvb->triangle_b) - goto memerror; - fvb->strips_b = MALLOC(sizeof(GrVertex *) * 4 * fvb->size + 31); - if (!fvb->strips_b) - goto memerror; -#endif - gl_vector1ui_alloc(&fvb->clipped_elements, VEC_WRITABLE, fvb->size,32); - if (!fvb->clipped_elements.start) - goto memerror; - - ALIGN_FREE(VB->ClipMask); - VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*fvb->size, 4); - if (!VB->ClipMask) - goto memerror; - } - else { - fvb->size = VB->Size + 12; - fvb->verts = (fxVertex *) ALIGN_MALLOC(sizeof(fxVertex)*fvb->size, 32); - if (!fvb->verts) - goto memerror; - -#if defined(FX_GLIDE3) - fvb->triangle_b = MALLOC(sizeof(GrVertex *) * 4 * fvb->size + 31); - if (!fvb->triangle_b) - goto memerror; - fvb->strips_b = MALLOC(sizeof(GrVertex *) * 4 * fvb->size + 31); - if (!fvb->strips_b) - goto memerror; -#endif - } - - VB->driver_data = fvb; - return; - - memerror: - fprintf(stderr, "fx Driver: out of memory !\n"); -} - - -/* - * This is called by Mesa when it's about to deallocate a vertex buffer. - * Here we free the tfxMesaVertexBuffer we attached to VB->driver_data. - */ -void -fxDDUnregisterVB(struct vertex_buffer *VB) -{ - struct tfxMesaVertexBuffer *fvb = FX_DRIVER_DATA(VB); - - if (fvb) { - if (fvb->verts) - ALIGN_FREE(fvb->verts); - gl_vector1ui_free(&fvb->clipped_elements); -#if defined(FX_GLIDE3) - if (fvb->strips_b) - FREE(fvb->strips_b); - if (fvb->triangle_b) - FREE(fvb->triangle_b); -#endif - FREE(fvb); - VB->driver_data = NULL; - } -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h b/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h deleted file mode 100644 index 02cd0c9ba..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h +++ /dev/null @@ -1,177 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#ifndef _FXVSETUP_H_ -#define _FXVSETUP_H_ - - -#define VARS_W - -#define VARS_Z - -#define VARS_TMU0 \ - GLuint tmu0_source = fxMesa->tmu_source[0]; \ - GLfloat *tmu0_data = VEC_ELT(VB->TexCoordPtr[tmu0_source], \ - GLfloat, start); \ - GLuint tmu0_stride = VB->TexCoordPtr[tmu0_source]->stride; \ - GLuint tmu0_sz = VB->TexCoordPtr[tmu0_source]->size; \ - struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; \ - GLfloat sscale0 = FX_TEXTURE_DATA(t0)->sScale; \ - GLfloat tscale0 = FX_TEXTURE_DATA(t0)->tScale; - -#define VARS_TMU1 \ - GLuint tmu1_source = fxMesa->tmu_source[1]; \ - GLfloat *tmu1_data = VEC_ELT(VB->TexCoordPtr[tmu1_source], \ - GLfloat, start); \ - GLuint tmu1_stride = VB->TexCoordPtr[tmu1_source]->stride; \ - GLuint tmu1_sz = VB->TexCoordPtr[tmu1_source]->size; \ - struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; \ - GLfloat sscale1 = FX_TEXTURE_DATA(t1)->sScale; \ - GLfloat tscale1 = FX_TEXTURE_DATA(t1)->tScale; - -#define VARS_RGBA \ - GLubyte *color = VEC_ELT(VB->ColorPtr, GLubyte, start); \ - GLuint col_stride = VB->ColorPtr->stride; - -#define VARS_XY GLfloat *win = VB->Win.data[start]; - -#define INCR_XY win += 4 - - -/* Add window offset to window coords to get screen coords */ -# define DO_SETUP_XY \ - v[XCOORD]=win[0]+fxMesa->x_offset; \ - v[YCOORD]=win[1]+fxMesa->y_delta; - - -#define DO_SETUP_W { \ - v[OOWCOORD]=win[3]; \ -} - -#define DO_SETUP_Z v[ZCOORD]=win[2]; - -#define DO_SETUP_TMU0 \ -{ \ - v[S0COORD]=sscale0*tmu0_data[0]*v[OOWCOORD]; \ - v[T0COORD]=tscale0*tmu0_data[1]*v[OOWCOORD]; \ -} - -#define INCR_TMU0 STRIDE_F(tmu0_data, tmu0_stride) - -#define DO_SETUP_TMU1 \ -{ \ - v[S1COORD]=sscale1*tmu1_data[0]*v[OOWCOORD]; \ - v[T1COORD]=tscale1*tmu1_data[1]*v[OOWCOORD]; \ -} - -#define INCR_TMU1 STRIDE_F(tmu1_data, tmu1_stride) - -#if FX_USE_PARGB -#define DO_SETUP_RGBA \ -{ \ - PACK_4F_ARGB(GET_PARGB(v), color[3], color[0], color[1], color[2]); \ -} -#else -#define DO_SETUP_RGBA \ -{ \ - UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[RCOORD], color[0]); \ - UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[GCOORD], color[1]); \ - UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[BCOORD], color[2]); \ - UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[ACOORD], color[3]); \ -} -#endif - -#define INCR_RGBA color += col_stride - - -#define _FIXUP_PRE \ - GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 | \ - GR_STWHINT_W_DIFF_TMU1); - -#define _FIXUP_TMU0 \ - if (tmu0_sz == 4) { \ - project_texcoords( VB, 0, tmu0_source, start, end ); \ - hs |= GR_STWHINT_W_DIFF_TMU0; \ - } - - -#define _FIXUP_TMU1 \ - if (tmu1_sz == 4) { \ - project_texcoords( VB, 1, tmu1_source, start, end ); \ - hs |= GR_STWHINT_W_DIFF_TMU1; \ - } - - -#define _FIXUP_TMU01 \ - if (tmu0_sz == 4) { \ - project_texcoords( VB, 0, tmu0_source, start, end ); \ - if (tmu1_sz == 4) \ - project_texcoords( VB, 1, tmu1_source, start, end ); \ - else \ - copy_w( VB, 1, start, end ); \ - hs |= (GR_STWHINT_W_DIFF_TMU0|GR_STWHINT_W_DIFF_TMU1); \ - } else if (tmu1_sz == 4) { \ - project_texcoords( VB, 1, tmu1_source, start, end ); \ - hs |= GR_STWHINT_W_DIFF_TMU1; \ - } - -#define _FIXUP_POST \ - if (hs != fxMesa->stw_hint_state) { \ - fxMesa->stw_hint_state = hs; \ - FX_grHints(fxMesa, GR_HINT_STWHINT, hs); \ - } - - -#define FIXUP_TMU0 { _FIXUP_PRE _FIXUP_TMU0 _FIXUP_POST } -#define FIXUP_TMU1 { _FIXUP_PRE _FIXUP_TMU1 _FIXUP_POST } -#define FIXUP_TMU01 { _FIXUP_PRE _FIXUP_TMU01 _FIXUP_POST } - - -/* v - pointer to destination GrVertex - * VB - source of data - * i - index into vb for data - */ - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c new file mode 100644 index 000000000..ae509044d --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c @@ -0,0 +1,466 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "dri_glide.h" +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_render.h" +#include "tdfx_pipeline.h" +#include "tdfx_span.h" +#include "tdfx_texman.h" +#include "extensions.h" + + + +#if 0 +/* Example extension function */ +static void +fxFooBarEXT(GLint i) +{ + printf("You called glFooBarEXT(%d)\n", i); +} +#endif + + +/* + * Enable/Disable the extensions for this context. + */ +static void tdfxDDInitExtensions( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); + gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); + gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); + gl_extensions_disable( ctx, "GL_EXT_blend_color" ); + gl_extensions_disable( ctx, "GL_EXT_blend_func_separate" ); + gl_extensions_disable( ctx, "GL_EXT_point_parameters" ); + gl_extensions_disable( ctx, "GL_EXT_shared_texture_palette" ); + gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); + gl_extensions_enable( ctx, "GL_HP_occlusion_test" ); + + if ( !fxMesa->haveTwoTMUs ) { + gl_extensions_disable( ctx, "GL_EXT_texture_env_add" ); + gl_extensions_disable( ctx, "GL_ARB_multitexture" ); + } + + if ( TDFX_IS_NAPALM( fxMesa ) ) { + gl_extensions_enable( ctx, "GL_ARB_texture_compression" ); + gl_extensions_enable( ctx, "GL_EXT_texture_env_combine" ); + gl_extensions_enable( ctx, "GL_3DFX_texture_compression_FXT1" ); + } + + if (fxMesa->haveHwStencil) { + gl_extensions_enable( ctx, "GL_EXT_stencil_wrap" ); + } + + /* Example of hooking in an extension function. + * For DRI-based drivers, also see __driRegisterExtensions in the + * tdfx_xmesa.c file. + */ +#if 0 + { + void **dispatchTable = (void **) ctx->Exec; + const int _gloffset_FooBarEXT = 555; /* just an example number! */ + const int tabSize = _glapi_get_dispatch_table_size(); + assert(_gloffset_FooBarEXT < tabSize); + dispatchTable[_gloffset_FooBarEXT] = (void *) tdfxFooBarEXT; + /* XXX You would also need to hook into the display list dispatch + * table. Really, the implementation of extensions might as well + * be in the core of Mesa since core Mesa and the device driver + * is one big shared lib. + */ + } +#endif +} + + + +GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ) +{ + tdfxContextPtr fxMesa; + GLcontext *ctx = driContextPriv->mesaContext; + __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; + TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA + + sizeof(XF86DRISAREARec)); + + + fxMesa = (tdfxContextPtr) Xmalloc( sizeof(tdfxContextRec) ); + if ( !fxMesa ) { + return GL_FALSE; + } + BZERO(fxMesa, sizeof(tdfxContextRec)); + + /* Mirror some important DRI state + */ + fxMesa->hHWContext = driContextPriv->hHWContext; + fxMesa->driHwLock = &sPriv->pSAREA->lock; + fxMesa->driFd = sPriv->fd; + + fxMesa->driScreen = sPriv; + fxMesa->driContext = driContextPriv; + fxMesa->fxScreen = fxScreen; + fxMesa->sarea = saPriv; + + + + fxMesa->haveHwStencil = ( TDFX_IS_NAPALM( fxMesa ) && + mesaVis->StencilBits && + mesaVis->DepthBits == 24 ); + + fxMesa->screen_width = fxScreen->width; + fxMesa->screen_height = fxScreen->height; + + fxMesa->new_state = ~0; + fxMesa->dirty = ~0; + + fxMesa->vertexFormat = 0; + + fxMesa->glCtx = driContextPriv->mesaContext; + fxMesa->glVis = mesaVis; + + grDRIOpen( sPriv->pFB, fxScreen->regs.map, fxScreen->deviceID, + fxScreen->width, fxScreen->height, fxScreen->mem, fxScreen->cpp, + fxScreen->stride, fxScreen->fifoOffset, fxScreen->fifoSize, + fxScreen->fbOffset, fxScreen->backOffset, fxScreen->depthOffset, + fxScreen->textureOffset, fxScreen->textureSize, &saPriv->fifoPtr, + &saPriv->fifoRead ); + + if ( getenv( "FX_GLIDE_SWAPINTERVAL" ) ) { + fxMesa->Glide.SwapInterval = atoi( getenv( "FX_GLIDE_SWAPINTERVAL" ) ); + } else { + fxMesa->Glide.SwapInterval = 1; + } + if ( getenv( "FX_MAX_PENDING_SWAPS" ) ) { + fxMesa->Glide.MaxPendingSwaps = atoi( getenv( "FX_MAX_PENDING_SWAPS" ) ); + } else { + fxMesa->Glide.MaxPendingSwaps = 2; + } + + fxMesa->Glide.Initialized = GL_FALSE; + fxMesa->Glide.Board = 0; + + + if (getenv("FX_EMULATE_SINGLE_TMU")) { + fxMesa->haveTwoTMUs = GL_FALSE; + } + else { + if ( TDFX_IS_BANSHEE( fxMesa ) ) { + fxMesa->haveTwoTMUs = GL_FALSE; + } else { + fxMesa->haveTwoTMUs = GL_TRUE; + } + } + + fxMesa->stats.swapBuffer = 0; + fxMesa->stats.reqTexUpload = 0; + fxMesa->stats.texUpload = 0; + fxMesa->stats.memTexUpload = 0; + + fxMesa->tmuSrc = TDFX_TMU_NONE; + + if ( TDFX_IS_NAPALM( fxMesa ) ) { + ctx->Const.MaxTextureLevels = 12; + ctx->Const.MaxTextureSize = 2048; + ctx->Const.NumCompressedTextureFormats = 1; + } else { + ctx->Const.MaxTextureLevels = 9; + ctx->Const.MaxTextureSize = 256; + ctx->Const.NumCompressedTextureFormats = 0; + } + ctx->Const.MaxTextureUnits = TDFX_IS_BANSHEE( fxMesa ) ? 1 : 2; + ctx->NewState |= NEW_DRVSTATE1; + + + ctx->DriverCtx = (void *) fxMesa; + + tdfxDDInitExtensions( ctx ); + + tdfxDDInitDriverFuncs( ctx ); + tdfxDDInitStateFuncs( ctx ); + tdfxDDInitRenderFuncs( ctx ); + tdfxDDInitSpanFuncs( ctx ); + + ctx->Driver.TriangleCaps = (DD_TRI_CULL | + DD_TRI_LIGHT_TWOSIDE | + DD_TRI_STIPPLE | + DD_TRI_OFFSET); + + if ( ctx->VB ) + tdfxDDRegisterVB( ctx->VB ); + + if ( ctx->NrPipelineStages ) + ctx->NrPipelineStages = + tdfxDDRegisterPipelineStages( ctx->PipelineStage, + ctx->PipelineStage, + ctx->NrPipelineStages ); + + /* Run the config file */ + gl_context_initialize( ctx ); + +#if 0 + /* HACK: Allocate buffer for vertex data. + */ + if ( fxMesa->buffer ) { + ALIGN_FREE( fxMesa->buffer ); + } + fxMesa->buffer = ALIGN_MALLOC( 2048, 32 ); + fxMesa->buffer_total = 2048; + fxMesa->buffer_used = 0; +#endif + + tdfxInitState( fxMesa ); + + driContextPriv->driverPrivate = (void *) fxMesa; + + return GL_TRUE; +} + + +static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa ) +{ + FxI32 result; + int i; + + LOCK_HARDWARE( fxMesa ); + + grGet( GR_GLIDE_VERTEXLAYOUT_SIZE, sizeof(FxI32), &result ); + for ( i = 0 ; i < TDFX_NUM_LAYOUTS ; i++ ) { + fxMesa->layout[i] = MALLOC( result ); + if ( !fxMesa->layout[i] ) { + UNLOCK_HARDWARE( fxMesa ); + return GL_FALSE; + } + } + + /* Single textured vertex format - 32 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_SINGLE] ); + + /* Multitextured vertex format - 40 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_MULTI] ); + + /* Projected texture vertex format - 48 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q1, TDFX_Q1_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJECT] ); + + UNLOCK_HARDWARE( fxMesa ); + + return GL_TRUE; +} + + +/* + * Initialize the state in an tdfxContextPtr struct. + */ +GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, + tdfxContextPtr fxMesa ) +{ + /* KW: Would be nice to make one of these a member of the other. + */ + FxI32 result[2]; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa ); + } + +#if DEBUG_LOCKING + fprintf(stderr, "Debug locking enabled\n"); +#endif + + if ( fxMesa->Glide.Initialized ) + return GL_TRUE; + + fxMesa->width = driDrawPriv->w; + fxMesa->height = driDrawPriv->h; + + /* We have to use a light lock here, because we can't do any glide + * operations yet. No use of FX_* functions in this function. + */ + DRM_LIGHT_LOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); + + grGlideInit(); + grSstSelect( fxMesa->Glide.Board ); + + fxMesa->Glide.Context = grSstWinOpen( (FxU32) -1, + GR_RESOLUTION_NONE, + GR_REFRESH_NONE, + fxMesa->Glide.ColorFormat, + fxMesa->Glide.Origin, + 2, 1 ); + + grDRIResetSAREA(); + + DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); + + if ( !fxMesa->Glide.Context ) + return GL_FALSE; + + + /* Perform the Glide-dependant part of the context initialization. + */ + FX_grColorMaskv( fxMesa->glCtx, true4 ); + + tdfxTMInit( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + + if ( fxMesa->glVis->DepthBits > 0 ) { + grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); + } else { + grDepthBufferMode(GR_DEPTHBUFFER_DISABLE); + } + + grLfbWriteColorFormat( GR_COLORFORMAT_ABGR ); + + grGet( GR_TEXTURE_ALIGN, sizeof(FxI32), result ); + fxMesa->Glide.TextureAlign = result[0]; + + fxMesa->Glide.State = NULL; + grGet( GR_GLIDE_STATE_SIZE, sizeof(FxI32), result ); + fxMesa->Glide.State = MALLOC( result[0] ); + + fxMesa->Fog.Table = NULL; + grGet( GR_FOG_TABLE_ENTRIES, sizeof(FxI32), result ); + fxMesa->Fog.Table = MALLOC( result[0] * sizeof(GrFog_t) ); + + UNLOCK_HARDWARE( fxMesa ); + + if ( !fxMesa->Glide.State || !fxMesa->Fog.Table ) { + if ( fxMesa->Glide.State ) + FREE( fxMesa->Glide.State ); + if ( fxMesa->Fog.Table ) + FREE( fxMesa->Fog.Table ); + return GL_FALSE; + } + + if ( !tdfxInitVertexFormats( fxMesa ) ) { + return GL_FALSE; + } + + LOCK_HARDWARE( fxMesa ); + + grGlideGetState( fxMesa->Glide.State ); + + if ( getenv( "FX_GLIDE_INFO" ) ) { + printf( "GR_RENDERER = %s\n", (char *) grGetString( GR_RENDERER ) ); + printf( "GR_VERSION = %s\n", (char *) grGetString( GR_VERSION ) ); + printf( "GR_VENDOR = %s\n", (char *) grGetString( GR_VENDOR ) ); + printf( "GR_HARDWARE = %s\n", (char *) grGetString( GR_HARDWARE ) ); + printf( "GR_EXTENSION = %s\n", (char *) grGetString( GR_EXTENSION ) ); + } + + UNLOCK_HARDWARE( fxMesa ); + + fxMesa->numClipRects = 0; + fxMesa->pClipRects = NULL; + fxMesa->scissoredClipRects = GL_FALSE; + + fxMesa->Glide.Initialized = GL_TRUE; + + return GL_TRUE; +} + + +void tdfxDestroyContext( tdfxContextPtr fxMesa ) +{ + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa ); + } + + if ( fxMesa ) { + if (fxMesa->glCtx->Shared->RefCount == 1) { + /* This share group is about to go away, free our private + * texture object data. + */ + struct gl_texture_object *tObj; + tObj = fxMesa->glCtx->Shared->TexObjectList; + while (tObj) { + tdfxTMFreeTexture(fxMesa, tObj); + tObj = tObj->Next; + } + } + + tdfxTMClose(fxMesa); /* free texture memory */ + XFree( fxMesa ); + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h new file mode 100644 index 000000000..d630184bd --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h @@ -0,0 +1,774 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_CONTEXT_H__ +#define __TDFX_CONTEXT_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <sys/time.h> +#include "dri_tmm.h" +#include "dri_mesaint.h" +#include "dri_mesa.h" +#include "dri_xmesaapi.h" +#ifdef XFree86Server +#include "GL/xf86glx.h" +#else +#include "glheader.h" +#endif +#if defined(__linux__) +#include <signal.h> +#endif +#include "clip.h" +#include "context.h" + +#include "macros.h" +#include "matrix.h" +#include "mem.h" +#include "texture.h" +#include "types.h" +#include "vb.h" +#include "vbrender.h" +#include "xform.h" + +#include "tdfx_wrapper.h" +#include "tdfx_screen.h" +#include "tdfx_lock.h" +#include "tdfx_g3ext.h" + + + +/* Mergable items first + */ +#define SETUP_RGBA 0x1 +#define SETUP_TMU0 0x2 +#define SETUP_TMU1 0x4 +#define SETUP_XY 0x8 +#define SETUP_Z 0x10 +#define SETUP_W 0x20 + +#define MAX_MERGABLE 0x8 + + +#define TDFX_TMU0 GR_TMU0 +#define TDFX_TMU1 GR_TMU1 +#define TDFX_TMU_SPLIT 98 +#define TDFX_TMU_BOTH 99 +#define TDFX_TMU_NONE 100 + + + +/* Flags for fxMesa->new_state + */ +#define TDFX_NEW_COLOR 0x0001 +#define TDFX_NEW_ALPHA 0x0002 +#define TDFX_NEW_DEPTH 0x0004 +#define TDFX_NEW_FOG 0x0008 +#define TDFX_NEW_STENCIL 0x0010 +#define TDFX_NEW_CLIP 0x0020 +#define TDFX_NEW_VIEWPORT 0x0040 +#define TDFX_NEW_CULL 0x0080 +#define TDFX_NEW_GLIDE 0x0100 +#define TDFX_NEW_TEXTURE 0x0200 +#define TDFX_NEW_CONTEXT 0x0400 +#define TDFX_NEW_LINE 0x0800 +#define TDFX_NEW_RENDER 0x1000 +#define TDFX_NEW_STIPPLE 0x2000 +#define TDFX_NEW_TEXTURE_BIND 0x4000 /* experimental */ + + +/* Flags for fxMesa->dirty + */ +#define TDFX_UPLOAD_COLOR_COMBINE 0x00000001 +#define TDFX_UPLOAD_ALPHA_COMBINE 0x00000002 +#define TDFX_UPLOAD_RENDER_BUFFER 0x00000004 +#define TDFX_UPLOAD_ALPHA_TEST 0x00000008 +#define TDFX_UPLOAD_ALPHA_REF 0x00000010 +#define TDFX_UPLOAD_BLEND_FUNC 0x00000020 +#define TDFX_UPLOAD_DEPTH_MODE 0x00000040 +#define TDFX_UPLOAD_DEPTH_BIAS 0x00000080 +#define TDFX_UPLOAD_DEPTH_FUNC 0x00000100 +#define TDFX_UPLOAD_DEPTH_MASK 0x00000200 +#define TDFX_UPLOAD_FOG_MODE 0x00000400 +#define TDFX_UPLOAD_FOG_COLOR 0x00000800 +#define TDFX_UPLOAD_FOG_TABLE 0x00001000 + +#define TDFX_UPLOAD_CLIP 0x00002000 +#define TDFX_UPLOAD_CULL 0x00004000 +#define TDFX_UPLOAD_VERTEX_LAYOUT 0x00008000 +#define TDFX_UPLOAD_COLOR_MASK 0x00010000 +#define TDFX_UPLOAD_CONSTANT_COLOR 0x00020000 +#define TDFX_UPLOAD_DITHER 0x00040000 +#define TDFX_UPLOAD_STENCIL 0x00080000 + +#define TDFX_UPLOAD_TEXTURE_SOURCE 0x00100000 +#define TDFX_UPLOAD_TEXTURE_PARAMS 0x00200000 +#define TDFX_UPLOAD_TEXTURE_PALETTE 0x00400000 +#define TDFX_UPLOAD_TEXTURE_ENV 0x00800000 +#define TDFX_UPLOAD_TEXTURE_IMAGES 0x01000000 + +#define TDFX_UPLOAD_LINE 0x02000000 + +#define TDFX_UPLOAD_STIPPLE 0x04000000 + +/* Flags for software fallback cases + */ +#define TDFX_FALLBACK_TEXTURE 0x0001 +#define TDFX_FALLBACK_BUFFER 0x0002 +#define TDFX_FALLBACK_SPECULAR 0x0004 +#define TDFX_FALLBACK_STENCIL 0x0008 +#define TDFX_FALLBACK_RENDER_MODE 0x0010 +#define TDFX_FALLBACK_MULTIDRAW 0x0020 +#define TDFX_FALLBACK_LOGICOP 0x0040 +#define TDFX_FALLBACK_WIDE_AA_LINE 0x0080 +#define TDFX_FALLBACK_TEXTURE_ENV 0x0100 +#define TDFX_FALLBACK_TEXTURE_BORDER 0x0200 +#define TDFX_FALLBACK_COLORMASK 0x0400 +#define TDFX_FALLBACK_BLEND 0x0800 + +/* Different Glide vertex layouts + */ +#define TDFX_LAYOUT_SINGLE 0 +#define TDFX_LAYOUT_MULTI 1 +#define TDFX_LAYOUT_PROJECT 2 +#define TDFX_NUM_LAYOUTS 3 + +#define TDFX_XY_OFFSET 0 +#define TDFX_Z_OFFSET 8 +#define TDFX_Q_OFFSET 12 +#define TDFX_ARGB_OFFSET 16 +#define TDFX_PAD_OFFSET 20 +#define TDFX_FOG_OFFSET 20 /* experimental */ +#define TDFX_ST0_OFFSET 24 +#define TDFX_ST1_OFFSET 32 +#define TDFX_Q0_OFFSET 40 +#define TDFX_Q1_OFFSET 44 + + +/* Flags for buffer clears + */ +#define TDFX_FRONT 0x1 +#define TDFX_BACK 0x2 +#define TDFX_DEPTH 0x4 +#define TDFX_STENCIL 0x8 + +/* + * Subpixel offsets to adjust Mesa's (true) window coordinates to + * Glide coordinates. We need these to ensure precise rasterization. + * Otherwise, we'll fail a bunch of conformance tests. + */ +#define TRI_X_OFFSET ( 0.0F) +#define TRI_Y_OFFSET ( 0.0F) +#define LINE_X_OFFSET ( 0.0F) +#define LINE_Y_OFFSET ( 0.125F) +#define PNT_X_OFFSET ( 0.375F) +#define PNT_Y_OFFSET ( 0.375F) + + +#define TDFX_DEPTH_BIAS_SCALE 128 + +/* Including xf86PciInfo.h causes a bunch of errors + */ +#ifndef PCI_CHIP_BANSHEE +#define PCI_CHIP_BANSHEE 0x0003 +#define PCI_CHIP_VOODOO3 0x0005 +#define PCI_CHIP_VOODOO4 0x0009 +#define PCI_CHIP_VOODOO5 0x0009 +#endif + +#define TDFX_IS_BANSHEE( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_BANSHEE ) +#define TDFX_IS_VOODOO3( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO3 ) +#define TDFX_IS_VOODOO4( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4 ) +#define TDFX_IS_VOODOO5( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5 ) +#define TDFX_IS_NAPALM( fxMesa ) \ + ( (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4) || \ + (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5) ) + + +#define PACK_BGRA32(R, G, B, A) \ + ( (((GLuint) (R)) << 16) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) ) | \ + (((GLuint) (A)) << 24) ) + +#define PACK_RGBA32(R, G, B, A) \ + ( (((GLuint) (R)) ) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) << 16) | \ + (((GLuint) (A)) << 24) ) + +/* + * The first two macros are to pack 8 bit color + * channel values into a 565 format. + */ +#define PACK_RGB16(R, G, B) \ + ((((GLuint) (R) & 0xF8) << 8) | \ + (((GLuint) (G) & 0xFC) << 3) | \ + (((GLuint) (B) & 0xFF) >> 3)) +#define PACK_BGR16(R, G, B) \ + ((((GLuint) (B) & 0xF8) << 8) | \ + (((GLuint) (G) & 0xFC) << 3) | \ + (((GLuint) (R) & 0xFF) >> 3)) +/* + * The second two macros pack 8 bit color channel values + * into 1555 values. + */ +#define PACK_RGBA16(R, G, B, A) \ + (((((GLuint) (A) & 0xFF) > 0) << 15)| \ + (((GLuint) (R) & 0xF8) << 7) | \ + (((GLuint) (G) & 0xF8) << 2) | \ + (((GLuint) (B) & 0xF8) >> 3)) +#define PACK_BGRA16(R, G, B, A) \ + (((((GLuint) (A) & 0xFF) > 0) << 15)| \ + (((GLuint) (B) & 0xF8) << 7) | \ + (((GLuint) (G) & 0xF8) << 2) | \ + (((GLuint) (R) & 0xF8) >> 3)) + +typedef void (*tdfxRenderEltsFunc)( struct vertex_buffer * ); + +/* Used in calls to grColorMaskv()... + */ +extern const GLboolean false4[4]; +extern const GLboolean true4[4]; + + +typedef void (*tdfx_interp_func)( GLfloat t, + GLfloat *result, + const GLfloat *in, + const GLfloat *out ); + +typedef struct { + volatile int fifoPtr; + volatile int fifoRead; + volatile int fifoOwner; + volatile int ctxOwner; + volatile int texOwner; +} +TDFXSAREAPriv; + + +typedef struct { + GLuint swapBuffer; + GLuint reqTexUpload; + GLuint texUpload; + GLuint memTexUpload; + GLuint texSwaps; +} tdfxStats; + + + +/* + * Memory range from startAddr to endAddr-1 + */ +typedef struct mem_range { + struct mem_range *next; + FxU32 startAddr, endAddr; +} +tdfxMemRange; + + +typedef struct { + GLsizei width, height; /* image size */ + GLint texelSize; /* How many bytes to a texel */ + GrTextureFormat_t glideFormat; /* Glide image format */ + void *data; /* Glide-formated texture image */ + FxU32 dataSize; /* image size in bytes */ +} +tdfxMipMapLevel; + + +#define TDFX_NUM_TMU 2 + + +typedef struct tdfxTexInfo_t +{ + GLboolean isInTM; + GLboolean reloadImages; /* if true, resend images to Glide */ + GLuint lastTimeUsed; + FxU32 whichTMU; + + GrTexInfo info; + GrAspectRatio_t aspectRatio; + tdfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS]; + tdfxMemRange *tm[TDFX_NUM_TMU]; + + GLint minLevel, maxLevel; + GrTextureFilterMode_t minFilt; + GrTextureFilterMode_t magFilt; + GrTextureClampMode_t sClamp; + GrTextureClampMode_t tClamp; + FxBool LODblend; + GrMipMapMode_t mmMode; + + GLfloat sScale, tScale; /* texcoord scale factor */ + + GuTexPalette palette; +} +tdfxTexInfo; + + +#define TDFX_TEXTURE_DATA(mesaObj) ((tdfxTexInfo *)((mesaObj)->DriverData)) + + + +/* + * This is state which may be shared by several tdfx contexts. + * It hangs off of Mesa's gl_shared_state object (ctx->Shared->DriverData). + */ +struct tdfxSharedState { + GLboolean umaTexMemory; + GLuint totalTexMem[TDFX_NUM_TMU]; /* constant */ + GLuint freeTexMem[TDFX_NUM_TMU]; /* changes as we go */ + tdfxMemRange *tmPool; + tdfxMemRange *tmFree[TDFX_NUM_TMU]; +}; + + + + +/* ================================================================ + * + * We want to keep a mirror of the Glide function call parameters so we + * can avoid updating our state too often. + * + * Each of these broad groups will typically have a new state flag + * associated with it, and will be updated together. The individual + * Glide function calls each have a dirty flag and will only be called + * when absolutely necessary. + */ + +/* for grTexSource() */ +struct tdfx_texsource { + FxU32 StartAddress; + FxU32 EvenOdd; + GrTexInfo *Info; +}; + +/* Texture object params */ +struct tdfx_texparams { + GrTextureClampMode_t sClamp; + GrTextureClampMode_t tClamp; + GrTextureFilterMode_t minFilt; + GrTextureFilterMode_t magFilt; + GrMipMapMode_t mmMode; + FxBool LODblend; + GLfloat LodBias; +}; + +/* for grTexDownloadTable() texture palettes */ +struct tdfx_texpalette { + GrTexTable_t Type; + void *Data; +}; + +/* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */ +struct tdfx_combine { + GrCombineFunction_t Function; /* Combine function */ + GrCombineFactor_t Factor; /* Combine scale factor */ + GrCombineLocal_t Local; /* Local combine source */ + GrCombineOther_t Other; /* Other combine source */ + FxBool Invert; /* Combine result inversion flag */ +}; + +/* for Voodoo3's grTexCombine() */ +struct tdfx_texcombine { + GrCombineFunction_t FunctionRGB; + GrCombineFactor_t FactorRGB; + GrCombineFunction_t FunctionAlpha; + GrCombineFactor_t FactorAlpha; + FxBool InvertRGB; + FxBool InvertAlpha; +}; + + +/* for Voodoo5's grColorCombineExt() */ +struct tdfx_combine_color_ext { + GrCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrCCUColor_t SourceC; + FxBool InvertC; + GrCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grAlphaCombineExt() */ +struct tdfx_combine_alpha_ext { + GrACUColor_t SourceA; + GrCombineMode_t ModeA; + GrACUColor_t SourceB; + GrCombineMode_t ModeB; + GrACUColor_t SourceC; + FxBool InvertC; + GrACUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexColorCombineExt() */ +struct tdfx_color_texenv { + GrTCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrTCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrTCCUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexAlphaCombineExt() */ +struct tdfx_alpha_texenv { + GrTACUColor_t SourceA; + GrCombineMode_t ModeA; + GrTACUColor_t SourceB; + GrCombineMode_t ModeB; + GrTACUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* Voodoo5's texture combine environment */ +struct tdfx_texcombine_ext { + struct tdfx_alpha_texenv Alpha; + struct tdfx_color_texenv Color; + GrColor_t EnvColor; +}; + +/* Used to track changes between Glide's state and Mesa's */ +struct tdfx_texstate { + GLuint Enabled; /* bitmask of all units */ + GLenum EnvMode[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */ + GLenum TexFormat[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */ +}; + +struct tdfx_color { + GrColor_t ClearColor; /* Buffer clear color value */ + GrAlpha_t ClearAlpha; /* Buffer clear alpha value */ + FxBool ColorMask[4]; /* Per-channel write enable flags */ + + GrColor_t MonoColor; /* Constant color value */ + + /* Alpha testing */ + GrCmpFnc_t AlphaFunc; /* Alpha test function */ + GrAlpha_t AlphaRef; /* Alpha ref value in range [0,255] */ + + /* Blending */ + GrAlphaBlendFnc_t BlendSrcRGB; /* Blend source RGB factor */ + GrAlphaBlendFnc_t BlendDstRGB; /* Blend destination RGB factor */ + GrAlphaBlendFnc_t BlendSrcA; /* Blend source alpha factor */ + GrAlphaBlendFnc_t BlendDstA; /* Blend destination alpha factor */ + + GrDitherMode_t Dither; /* Dither enable */ +}; + +struct tdfx_depth { + GrDepthBufferMode_t Mode; /* Fixed-point Z or floating-point W */ + FxI32 Bias; /* Polygon offset factor */ + GrCmpFnc_t Func; /* Depth test function */ + FxU32 Clear; /* Buffer clear value */ + FxBool Mask; /* Write enable flag */ +}; + +struct tdfx_stipple { + GrStippleMode_t Mode; /* Stipple enable/disable */ + FxU32 Pattern; /* 8x4 Stipple Pattern */ +}; + +struct tdfx_fog { + GrFogMode_t Mode; /* Glide fog mode */ + GrColor_t Color; /* Fog color value */ + GLenum TableMode; /* GL fog mode currently in table */ + GrFog_t *Table; /* Fog value table */ + FxFloat Density; /* Density >= 0 */ + FxFloat Near; /* Start distance in eye coords */ + FxFloat Far; /* End distance in eye coords */ +}; + +struct tdfx_stencil { + GrCmpFnc_t Function; /* Stencil function */ + GrStencil_t RefValue; /* Stencil reference value */ + GrStencil_t ValueMask; /* Value mask */ + GrStencil_t WriteMask; /* Write mask */ + GrStencil_t FailFunc; /* Stencil fail function */ + GrStencil_t ZFailFunc; /* Stencil pass, depth fail function */ + GrStencil_t ZPassFunc; /* Stencil pass, depth pass function */ + GrStencil_t Clear; /* Buffer clear value */ +}; + +struct tdfx_scissor { + FxU32 minX, minY; /* Lower left corner */ + FxU32 maxX, maxY; /* Upper right corner */ +}; + +struct tdfx_viewport { + GrCoordinateSpaceMode_t Mode; /* Coordinate space */ + FxI32 X, Y; /* Position */ + FxI32 Width, Height; /* Size */ + FxFloat Near, Far; /* Depth buffer range */ +}; + +struct tdfx_glide { + void *State; /* Mirror of internal Glide state */ + GrContext_t Context; /* Glide context identifier */ + FxI32 Board; /* Current graphics subsystem */ + GrColorFormat_t ColorFormat; /* Framebuffer format */ + GrOriginLocation_t Origin; /* Location of screen space origin */ + + FxBool Initialized; /* Glide initialization done? */ + + FxI32 SwapInterval; /* SwapBuffers interval */ + FxI32 MaxPendingSwaps; /* Maximum outstanding SwapBuffers */ + FxI32 TextureAlign; + + /* Extensions */ + FxBool HaveCombineExt; /* COMBINE */ + FxBool HaveCommandTransportExt; /* COMMAND_TRANSPORT */ + FxBool HaveFogCoordExt; /* FOGCOORD */ + FxBool HavePixelExt; /* PIXEXT */ + FxBool HaveTextureBufferExt; /* TEXTUREBUFFER */ + FxBool HaveTexFmtExt; /* TEXFMT */ + FxBool HaveTexUMAExt; /* TEXUMA */ + FxBool HaveTexus2; /* Texus 2 - FXT1 */ +}; + + +struct tdfx_context { + /* Set once and never changed: + */ + GLcontext *glCtx; /* The core Mesa context */ + GLvisual *glVis; /* Describes the color buffer */ + + GLuint new_state; + GLuint dirty; + + /* Mirror of hardware state, Glide parameters + */ + struct tdfx_texsource TexSource[TDFX_NUM_TMU]; + struct tdfx_texparams TexParams[TDFX_NUM_TMU]; + struct tdfx_texpalette TexPalette; + + /* Voodoo3 texture/color combine state */ + struct tdfx_combine ColorCombine; + struct tdfx_combine AlphaCombine; + struct tdfx_texcombine TexCombine[TDFX_NUM_TMU]; + + /* Voodoo5 texture/color combine state */ + struct tdfx_combine_color_ext ColorCombineExt; + struct tdfx_combine_alpha_ext AlphaCombineExt; + struct tdfx_texcombine_ext TexCombineExt[TDFX_NUM_TMU]; + + /* Tracks tex state difference between Glide and Mesa */ + struct tdfx_texstate TexState; + + GrBuffer_t DrawBuffer; /* Current draw buffer */ + GrBuffer_t ReadBuffer; /* Current read buffer */ + + struct tdfx_color Color; + struct tdfx_depth Depth; + struct tdfx_fog Fog; + struct tdfx_stencil Stencil; + struct tdfx_scissor Scissor; + struct tdfx_viewport Viewport; + struct tdfx_stipple Stipple; + + GrCullMode_t CullMode; + + struct tdfx_glide Glide; + + /* Variable-size Glide vertex formats + */ + GLuint vertsize; /* bytes per vertex */ + GLuint vertexFormat; /* the current format */ + void *layout[TDFX_NUM_LAYOUTS]; + + GLuint tmu_source[TDFX_NUM_TMU]; + GLuint tex_dest[MAX_TEXTURE_UNITS]; + + GLuint SetupIndex; + GLuint SetupDone; + GLuint RenderIndex; + + GLuint IndirectTriangles; + GLuint Fallback; + + GLfloat sScale0, tScale0; + GLfloat sScale1, tScale1; + +#if 0 + GLuint last_tri_caps; + GLuint stw_hint_state; /* for grHints */ +#endif + GLuint using_fast_path, passes, multipass; + GLuint texBindNumber; + GLint tmuSrc; + + int screen_width; + int screen_height; + +#if 0 + void *state; /* Glide state buffer */ + + GLint textureAlign; + GLboolean verbose; +#endif + GLboolean haveTwoTMUs; /* True if we have 2 tmu's */ + GLboolean haveHwStencil; + + GLint maxPendingSwapBuffers; + + /* stuff added for DRI */ + __DRIscreenPrivate *driScreen; + __DRIcontextPrivate *driContext; + __DRIdrawablePrivate *driDrawable; + drmContext hHWContext; + drmLock *driHwLock; + int driFd; + tdfxScreenPrivate *fxScreen; + TDFXSAREAPriv *sarea; + + + /* + * Changes during execution: + */ + int width, height; /* size of window */ + int x_offset; /* distance from window left to screen left */ + int y_offset; /* distance from window top to screen top */ + int y_delta; /* distance from window bottom to screen bottom */ + + int numClipRects; + XF86DRIClipRectPtr pClipRects; + GLboolean scissoredClipRects; /* if true, pClipRects is private storage */ + + + GuTexPalette glbPalette; /* global texture palette */ + + tdfx_interp_func interp; + + points_func PointsFunc; + line_func LineFunc; + triangle_func TriangleFunc; + quad_func QuadFunc; + render_func *RenderVBRawTab; + tdfxRenderEltsFunc RenderElementsRaw; + + + tdfxStats stats; + + /* HACK: Let's get some buffering of vertices happening... + */ + GLuint *buffer; + GLuint buffer_total; + GLuint buffer_used; +}; + +#define TDFX_CONTEXT(ctx) ((tdfxContextPtr)((ctx)->DriverCtx)) + + +extern GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ); +extern void tdfxDestroyContext( tdfxContextPtr fxMesa ); + +extern GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, + tdfxContextPtr fxMesa ); + + +/* Color packing utilities + */ +#define TDFXPACKCOLOR332( r, g, b ) \ + (((b) & 0xe0) | (((g) & 0xe0) >> 3) | (((r) & 0xc0) >> 6)) + +#define TDFXPACKCOLOR1555( r, g, b, a ) \ + ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) + +#define TDFXPACKCOLOR565( r, g, b ) \ + ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) + +#define TDFXPACKCOLOR888( r, g, b ) \ + (((b) << 16) | ((g) << 8) | (r)) + +#define TDFXPACKCOLOR8888( r, g, b, a ) \ + (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) + +#define TDFXPACKCOLOR4444( r, g, b, a ) \ + ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((g) & 0xf0) | ((r) >> 4)) + +static __inline__ GrColor_t tdfxPackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) +{ + switch ( cpp ) { + case 2: + return TDFXPACKCOLOR565( r, g, b ); + case 4: + return TDFXPACKCOLOR8888( r, g, b, a ); + default: + return 0; + } +} + +#define DO_DEBUG 0 +#if DO_DEBUG +extern int TDFX_DEBUG; +#else +#define TDFX_DEBUG 0 +#endif + +#define DEBUG_ALWAYS_SYNC 0x01 +#define DEBUG_VERBOSE_API 0x02 +#define DEBUG_VERBOSE_MSG 0x04 +#define DEBUG_VERBOSE_LRU 0x08 +#define DEBUG_VERBOSE_DRI 0x10 +#define DEBUG_VERBOSE_IOCTL 0x20 +#define DEBUG_VERBOSE_2D 0x40 + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_CONTEXT_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c new file mode 100644 index 000000000..ec5b25871 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c @@ -0,0 +1,273 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_vb.h" +#include "tdfx_pipeline.h" +#include "tdfx_pixels.h" + +#include "enums.h" +#include "pb.h" + + +#define TDFX_DATE "20010104" + + +/* These are used in calls to FX_grColorMaskv() */ +const GLboolean false4[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; +const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE }; + + + +/* KW: Put the word Mesa in the render string because quakeworld + * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE). + * Why? + */ +static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name ) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + + switch ( name ) { + case GL_RENDERER: + { + static char buffer[100]; + char hardware[100]; + + strcpy( hardware, FX_grGetString( fxMesa, GR_HARDWARE ) ); + + if ( strcmp( hardware, "Voodoo3 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo3" ); + } + else if ( strcmp( hardware, "Voodoo Banshee (tm)" ) == 0 ) { + strcpy( hardware, "VoodooBanshee" ); + } + else if ( strcmp( hardware, "Voodoo4 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo4" ); + } + else if ( strcmp( hardware, "Voodoo5 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo5" ); + } + else { + /* unexpected result: replace spaces with hyphens */ + int i; + for ( i = 0 ; hardware[i] ; i++ ) { + if ( hardware[i] == ' ' || hardware[i] == '\t' ) + hardware[i] = '-'; + } + } + /* now make the GL_RENDERER string */ + sprintf( buffer, "Mesa DRI %s " TDFX_DATE, hardware ); + return buffer; + } + case GL_VENDOR: + return "VA Linux Systems, Inc."; + default: + return NULL; + } +} + + +/* Return buffer size information. + */ +static void tdfxDDGetBufferSize( GLcontext *ctx, + GLuint *width, GLuint *height ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + *width = fxMesa->width; + *height = fxMesa->height; +} + + +static GLint tdfxDDGetParameteri( const GLcontext *ctx, GLint param ) +{ + switch ( param ) { + case DD_HAVE_HARDWARE_FOG: + return 1; + default: + return 0; + } +} + +/* + * Return the current value of the occlusion test flag and + * reset the flag (hardware counters) to false. + */ +static GLboolean get_occlusion_result( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLboolean result; + + LOCK_HARDWARE( fxMesa ); + + if (ctx->Depth.OcclusionTest) { + if (ctx->OcclusionResult) { + result = GL_TRUE; /* result of software rendering */ + } + else { + FxI32 zfail, in; + zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL); + in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN); + if (in == zfail) + result = GL_FALSE; /* geom was completely occluded */ + else + result = GL_TRUE; /* all or part of geom was visible */ + } + } + else { + result = ctx->OcclusionResultSaved; + } + + /* reset results now */ + grReset(GR_STATS_PIXELS); + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + + UNLOCK_HARDWARE( fxMesa ); + + return result; +} + + +/* + * We're only implementing this function to handle the + * GL_OCCLUSTION_TEST_RESULT_HP case. It's special because it + * has a side-effect: resetting the occlustion result flag. + */ +static GLboolean tdfxDDGetBooleanv( GLcontext *ctx, GLenum pname, + GLboolean *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetDoublev( GLcontext *ctx, GLenum pname, + GLdouble *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLdouble) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetFloatv( GLcontext *ctx, GLenum pname, + GLfloat *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLfloat) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetIntegerv( GLcontext *ctx, GLenum pname, + GLint *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLint) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + + + +#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \ + ((vis->RedBits == r) && \ + (vis->GreenBits == g) && \ + (vis->BlueBits == b) && \ + (vis->AlphaBits == a)) + +void tdfxDDInitDriverFuncs( GLcontext *ctx ) +{ + if ( MESA_VERBOSE & VERBOSE_DRIVER ) { + fprintf( stderr, "tdfx: %s()\n", __FUNCTION__ ); + } + + ctx->Driver.GetString = tdfxDDGetString; + ctx->Driver.GetBufferSize = tdfxDDGetBufferSize; + ctx->Driver.Error = NULL; + ctx->Driver.GetParameteri = tdfxDDGetParameteri; + + if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) ) + { + ctx->Driver.DrawPixels = tdfx_drawpixels_R8G8B8A8; + ctx->Driver.ReadPixels = tdfx_readpixels_R8G8B8A8; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) ) + { + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = tdfx_readpixels_R5G6B5; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + else + { + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = NULL; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + + ctx->Driver.RegisterVB = tdfxDDRegisterVB; + ctx->Driver.UnregisterVB = tdfxDDUnregisterVB; + ctx->Driver.ResetVB = NULL; + ctx->Driver.ResetCvaVB = NULL; + + if ( !getenv( "TDFX_NO_FAST" ) ) { + ctx->Driver.BuildPrecalcPipeline = tdfxDDBuildPrecalcPipeline; + } else { + ctx->Driver.BuildPrecalcPipeline = NULL; + } + ctx->Driver.BuildEltPipeline = NULL; + + ctx->Driver.OptimizeImmediatePipeline = NULL; + ctx->Driver.OptimizePrecalcPipeline = NULL; + + ctx->Driver.GetBooleanv = tdfxDDGetBooleanv; + ctx->Driver.GetDoublev = tdfxDDGetDoublev; + ctx->Driver.GetFloatv = tdfxDDGetFloatv; + ctx->Driver.GetIntegerv = tdfxDDGetIntegerv; + ctx->Driver.GetPointerv = NULL; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h new file mode 100644 index 000000000..1bb037a0f --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h @@ -0,0 +1,47 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_DD_H__ +#define __TDFX_DD_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern void tdfxDDInitDriverFuncs( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c new file mode 100644 index 000000000..f41d86b3c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c @@ -0,0 +1,594 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "types.h" +#include "enums.h" +#include "cva.h" +#include "vertices.h" +#include "mmath.h" + +#include "tdfx_context.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" +#include "tdfx_pipeline.h" + + +struct tdfx_fast_tab { + void (*build_vertices)( struct vertex_buffer *VB, GLuint do_cliptest ); + void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ); + void (*project_vertices)( struct vertex_buffer *VB ); + void (*project_clipped_vertices)( struct vertex_buffer *VB ); +}; + + +#define POINT(x) tdfx_draw_point( fxMesa, &vert[x], psize ) +#define LINE(x,y) tdfx_draw_line( fxMesa, &vert[x], &vert[y], lwidth ) +#define TRI(x,y,z) grDrawTriangle( &vert[x], &vert[y], &vert[z] ); + + +#define INDIRECT_TRI(x,y,z) \ +do { \ + out[next_elt + 0] = &vert[x]; \ + out[next_elt + 1] = &vert[y]; \ + out[next_elt + 2] = &vert[z]; \ + next_elt += 3; \ +} while (0) + + + +/* Direct, and no clipping required. The clip funcs have not been + * written yet, so this is only useful for the fast path. + */ +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint e; \ + for ( e = start ; e < count ; e++ ) \ + POINT( elt[e] ); \ +} while (0) + +#define RENDER_LINE( i1, i ) \ +do { \ + GLuint e1 = elt[i1], e = elt[i]; \ + LINE( e1, e ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + if ( parity ) { \ + GLuint tmp = e2; e2 = e1; e1 = tmp; \ + } \ + TRI( e2, e1, e ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + TRI( e3, e2, e ); \ + TRI( e2, e1, e ); \ +} while (0) + +#define LOCAL_VARS \ + tdfxVertexPtr vert = TDFX_DRIVER_DATA(VB)->verts; \ + const GLuint *elt = VB->EltPtr->data; \ + GLcontext *ctx = VB->ctx; \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + const GLfloat lwidth = ctx->Line.Width; \ + const GLfloat psize = ctx->Point.Size; \ + (void) lwidth; (void) psize; (void) vert; (void) fxMesa; + +#define TAG(x) tdfx_##x##_smooth_direct +#include "render_tmp.h" + + + +/* Indirect, and no clipping required. The clip funcs have not been + * written yet, so this is only useful for the fast path. + */ +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint e; \ + for ( e = start ; e < count ; e++ ) \ + POINT( elt[e] ); \ +} while (0) + +#define RENDER_LINE( i1, i ) \ +do { \ + GLuint e1 = elt[i1], e = elt[i]; \ + LINE( e1, e ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + if ( parity ) { \ + GLuint tmp = e2; e2 = e1; e1 = tmp; \ + } \ + INDIRECT_TRI( e2, e1, e ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + TRI( e3, e2, e ); \ + TRI( e2, e1, e ); \ +} while (0) + +#define LOCAL_VARS \ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); \ + tdfxVertexPtr vert = fxVB->verts; \ + GLuint next_elt = fxVB->last_elt; \ + tdfxVertexPtr *out = fxVB->elts; \ + const GLuint *elt = VB->EltPtr->data; \ + GLcontext *ctx = VB->ctx; \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + const GLfloat lwidth = ctx->Line.Width; \ + const GLfloat psize = ctx->Point.Size; \ + (void) lwidth; (void) psize; (void) vert; (void) out; (void) fxMesa; + +#define POSTFIX \ + fxVB->last_elt = next_elt; + +#define TAG(x) tdfx_##x##_smooth_indirect +#include "render_tmp.h" + + + +#define NEGATIVE(f) (f < 0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) +#define LINTERP(T, A, B) ((A) + (T) * ((B) - (A))) + +#define INTERP_RGBA( t, out, a, b ) \ +do { \ + int i; \ + for ( i = 0 ; i < 4 ; i++ ) { \ + GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR( a[i] ); \ + GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR( b[i] ); \ + GLfloat fo = LINTERP( t, fa, fb ); \ + FLOAT_COLOR_TO_UBYTE_COLOR( out[i], fo ); \ + } \ +} while (0) + +#define CLIP( SGN, V, PLANE ) \ +do { \ + if ( mask & PLANE ) { \ + GLuint *indata = inlist[in]; \ + GLuint *outdata = inlist[in ^= 1]; \ + GLuint nr = n; \ + GLfloat *J = verts[indata[nr-1]].f; \ + GLfloat dpJ = (SGN J[V]) + J[3]; \ + \ + inlist[0] = vlist1; \ + for ( i = n = 0 ; i < nr ; i++ ) { \ + GLuint elt_i = indata[i]; \ + GLfloat *I = verts[elt_i].f; \ + GLfloat dpI = (SGN I[V]) + I[3]; \ + \ + if ( DIFFERENT_SIGNS( dpI, dpJ ) ) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t, *in, *out; \ + \ + if ( NEGATIVE( dpI ) ) { \ + t = dpI / (dpI - dpJ); \ + in = I; \ + out = J; \ + } else { \ + t = dpJ / (dpJ - dpI); \ + in = J; \ + out = I; \ + } \ + \ + interp( t, O, in, out ); \ + \ + clipmask[next_vert] = 0; \ + outdata[n++] = next_vert++; \ + } \ + \ + clipmask[elt_i] |= PLANE; /* don't set up */ \ + \ + if ( !NEGATIVE( dpI ) ) { \ + outdata[n++] = elt_i; \ + clipmask[elt_i] &= ~PLANE; /* set up after all */ \ + } \ + \ + J = I; \ + dpJ = dpI; \ + } \ + \ + if ( n < 3 ) return; \ + } \ +} while (0) + +#define LINE_CLIP( x, y, z, w, PLANE ) \ +do { \ + if ( mask & PLANE ) { \ + GLfloat dpI = DOT4V( I, x, y, z, w ); \ + GLfloat dpJ = DOT4V( J, x, y, z, w ); \ + \ + if ( DIFFERENT_SIGNS( dpI, dpJ ) ) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t = dpI / (dpI - dpJ); \ + \ + interp( t, O, I, J ); \ + \ + clipmask[next_vert] = 0; \ + \ + if ( NEGATIVE( dpI ) ) { \ + clipmask[elts[0]] |= PLANE; \ + I = O; \ + elts[0] = next_vert++; \ + } else { \ + clipmask[elts[1]] |= PLANE; \ + J = O; \ + elts[1] = next_vert++; \ + } \ + } else if ( NEGATIVE( dpI ) ) { \ + return; \ + } \ + } \ +} while (0) + + +static __inline void tdfx_tri_clip( GLuint **p_elts, + tdfxVertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + tdfx_interp_func interp ) +{ + GLuint *elts = *p_elts; + GLuint next_vert = *p_next_vert; + GLuint in = 0; + GLuint n = 3; + GLuint vlist1[VB_MAX_CLIPPED_VERTS]; + GLuint vlist2[VB_MAX_CLIPPED_VERTS]; + GLuint *inlist[2]; + GLuint *out; + GLuint i; + + inlist[0] = elts; + inlist[1] = vlist2; + + CLIP( -, 0, CLIP_RIGHT_BIT ); + CLIP( +, 0, CLIP_LEFT_BIT ); + CLIP( -, 1, CLIP_TOP_BIT ); + CLIP( +, 1, CLIP_BOTTOM_BIT ); + CLIP( -, 2, CLIP_FAR_BIT ); + CLIP( +, 2, CLIP_NEAR_BIT ); + + /* Convert the planar polygon to a list of triangles */ + out = inlist[in]; + + for ( i = 2 ; i < n ; i++ ) { + elts[0] = out[0]; + elts[1] = out[i-1]; + elts[2] = out[i]; + elts += 3; + } + + *p_next_vert = next_vert; + *p_elts = elts; +} + + +static __inline void tdfx_line_clip( GLuint **p_elts, + tdfxVertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + tdfx_interp_func interp ) +{ + GLuint *elts = *p_elts; + GLfloat *I = verts[elts[0]].f; + GLfloat *J = verts[elts[1]].f; + GLuint next_vert = *p_next_vert; + + LINE_CLIP( 1, 0, 0, -1, CLIP_LEFT_BIT ); + LINE_CLIP( -1, 0, 0, 1, CLIP_RIGHT_BIT ); + LINE_CLIP( 0, 1, 0, -1, CLIP_TOP_BIT ); + LINE_CLIP( 0, -1, 0, 1, CLIP_BOTTOM_BIT ); + LINE_CLIP( 0, 0, 1, -1, CLIP_FAR_BIT ); + LINE_CLIP( 0, 0, -1, 1, CLIP_NEAR_BIT ); + + *p_next_vert = next_vert; + *p_elts += 2; +} + + +#define CLIP_POINT( e ) \ +do { \ + if ( mask[e] ) *out++ = e; \ +} while (0) + +#define CLIP_LINE( e1, e0 ) \ +do { \ + GLubyte ormask = mask[e0] | mask[e1]; \ + out[0] = e1; \ + out[1] = e0; \ + out += 2; \ + if ( ormask ) { \ + out-=2; \ + if ( !(mask[e0] & mask[e1]) ) { \ + tdfx_line_clip( &out, verts, mask, \ + &next_vert, ormask, interp ); \ + } \ + } \ +} while (0) + +#define CLIP_TRIANGLE( e2, e1, e0 ) \ +do { \ + GLubyte ormask; \ + out[0] = e2; \ + out[1] = e1; \ + out[2] = e0; \ + out += 3; \ + ormask = mask[e2] | mask[e1] | mask[e0]; \ + if ( ormask ) { \ + out -= 3; \ + if ( !(mask[e2] & mask[e1] & mask[e0]) ) { \ + tdfx_tri_clip( &out, verts, mask, \ + &next_vert, ormask, interp ); \ + } \ + } \ +} while (0) + + + +/* Build a table of functions to clip each primitive type. These + * produce a list of elements in the appropriate 'reduced' primitive, + * ie (points, lines, triangles) containing all the clipped and + * unclipped primitives from the original list. + */ +#define LOCAL_VARS \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx); \ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); \ + GLuint *elt = VB->EltPtr->data; \ + tdfxVertexPtr verts = fxVB->verts; \ + GLuint next_vert = fxVB->last_vert; \ + GLuint *out = fxVB->clipped_elements.data; \ + GLubyte *mask = VB->ClipMask; \ + tdfx_interp_func interp = fxMesa->interp; \ + (void) interp; (void) verts; + +#define POSTFIX \ + fxVB->clipped_elements.count = out - fxVB->clipped_elements.data; \ + fxVB->last_vert = next_vert; + + +#define INIT( x ) + +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint i; \ + for ( i = start ; i < count ; i++ ) \ + CLIP_POINT( elt[i] ); \ +} while (0) + +#define RENDER_LINE( i1, i0 ) \ +do { \ + CLIP_LINE( elt[i1], elt[i0] ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i0, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ + if ( parity ) e2 = elt[i1], e1 = elt[i2]; \ + CLIP_TRIANGLE( e2, e1, e0 ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i0, pv ) \ +do { \ + CLIP_TRIANGLE( elt[i3], elt[i2], elt[i0] ); \ + CLIP_TRIANGLE( elt[i2], elt[i1], elt[i0] ); \ +} while (0) + +#define TAG(x) tdfx_##x##_clip_elt +#include "render_tmp.h" + + + + +/* Pack rgba and/or texture into the remaining half of a 32 byte vertex. + */ +#define CLIP_UBYTE_COLOR 4 +#define CLIP_UBYTE_B 0 +#define CLIP_UBYTE_G 1 +#define CLIP_UBYTE_R 2 +#define CLIP_UBYTE_A 3 +#define CLIP_S0 6 +#define CLIP_T0 7 +#define CLIP_S1 8 +#define CLIP_T1 9 + +#define TYPE (0) +#define TAG(x) x +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT) +#define TAG(x) x##_RGBA +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_TEX0_BIT) +#define TAG(x) x##_TEX0 +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT | TDFX_TEX0_BIT) +#define TAG(x) x##_RGBA_TEX0 +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT | TDFX_TEX0_BIT | TDFX_TEX1_BIT) +#define TAG(x) x##_RGBA_TEX0_TEX1 +#include "tdfx_fasttmp.h" + +/* This one *could* get away with sneaking TEX1 into the color and + * specular slots, thus fitting inside a cache line. Would be even + * better to switch to a smaller vertex. + */ +#define TYPE (TDFX_TEX0_BIT | TDFX_TEX1_BIT) +#define TAG(x) x##_TEX0_TEX1 +#include "tdfx_fasttmp.h" + + + +/* Render elements directly from original list of vertices. + */ +static void tdfx_render_elements_direct( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_smooth_direct[prim]; + GLuint p = 0; + + if ( fxMesa->new_state ) + tdfxDDUpdateHwState( ctx ); + + BEGIN_CLIP_LOOP( fxMesa ); + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + END_CLIP_LOOP( fxMesa ); +} + +/* Render elements indirectly from original list of vertices. + */ +#if 0 +static void tdfx_render_elements_indirect( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_smooth_indirect[prim]; + GLuint p = 0; + + if ( fxMesa->new_state ) + tdfxDDUpdateHwState( ctx ); + + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + + BEGIN_CLIP_LOOP( fxMesa ); + grDrawVertexArray( GR_TRIANGLES, fxVB->last_elt, fxVB->elts ); + END_CLIP_LOOP( fxMesa ); + + fxVB->last_elt = 0; +} +#endif + +/* Very sparsely popluated array - fix the indices. + */ +static struct tdfx_fast_tab fxFastTab[0x80]; + +void tdfxDDFastPathInit( void ) +{ + tdfx_render_init_clip_elt(); + tdfx_render_init_smooth_direct(); + tdfx_render_init_smooth_indirect(); + + tdfx_init_fastpath( &fxFastTab[0] ); + tdfx_init_fastpath_RGBA( &fxFastTab[TDFX_RGBA_BIT] ); + tdfx_init_fastpath_TEX0( &fxFastTab[TDFX_TEX0_BIT] ); + tdfx_init_fastpath_RGBA_TEX0( &fxFastTab[TDFX_RGBA_BIT|TDFX_TEX0_BIT] ); + tdfx_init_fastpath_TEX0_TEX1( &fxFastTab[TDFX_TEX0_BIT|TDFX_TEX1_BIT] ); + tdfx_init_fastpath_RGBA_TEX0_TEX1( &fxFastTab[TDFX_RGBA_BIT|TDFX_TEX0_BIT| + TDFX_TEX1_BIT] ); +} + + +#define VALID_SETUP (TDFX_RGBA_BIT | TDFX_TEX0_BIT | TDFX_TEX1_BIT) + + +void tdfxDDFastPath( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + GLenum prim = ctx->CVA.elt_mode; + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + struct tdfx_fast_tab *tab = &fxFastTab[fxMesa->SetupIndex & VALID_SETUP]; + + if ( fxMesa->new_state ) { + tdfxDDUpdateHwState( ctx ); + } + else if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) { + /* After extensive debugging I discovered that the vertex layout + * may need to be updated at this point. Not sure how this works + * in the other drivers. -BP + */ + LOCK_HARDWARE( fxMesa ); + grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] ); + fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT; + UNLOCK_HARDWARE( fxMesa ); + } + + gl_prepare_arrays_cva( VB ); /* still need this */ + + /* Reserve enough space for the pathological case */ + if ( VB->EltPtr->count * 12 > fxVB->size ) + tdfxDDResizeVB( VB, VB->EltPtr->count * 12 ); + + tab->build_vertices( VB, 1 ); /* object->clip space */ + + if ( VB->ClipOrMask ) { + if ( !VB->ClipAndMask ) { + render_func *clip = tdfx_render_tab_clip_elt; + + fxMesa->interp = tab->interp; + + clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* build new elts */ + + ctx->CVA.elt_mode = gl_reduce_prim[prim]; + VB->EltPtr = &(fxVB->clipped_elements); + + tab->project_clipped_vertices( VB ); /* clip->device space */ + tdfx_render_elements_direct( VB ); /* render using new list */ + } + } else { + tab->project_vertices( VB ); /* clip->device space */ + tdfx_render_elements_direct( VB ); /* render using orig list */ + } + + /* This indicates that there is no cached data to reuse */ + VB->pipeline->data_valid = 0; + VB->pipeline->new_state = 0; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h new file mode 100644 index 000000000..24abcb4eb --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h @@ -0,0 +1,293 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +/* The first part of setup is applied to all vertices, clipped or + * unclipped. This data will be used for clipping, and then all + * vertices with a zero clipmask will be projected to device space. + * + * This could be split into several loops, but - it seems that the + * large stride of the fxVertices makes cache issues the big + * performance factor, and that multiple loops mean multiple cache + * misses.... + */ + +static void TAG(tdfx_setup_full)( struct vertex_buffer *VB, + GLuint do_cliptest ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLfloat * const m = ctx->ModelProjectMatrix.m; + GLuint start = VB->CopyStart; + GLuint count = VB->Count; + + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + gl_xform_points3_v16_general( TDFX_DRIVER_DATA(VB)->verts[start].f, + m, + VB->ObjPtr->start, + VB->ObjPtr->stride, + count - start ); + + if ( do_cliptest ) { + VB->ClipAndMask = ~0; + VB->ClipOrMask = 0; + gl_cliptest_points4_v16( fxVB->verts[start].f, + fxVB->verts[count].f, + &(VB->ClipOrMask), + &(VB->ClipAndMask), + VB->ClipMask + start ); + } + + /* These branches are all resolved at compile time. Hopefully all + * the pointers are valid addresses even when not enabled. + */ + if ( TYPE ) { + GLubyte *color = VB->ColorPtr->start; + GLfloat *tex0_data = VB->TexCoordPtr[fxMesa->tmu_source[0]]->start; + GLfloat *tex1_data = VB->TexCoordPtr[fxMesa->tmu_source[1]]->start; + + const GLuint color_stride = VB->ColorPtr->stride; + const GLuint tex0_stride = VB->TexCoordPtr[fxMesa->tmu_source[0]]->stride; + const GLuint tex1_stride = VB->TexCoordPtr[fxMesa->tmu_source[1]]->stride; + + GLfloat *f = fxVB->verts[start].f; + GLfloat *end = f + (16 * (count - start)); + + while ( f != end ) { + if ( TYPE & TDFX_RGBA_BIT ) { +#if defined(USE_X86_ASM) + __asm__ ( + "movl (%%edx),%%eax \n" + "bswap %%eax \n" + "rorl $8,%%eax \n" + "movl %%eax,16(%%edi) \n" + : + : "d" (color), "D" (f) + : "%eax" ); +#else + GLubyte *col = color; + GLubyte *b = (GLubyte *)&f[CLIP_UBYTE_COLOR]; + b[CLIP_UBYTE_B] = col[2]; + b[CLIP_UBYTE_G] = col[1]; + b[CLIP_UBYTE_R] = col[0]; + b[CLIP_UBYTE_A] = col[3]; +#endif + } + if (TYPE & TDFX_TEX0_BIT) { +#if defined (USE_X86_ASM) + __asm__ ( + "movl (%%ecx), %%eax \n" + "movl %%eax, 24(%%edi) \n" + "movl 4(%%ecx), %%eax \n" + "movl %%eax, 28(%%edi)" + : + : "c" (tex0_data), "D" (f) + : "%eax"); +#else + *(unsigned int *)(f+CLIP_S0) = *(unsigned int *)tex0_data; + *(unsigned int *)(f+CLIP_T0) = *(unsigned int *)(tex0_data+1); +#endif + } + if (TYPE & TDFX_TEX1_BIT) { + /* Hits a second cache line. + */ +#if defined (USE_X86_ASM) + __asm__ ( + "movl (%%esi), %%eax \n" + "movl %%eax, 32(%%edi) \n" + "movl 4(%%esi), %%eax \n" + "movl %%eax, 36(%%edi)" + : + : "S" (tex1_data), "D" (f) + : "%eax"); +#else + *(unsigned int *)(f+CLIP_S1) = *(unsigned int *)tex1_data; + *(unsigned int *)(f+CLIP_T1) = *(unsigned int *)(tex1_data+1); +#endif + } + if ( TYPE & TDFX_RGBA_BIT ) color += color_stride; + if ( TYPE & TDFX_TEX0_BIT ) STRIDE_F( tex0_data, tex0_stride ); + if ( TYPE & TDFX_TEX1_BIT ) STRIDE_F( tex1_data, tex1_stride ); + f += 16; + } + } + + fxVB->clipped_elements.count = start; + fxVB->last_vert = count; +} + + +/* Changed to just put the interp func instead of the whole clip + * routine into the header. Less code and better chance of doing some + * of this stuff in assembly. + */ +static void TAG(tdfx_interp_vert)( GLfloat t, + GLfloat *O, + const GLfloat *I, + const GLfloat *J ) +{ + O[0] = LINTERP( t, I[0], J[0] ); + O[1] = LINTERP( t, I[1], J[1] ); + O[2] = LINTERP( t, I[2], J[2] ); + O[3] = LINTERP( t, I[3], J[3] ); + + if ( TYPE & TDFX_RGBA_BIT ) { + INTERP_RGBA( t, + ((GLubyte *)&(O[4])), + ((GLubyte *)&(I[4])), + ((GLubyte *)&(J[4])) ); + } + + if ( TYPE & TDFX_TEX0_BIT ) { + O[6] = LINTERP( t, I[6], J[6] ); + O[7] = LINTERP( t, I[7], J[7] ); + } + + if ( TYPE & TDFX_TEX1_BIT ) { + O[8] = LINTERP( t, I[8], J[8] ); + O[9] = LINTERP( t, I[9], J[9] ); + } +} + + + +static void TAG(tdfx_project_vertices)( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLfloat *first = fxVB->verts[VB->CopyStart].f; + GLfloat *last = fxVB->verts[fxVB->last_vert].f; + GLfloat m[16]; + GLfloat *f; + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET; + m[MAT_SY] = mat->m[MAT_SY]; + m[MAT_TY] = mat->m[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET; + m[MAT_SZ] = mat->m[MAT_SZ]; + m[MAT_TZ] = mat->m[MAT_TZ]; + + gl_project_v16( first, last, m, 16 * 4 ); + + /* V3 at least requires texcoords to be multiplied by 1/w: + */ + if ( TYPE & (TDFX_TEX0_BIT|TDFX_TEX1_BIT) ) { + + const GLfloat sScale0 = fxMesa->sScale0; + const GLfloat tScale0 = fxMesa->tScale0; + const GLfloat sScale1 = fxMesa->sScale1; + const GLfloat tScale1 = fxMesa->tScale1; + + + for ( f = first ; f != last ; f += 16) { + const GLfloat oow = f[3]; + + if (TYPE & TDFX_TEX0_BIT) { + f[CLIP_S0] *= sScale0 * oow; + f[CLIP_T0] *= tScale0 * oow; + } + + if (TYPE & TDFX_TEX1_BIT) { + f[CLIP_S1] *= sScale1 * oow; + f[CLIP_T1] *= tScale1 * oow; + } + } + } +} + +static void TAG(tdfx_project_clipped_vertices)( struct vertex_buffer *VB ) +{ + GLfloat *f; + + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLfloat *first = fxVB->verts[VB->CopyStart].f; + GLfloat *last = fxVB->verts[fxVB->last_vert].f; + const GLubyte *mask = VB->ClipMask + VB->CopyStart; + GLfloat m[16]; + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET; + m[MAT_SY] = mat->m[MAT_SY]; + m[MAT_TY] = mat->m[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET; + m[MAT_SZ] = mat->m[MAT_SZ]; + m[MAT_TZ] = mat->m[MAT_TZ]; + + gl_project_clipped_v16( first, last, m, 16 * 4, mask ); + + /* V3 at least requires texcoords to be multiplied by 1/w: + */ + if ( TYPE & (TDFX_TEX0_BIT|TDFX_TEX1_BIT) ) { + + const GLfloat sScale0 = fxMesa->sScale0; + const GLfloat tScale0 = fxMesa->tScale0; + const GLfloat sScale1 = fxMesa->sScale1; + const GLfloat tScale1 = fxMesa->tScale1; + + for ( f = first ; f != last ; f += 16, mask++) { + if (!*mask) { + const GLfloat oow = f[3]; + if (TYPE & TDFX_TEX0_BIT) { + f[CLIP_S0] *= sScale0 * oow; + f[CLIP_T0] *= tScale0 * oow; + } + + if (TYPE & TDFX_TEX1_BIT) { + f[CLIP_S1] *= sScale1 * oow; + f[CLIP_T1] *= tScale1 * oow; + } + } + } + } +} + +static void TAG(tdfx_init_fastpath)( struct tdfx_fast_tab *tab ) +{ + tab->build_vertices = TAG(tdfx_setup_full); + tab->interp = TAG(tdfx_interp_vert); + tab->project_vertices = TAG(tdfx_project_vertices); + tab->project_clipped_vertices = TAG(tdfx_project_clipped_vertices); +} + +#undef TYPE +#undef TAG +#undef SIZE diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c new file mode 100644 index 000000000..1f49142be --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c @@ -0,0 +1,122 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include <stdlib.h> +#include <string.h> +#include <dlfcn.h> + +#include "tdfx_context.h" +#include "tdfx_g3ext.h" + + +/* STENCIL extension + */ +GrProc grStencilFuncProc = NULL; +GrProc grStencilMaskProc = NULL; +GrProc grStencilOpProc = NULL; +GrProc grBufferClearExtProc = NULL; +GrProc grColorMaskExtProc = NULL; + +/* COMBINE extension + */ +GrProc grColorCombineExtProc = NULL; +GrProc grTexColorCombineExtProc = NULL; +GrProc grAlphaCombineExtProc = NULL; +GrProc grTexAlphaCombineExtProc = NULL; +GrProc grAlphaBlendFunctionExtProc = NULL; +GrProc grConstantColorValueExtProc = NULL; + +/* Texus 2 + */ +GrProc txImgQuantizeProc = NULL; +GrProc txImgDequantizeFXT1Proc = NULL; +GrProc txErrorSetCallbackProc = NULL; + + +/* Initialize the Glide extensions not exported in the Glide headers. + * This is just plain evil stuff... + */ +void tdfxDDGlideExtensionsInit( void ) +{ + void *handle; + + /* Get Glide3 extension function pointers */ + handle = dlopen( NULL, RTLD_NOW | RTLD_GLOBAL ); + + if ( handle ) { + /* PIXEXT extension */ + grStencilFuncProc = dlsym( handle, "grStencilFunc" ); + grStencilMaskProc = dlsym( handle, "grStencilMask" ); + grStencilOpProc = dlsym( handle, "grStencilOp" ); + grBufferClearExtProc = dlsym( handle, "grBufferClearExt" ); + grColorMaskExtProc = dlsym( handle, "grColorMaskExt" ); + + /* COMBINE extension */ + grColorCombineExtProc = dlsym( handle, "grColorCombineExt" ); + grTexColorCombineExtProc = dlsym( handle, "grTexColorCombineExt" ); + grAlphaCombineExtProc = dlsym( handle, "grAlphaCombineExt" ); + grTexAlphaCombineExtProc = dlsym( handle, "grTexAlphaCombineExt" ); + grAlphaBlendFunctionExtProc = dlsym( handle, "grAlphaBlendFunctionExt" ); + grConstantColorValueExtProc = dlsym( handle, "grConstantColorValueExt" ); + + /* Texus 2 */ + txImgQuantizeProc = dlsym( handle, "txImgQuantize" ); + txImgDequantizeFXT1Proc = dlsym( handle, "_txImgDequantizeFXT1" ); + txErrorSetCallbackProc = dlsym( handle, "txErrorSetCallback" ); + } else { + /* PIXEXT extension */ + grStencilFuncProc = NULL; + grStencilMaskProc = NULL; + grStencilOpProc = NULL; + grBufferClearExtProc = NULL; + grColorMaskExtProc = NULL; + + /* COMBINE extension */ + grColorCombineExtProc = NULL; + grTexColorCombineExtProc = NULL; + grAlphaCombineExtProc = NULL; + grTexAlphaCombineExtProc = NULL; + grAlphaBlendFunctionExtProc = NULL; + grConstantColorValueExtProc = NULL; + + /* Texus 2 */ + txImgQuantizeProc = NULL; + txImgDequantizeFXT1Proc = NULL; + txErrorSetCallbackProc = NULL; + } + + dlclose( handle ); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h new file mode 100644 index 000000000..29cfc0907 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h @@ -0,0 +1,145 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_G3EXT_H__ +#define __TDFX_G3EXT_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <glide.h> +#include <g3ext.h> + +/* + * These are glide extension definitions. These are not + * defined in glide.h. They should really be defined in + * g3ext.h, but they are not. + */ +typedef void (*grStencilFunc_t)( GrCmpFnc_t fnc, GrStencil_t ref, + GrStencil_t mask ); +typedef void (*grStencilMask_t)( GrStencil_t write_mask ); +typedef void (*grStencilOp_t)( GrStencilOp_t stencil_fail, + GrStencilOp_t depth_fail, + GrStencilOp_t depth_pass ); +typedef void (*grBufferClearExt_t)( GrColor_t color, GrAlpha_t alpha, + FxU32 depth, GrStencil_t stencil ); +typedef void (*grColorMaskExt_t)( FxBool r, FxBool g, FxBool b, FxBool a ); + +/* + * "COMBINE" extension for Napalm + */ +typedef void (*grColorCombineExt_t)( GrCCUColor_t a, GrCombineMode_t a_mode, + GrCCUColor_t b, GrCombineMode_t b_mode, + GrCCUColor_t c, FxBool c_invert, + GrCCUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grTexColorCombineExt_t)( FxU32 tmu, + GrTCCUColor_t a, + GrCombineMode_t a_mode, + GrTCCUColor_t b, + GrCombineMode_t b_mode, + GrTCCUColor_t c, FxBool c_invert, + GrTCCUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grAlphaCombineExt_t)( GrACUColor_t a, GrCombineMode_t a_mode, + GrACUColor_t b, GrCombineMode_t b_mode, + GrACUColor_t c, FxBool c_invert, + GrACUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grTexAlphaCombineExt_t)( FxU32 tmu, + GrTACUColor_t a, + GrCombineMode_t a_mode, + GrTACUColor_t b, + GrCombineMode_t b_mode, + GrTACUColor_t c, FxBool c_invert, + GrTACUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grAlphaBlendFunctionExt_t)( GrAlphaBlendFnc_t rgb_sf, + GrAlphaBlendFnc_t rgb_df, + GrAlphaBlendOp_t rgb_op, + GrAlphaBlendFnc_t alpha_sf, + GrAlphaBlendFnc_t alpha_df, + GrAlphaBlendOp_t alpha_op); +typedef void (*grConstantColorValueExt_t)( FxU32 tmu, GrColor_t value ); + + + +/* + * These are functions to compress and decompress images. + * The types of the first and second parameters are not exactly + * right. The texus library declares them to be "char *", not + * "void *". However, "void *" is more correct, and more convenient. + */ +typedef void (*txImgQuantize_t)( void *dst, void *src, + int w, int h, + FxU32 format, FxU32 dither ); +typedef void (*txImgDeQuantize_t)( void *dst, void *src, int w, int h ); + +/* + * These next three declarations should probably be taken from + * texus.h. However, there are duplicate declarations in g3ext.h + * and texus.h which make it hard to include them both. + */ +typedef void (*TxErrorCallbackFnc_t)( const char *string, FxBool fatal ); +typedef void (*txErrorSetCallback_t)( TxErrorCallbackFnc_t fnc, + TxErrorCallbackFnc_t *old_fnc ); + +/* PIXEXT extension + */ +GrProc grStencilFuncProc; +GrProc grStencilMaskProc; +GrProc grStencilOpProc; +GrProc grBufferClearExtProc; +GrProc grColorMaskExtProc; + +/* COMBINE extension + */ +GrProc grColorCombineExtProc; +GrProc grTexColorCombineExtProc; +GrProc grAlphaCombineExtProc; +GrProc grTexAlphaCombineExtProc; +GrProc grAlphaBlendFunctionExtProc; +GrProc grConstantColorValueExtProc; + +/* Texus extensions??? + */ +GrProc txImgQuantizeProc; +GrProc txImgDequantizeFXT1Proc; +GrProc txErrorSetCallbackProc; + +extern void tdfxDDGlideExtensionsInit( void ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c deleted file mode 100644 index 0c0ae8b0c..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c,v 1.5 2000/09/26 15:56:50 tsi Exp $ */ - -/* - * Authors: - * Daryll Strauss <daryll@precisioninsight.com> - * - */ - -#ifdef GLX_DIRECT_RENDERING - -#include <X11/Xlibint.h> -#include "xf86dri.h" -#include "tdfx_dri.h" -#include "fxdrv.h" - - -#ifdef DEBUG_LOCKING -char *prevLockFile = 0; -int prevLockLine = 0; -#endif - -static void -performMagic(__DRIscreenPrivate * driScrnPriv) -{ - tdfxScreenPrivate *gPriv = (tdfxScreenPrivate *) driScrnPriv->private; - TDFXDRIPtr gDRIPriv = (TDFXDRIPtr) driScrnPriv->pDevPriv; - - gPriv->regs.handle = gDRIPriv->regs; - gPriv->regs.size = gDRIPriv->regsSize; - gPriv->deviceID = gDRIPriv->deviceID; - gPriv->width = gDRIPriv->width; - gPriv->height = gDRIPriv->height; - gPriv->mem = gDRIPriv->mem; - gPriv->cpp = gDRIPriv->cpp; - gPriv->stride = gDRIPriv->stride; - gPriv->fifoOffset = gDRIPriv->fifoOffset; - gPriv->fifoSize = gDRIPriv->fifoSize; - gPriv->fbOffset = gDRIPriv->fbOffset; - gPriv->backOffset = gDRIPriv->backOffset; - gPriv->depthOffset = gDRIPriv->depthOffset; - gPriv->textureOffset = gDRIPriv->textureOffset; - gPriv->textureSize = gDRIPriv->textureSize; -} - -GLboolean -tdfxMapAllRegions(__DRIscreenPrivate * driScrnPriv) -{ - tdfxScreenPrivate *gPriv = (tdfxScreenPrivate *) driScrnPriv->private; - - /* First, pick apart pDevPriv & friends */ - performMagic(driScrnPriv); - - if (drmMap(driScrnPriv->fd, gPriv->regs.handle, gPriv->regs.size, - &gPriv->regs.map)) { - return GL_FALSE; - } - - return GL_TRUE; -} - -void -tdfxUnmapAllRegions(__DRIscreenPrivate * driScrnPriv) -{ - tdfxScreenPrivate *gPriv = (tdfxScreenPrivate *) driScrnPriv->private; - - drmUnmap(gPriv->regs.map, gPriv->regs.size); -} - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c deleted file mode 100644 index 34c973ba8..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c,v 1.7 2000/12/08 19:36:23 alanh Exp $ */ - -/* - * Authors: - * Daryll Strauss <daryll@precisioninsight.com> - * - */ - -#ifdef GLX_DIRECT_RENDERING - -#include <glide.h> -#include "fxdrv.h" - - -GLboolean -tdfxInitHW(__DRIdrawablePrivate * driDrawPriv, fxMesaContext fxMesa) -{ - /* KW: Would be nice to make one of these a member of the other. - */ - __DRIscreenPrivate *driScrnPriv = driDrawPriv->driScreenPriv; - tdfxScreenPrivate *sPriv = (tdfxScreenPrivate *) driScrnPriv->private; - -#ifdef DEBUG_LOCKING - fprintf(stderr, "Debug locking enabled\n"); -#endif - - if (fxMesa->initDone) - return GL_TRUE; - - fxMesa->width = driDrawPriv->w; - fxMesa->height = driDrawPriv->h; - - /* We have to use a light lock here, because we can't do any glide - operations yet. No use of FX_* functions in this function. */ - DRM_LIGHT_LOCK(driScrnPriv->fd, &driScrnPriv->pSAREA->lock, - driDrawPriv->driContextPriv->hHWContext); - FX_grGlideInit_NoLock(); - - fxMesa->board = 0; - FX_grSstSelect_NoLock(fxMesa->board); - - if (sPriv->deviceID == 0x3) - fxMesa->haveTwoTMUs = GL_FALSE; - else - fxMesa->haveTwoTMUs = GL_TRUE; - - fxMesa->glideContext = - FX_grSstWinOpen_NoLock((FxU32) - 1, GR_RESOLUTION_NONE, - GR_REFRESH_NONE, GR_COLORFORMAT_ABGR, - GR_ORIGIN_LOWER_LEFT, 2, 1); - - grDRIResetSAREA(); - DRM_UNLOCK(driScrnPriv->fd, &driScrnPriv->pSAREA->lock, - driDrawPriv->driContextPriv->hHWContext); - - fxMesa->needClip = 1; - - if (!fxMesa->glideContext || !fxDDInitFxMesaContext(fxMesa)) - return GL_FALSE; - - fxMesa->initDone = GL_TRUE; - - return GL_TRUE; -} - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c new file mode 100644 index 000000000..f63541be9 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c @@ -0,0 +1,96 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_lock.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" +#include "tdfx_tris.h" + + +void tdfxGetLock( tdfxContextPtr fxMesa ) +{ + __DRIcontextPrivate *cPriv = fxMesa->driContext; + __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; + __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; + TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + + sizeof(XF86DRISAREARec)); + int stamp = dPriv->lastStamp; + int one_rect = (fxMesa->numClipRects <= 1); + + drmGetLock( fxMesa->driFd, fxMesa->hHWContext, 0 ); + + /* This macro will update dPriv's cliprects if needed */ + XMESA_VALIDATE_DRAWABLE_INFO( cPriv->display, sPriv, dPriv ); + + if ( saPriv->fifoOwner != fxMesa->hHWContext ) { + grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead ); + } + + if ( saPriv->ctxOwner != fxMesa->hHWContext ) { + /* This sequence looks a little odd. Glide mirrors the state, and + * when you get the state you are forcing the mirror to be up to + * date, and then getting a copy from the mirror. You can then force + * that state onto the hardware when you set the state. + */ + void *state; + state = malloc( FX_grGetInteger_NoLock( FX_GLIDE_STATE_SIZE ) ); + FX_grGlideGetState_NoLock( state ); + FX_grGlideSetState_NoLock( state ); + free( state ); + } + +#if 0 + if ( saPriv->texOwner != fxMesa->hHWContext ) { + tdfxTMRestoreTextures_NoLock( fxMesa ); + } +#endif + + if ( *dPriv->pStamp != stamp || saPriv->ctxOwner != fxMesa->hHWContext ) { + tdfxUpdateClipping(fxMesa->glCtx); + tdfxUploadClipping(fxMesa); + } + + /* Detect if we have swapped between 1 and >1 cliprects, and change + * triangle funcs if necessary. + */ + if (one_rect != (fxMesa->numClipRects <= 1)) + tdfxDDToggleTriCliprects( fxMesa->glCtx ); + + DEBUG_LOCK(); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h new file mode 100644 index 000000000..3cfa52c0e --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h @@ -0,0 +1,149 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_LOCK_H__ +#define __TDFX_LOCK_H__ + +#ifdef GLX_DIRECT_RENDERING + +/* You can turn this on to find locking conflicts. + */ +#define DEBUG_LOCKING 0 + +#if DEBUG_LOCKING +extern char *prevLockFile; +extern int prevLockLine; + +#define DEBUG_LOCK() \ + do { \ + prevLockFile = (__FILE__); \ + prevLockLine = (__LINE__); \ + } while (0) + +#define DEBUG_RESET() \ + do { \ + prevLockFile = 0; \ + prevLockLine = 0; \ + } while (0) + +#define DEBUG_CHECK_LOCK() \ + do { \ + if ( prevLockFile ) { \ + fprintf( stderr, \ + "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \ + prevLockFile, prevLockLine, __FILE__, __LINE__ ); \ + exit( 1 ); \ + } \ + } while (0) + +#else + +#define DEBUG_LOCK() +#define DEBUG_RESET() +#define DEBUG_CHECK_LOCK() + +#endif /* DEBUG_LOCKING */ + + +extern void tdfxGetLock( tdfxContextPtr fxMesa ); + + +/* !!! We may want to separate locks from locks with validation. + This could be used to improve performance for those things + commands that do not do any drawing !!! */ + +#define DRM_LIGHT_LOCK_RETURN(fd,lock,context,__ret) \ + do { \ + DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \ + if (__ret) drmGetLock(fd,context,0); \ + } while(0) + +#define LOCK_HARDWARE( fxMesa ) \ + do { \ + char __ret = 0; \ + \ + DEBUG_CHECK_LOCK(); \ + DRM_CAS( fxMesa->driHwLock, fxMesa->hHWContext, \ + DRM_LOCK_HELD | fxMesa->hHWContext, __ret ); \ + if ( __ret ) { \ + tdfxGetLock( fxMesa ); \ + } \ + DEBUG_LOCK(); \ + } while (0) + +/* Unlock the hardware using the global current context */ +#define UNLOCK_HARDWARE( fxMesa ) \ + do { \ + DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); \ + DEBUG_RESET(); \ + } while (0) + +/* + * This pair of macros makes a loop over the drawing operations + * so it is not self contained and doesn't have the nice single + * statement semantics of most macros. + */ +#define BEGIN_CLIP_LOOP(fxMesa) \ + do { \ + LOCK_HARDWARE( fxMesa ); \ + BEGIN_CLIP_LOOP_LOCKED( fxMesa ) + +#define BEGIN_CLIP_LOOP_LOCKED(fxMesa) \ + do { \ + int _nc = fxMesa->numClipRects; \ + while (_nc--) { \ + if (fxMesa->numClipRects > 1) { \ + int _height = fxMesa->screen_height; \ + grClipWindow(fxMesa->pClipRects[_nc].x1, \ + _height - fxMesa->pClipRects[_nc].y2, \ + fxMesa->pClipRects[_nc].x2, \ + _height - fxMesa->pClipRects[_nc].y1); \ + } + + +#define END_CLIP_LOOP_LOCKED( fxMesa ) \ + } \ + } while (0) + +#define END_CLIP_LOOP( fxMesa ) \ + END_CLIP_LOOP_LOCKED( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + } while (0) + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_LOCK_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c new file mode 100644 index 000000000..b26e174c8 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c @@ -0,0 +1,177 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_pipeline.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" + +#include "vbindirect.h" + +static struct gl_pipeline_stage tdfx_fast_stage = { + "TDFX Fast Path", + (PIPE_OP_VERT_XFORM | + PIPE_OP_RAST_SETUP_0 | + PIPE_OP_RAST_SETUP_1 | + PIPE_OP_RENDER), + PIPE_PRECALC, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + tdfxDDFastPath +}; + +#define ILLEGAL_ENABLES (TEXTURE0_3D | \ + TEXTURE1_3D | \ + ENABLE_TEXMAT0 | \ + ENABLE_TEXMAT1 | \ + ENABLE_TEXGEN0 | \ + ENABLE_TEXGEN1 | \ + ENABLE_USERCLIP | \ + ENABLE_LIGHT | \ + ENABLE_FOG) + +/* Build the PRECALC pipeline with our stage, if possible. Otherwise, + * return GL_FALSE. + */ +GLboolean tdfxDDBuildPrecalcPipeline( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_pipeline *pipe = &ctx->CVA.pre; + + if ( (fxMesa->RenderIndex & ~TDFX_CLIPRECT_BIT) == 0 && + (ctx->Enabled & ILLEGAL_ENABLES) == 0 && +#ifdef VAO + (ctx->Array.Current->Flags & (VERT_OBJ_234 | +#else + (ctx->Array.Flags & (VERT_OBJ_234 | +#endif + VERT_TEX0_4 | + VERT_TEX1_4 | + VERT_ELT)) == (VERT_OBJ_23 | VERT_ELT) ) + { + pipe->stages[0] = &tdfx_fast_stage; + pipe->stages[1] = 0; + pipe->new_inputs = ctx->RenderFlags & VERT_DATA; + pipe->ops = pipe->stages[0]->ops; + + fxMesa->using_fast_path = GL_TRUE; + return GL_TRUE; + } + + if ( fxMesa->using_fast_path ) { + fxMesa->using_fast_path = GL_FALSE; + + ctx->CVA.VB->ClipOrMask = 0; + ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS; +#ifdef VAO + ctx->Array.NewArrayState |= ctx->Array.Current->Summary; +#else + ctx->Array.NewArrayState |= ctx->Array.Summary; +#endif + } + + return GL_FALSE; +} + + +static void tdfxDDCheckRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *d ) +{ + d->type = PIPE_IMMEDIATE | PIPE_PRECALC; + d->inputs = ctx->RenderFlags; + + d->outputs = VERT_SETUP_FULL; + + if ( ctx->IndirectTriangles & DD_SW_SETUP ) + d->type = PIPE_IMMEDIATE; +} + + +static void tdfxDDRenderElements(struct vertex_buffer *VB) +{ + if (VB->ClipOrMask) { + gl_render_elts( VB ); + } else { + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + fxMesa->RenderElementsRaw( VB ); + } +} + + +/* Register the pipeline with our stages included */ +GLuint tdfxDDRegisterPipelineStages( struct gl_pipeline_stage *out, + const struct gl_pipeline_stage *in, + GLuint nr ) +{ + int i, o; + + for ( i = o = 0 ; i < nr ; i++ ) { + switch ( in[i].ops ) { + + case PIPE_OP_RAST_SETUP_0: + out[o] = in[i]; + out[o].cva_state_change = (NEW_LIGHTING | + NEW_TEXTURING | + NEW_RASTER_OPS); + out[o].state_change = ~0; + out[o].check = tdfxDDCheckPartialRasterSetup; + out[o].run = tdfxDDPartialRasterSetup; + o++; + break; + + case PIPE_OP_RAST_SETUP_0 | PIPE_OP_RAST_SETUP_1: + out[o] = in[i]; + out[o].check = tdfxDDCheckRasterSetup; + out[o].run = tdfxDDDoRasterSetup; + o++; + break; + + case PIPE_OP_RENDER: + out[o] = in[i]; + if (in[i].type == PIPE_PRECALC) + out[o].run = tdfxDDRenderElements; + o++; + break; + + default: + out[o++] = in[i]; + break; + } + } + + return o; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h new file mode 100644 index 000000000..a87a8cf74 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h @@ -0,0 +1,54 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_PIPELINE_H__ +#define __TDFX_PIPELINE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern GLboolean tdfxDDBuildPrecalcPipeline( GLcontext *ctx ); +extern GLuint tdfxDDRegisterPipelineStages( struct gl_pipeline_stage *out, + const struct gl_pipeline_stage *in, + GLuint nr ); + +extern void tdfxDDFastPathInit( void ); +extern void tdfxDDFastPath( struct vertex_buffer *VB ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c new file mode 100644 index 000000000..e650e6615 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c @@ -0,0 +1,638 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Nathan Hand <nhand@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_vb.h" +#include "tdfx_pipeline.h" +#include "tdfx_pixels.h" +#include "tdfx_render.h" + +#include "../../image.h" + +#if 0 +/* test if window coord (px,py) is visible */ +static GLboolean +inClipRects(tdfxContextPtr fxMesa, int px, int py) +{ + int i; + for (i = 0; i < fxMesa->numClipRects; i++) { + if ((px >= fxMesa->pClipRects[i].x1) && + (px < fxMesa->pClipRects[i].x2) && + (py >= fxMesa->pClipRects[i].y1) && + (py < fxMesa->pClipRects[i].y2)) return GL_TRUE; + } + return GL_FALSE; +} +#endif + +/* test if rectangle of pixels (px,py) (px+width,py+height) is visible */ +static GLboolean +inClipRects_Region(tdfxContextPtr fxMesa, int x, int y, int width, int height) +{ + int i; + int x1, y1, x2, y2; + int xmin, xmax, ymin, ymax, pixelsleft; + + y1 = y - height + 1; y2 = y; + x1 = x; x2 = x + width - 1; + pixelsleft = width * height; + + for (i = 0; i < fxMesa->numClipRects; i++) + { + /* algorithm requires x1 < x2 and y1 < y2 */ + if ((fxMesa->pClipRects[i].x1 < fxMesa->pClipRects[i].x2)) { + xmin = fxMesa->pClipRects[i].x1; + xmax = fxMesa->pClipRects[i].x2-1; + } else { + xmin = fxMesa->pClipRects[i].x2; + xmax = fxMesa->pClipRects[i].x1-1; + } + if ((fxMesa->pClipRects[i].y1 < fxMesa->pClipRects[i].y2)) { + ymin = fxMesa->pClipRects[i].y1; + ymax = fxMesa->pClipRects[i].y2-1; + } else { + ymin = fxMesa->pClipRects[i].y2; + ymax = fxMesa->pClipRects[i].y1-1; + } + + /* reject trivial cases */ + if (xmax < x1) continue; + if (ymax < y1) continue; + if (xmin > x2) continue; + if (ymin > y2) continue; + + /* find the intersection */ + if (xmin < x1) xmin = x1; + if (ymin < y1) ymin = y1; + if (xmax > x2) xmax = x2; + if (ymax > y2) ymax = y2; + + pixelsleft -= (xmax-xmin+1) * (ymax-ymin+1); + } + + return pixelsleft == 0; +} + +#if 0 +GLboolean +tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte * bitmap) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + TdfxU16 color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if (ctx->RasterMask & (ALPHATEST_BIT | + BLEND_BIT | + DEPTH_BIT | + FOG_BIT | + LOGIC_OP_BIT | + SCISSOR_BIT | + STENCIL_BIT | + MASKING_BIT | + ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return GL_TRUE; /* totally scissored away */ + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); + /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f); */ + if (fxMesa->bgrOrder) { + color = (TdfxU16) + (((TdfxU16) 0xf8 & b) << (11 - 3)) | + (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) | + (((TdfxU16) 0xf8 & r) >> 3); + } + else + color = (TdfxU16) + (((TdfxU16) 0xf8 & r) << (11 - 3)) | + (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) | + (((TdfxU16) 0xf8 & b) >> 3); + } + + info.size = sizeof(info); + if (!TDFX_grLfbLock(fxMesa, + GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_565, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { +#ifndef TDFX_SILENT + fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n"); +#endif + return GL_TRUE; + } + + { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + /* The dest stride depends on the hardware and whether we're drawing + * to the front or back buffer. This compile-time test seems to do + * the job for now. + */ + const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 2); + GLint row; + /* compute dest address of bottom-left pixel in bitmap */ + GLushort *dst = (GLushort *) info.lfbPtr + + (winY - py) * dstStride + (winX + px); + + for (row = 0; row < height; row++) { + const GLubyte *src = + (const GLubyte *) _mesa_image_address(finalUnpack, + bitmap, width, height, + GL_COLOR_INDEX, + GL_BITMAP, 0, row, 0); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + + TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); + return GL_TRUE; +} +#endif + +#if 0 +GLboolean +tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte * bitmap) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLuint color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if (ctx->RasterMask & (ALPHATEST_BIT | + BLEND_BIT | + DEPTH_BIT | + FOG_BIT | + LOGIC_OP_BIT | + SCISSOR_BIT | + STENCIL_BIT | + MASKING_BIT | + ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return GL_TRUE; /* totally scissored away */ + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); + GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0f); + color = PACK_BGRA32(r, g, b, a); + } + + info.size = sizeof(info); + if (!TDFX_grLfbLock(fxMesa, GR_LFB_WRITE_ONLY, + fxMesa->currentFB, GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { +#ifndef TDFX_SILENT + fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n"); +#endif + return GL_TRUE; + } + + { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + GLint dstStride; + GLuint *dst; + GLint row; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + dstStride = fxMesa->screen_width; + dst = + (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + + px); + } + else { + dstStride = info.strideInBytes / 4; + dst = + (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + + px); + } + + /* compute dest address of bottom-left pixel in bitmap */ + for (row = 0; row < height; row++) { + const GLubyte *src = + (const GLubyte *) _mesa_image_address(finalUnpack, + bitmap, width, height, + GL_COLOR_INDEX, + GL_BITMAP, 0, row, 0); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + + TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); + return GL_TRUE; +} +#endif + +GLboolean +tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid * dstImage) +{ + if (!(format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5)) { + return GL_FALSE; /* format/type not recognised */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + LOCK_HARDWARE( fxMesa ); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->ReadBuffer, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == + GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2); + const GLushort *src = (const GLushort *) info.lfbPtr + + scrY * srcStride + scrX; + const GLubyte *dst = (GLubyte *) _mesa_image_address(packing, + dstImage, width, height, format, type, 0, 0, 0); + const GLint dstStride = _mesa_image_row_stride(packing, + width, format, type); + + if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { + /* directly memcpy 5R6G5B pixels into client's buffer */ + const GLint widthInBytes = width * 2; + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer); + } + UNLOCK_HARDWARE( fxMesa ); + return result; + } +} + +GLboolean +tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid * dstImage) +{ + if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) && + !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + return GL_FALSE; /* format/type not optimised */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + LOCK_HARDWARE(fxMesa); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->ReadBuffer, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) + { + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 4); + const GLuint *src = (const GLuint *) info.lfbPtr + + scrY * srcStride + scrX; + const GLint dstStride = + _mesa_image_row_stride(packing, width, format, type); + const GLubyte *dst = (GLubyte *) _mesa_image_address(packing, + dstImage, width, height, format, type, 0, 0, 0); + const GLint widthInBytes = width * 4; + + if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) || + (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer); + } + UNLOCK_HARDWARE(fxMesa); + return result; + } +} + +GLboolean +tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid * pixels) +{ + if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) && + !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + return GL_FALSE; /* format/type not optimised */ + } + + if (ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F) { + return GL_FALSE; /* can't scale pixels */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + if (ctx->RasterMask & (~BLEND_BIT)) { + return GL_FALSE; /* can't do any raster ops, except blend */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + /* lock early to make sure cliprects are right */ + LOCK_HARDWARE(fxMesa); + + /* make sure hardware has latest blend funcs */ + if (ctx->RasterMask & BLEND_BIT) { + fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC; + tdfxEmitHwStateLocked( fxMesa ); + } + + /* look for clipmasks, giveup if region obscured */ + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + if (!inClipRects_Region(fxMesa, scrX, scrY, width, height)) { + UNLOCK_HARDWARE(fxMesa); + return GL_FALSE; + } + } + + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->DrawBuffer, + GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) + { + const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width * 4) : (info.strideInBytes); + const GLubyte *dst = (const GLubyte *) info.lfbPtr + + scrY * dstStride + scrX * 4; + const GLint srcStride = + _mesa_image_row_stride(unpack, width, format, type); + const GLubyte *src = (GLubyte *) _mesa_image_address(unpack, + pixels, width, height, format, type, 0, 0, 0); + const GLint widthInBytes = width * 4; + + if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) || + (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst -= dstStride; + src += srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer); + } + UNLOCK_HARDWARE(fxMesa); + return result; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h new file mode 100644 index 000000000..655f03bd1 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h @@ -0,0 +1,80 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Nathan Hand <nhand@valinux.com> + * + */ + +#ifndef __TDFX_PIXELS_H__ +#define __TDFX_PIXELS_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern GLboolean +tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern GLboolean +tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern GLboolean +tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage ); + +extern GLboolean +tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage ); + +extern GLboolean +tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c new file mode 100644 index 000000000..97931a351 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c @@ -0,0 +1,864 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "dri_glide.h" +#include "tdfx_context.h" +#include "tdfx_render.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" + +/* Clear the color and/or depth buffers. + */ +static GLbitfield tdfxDDClear( GLcontext *ctx, + GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLbitfield softwareMask = mask & (DD_ACCUM_BIT); + const GLuint stencil_size = + fxMesa->haveHwStencil ? fxMesa->glVis->StencilBits : 0; + +#if 0 + GLuint flags; + + FLUSH_BATCH( fxMesa ); + + if ( mask & DD_FRONT_LEFT_BIT ) { + flags |= TDFX_FRONT; + mask &= ~DD_FRONT_LEFT_BIT; + } + + if ( mask & DD_BACK_LEFT_BIT ) { + flags |= TDFX_BACK; + mask &= ~DD_BACK_LEFT_BIT; + } + + if ( (mask & DD_DEPTH_BIT) && ctx->Depth.Mask ) { + flags |= TDFX_DEPTH; + mask &= ~DD_DEPTH_BIT; + } + + if ( (mask & DD_STENCIL_BIT) && fxMesa->haveHwStencil ) { + clear.flags |= TDFX_STENCIL; + mask &= ~DD_STENCIL_BIT; + } + + if ( !flags ) + return mask; + + LOCK_HARDWARE( fxMesa ); + + + if ( flags & TDFX_FRONT ) { + + } + + if ( flags & TDFX_BACK ) { + + } + + if ( flags & TDFX_DEPTH ) { + + } + + if ( flags & TDFX_STENCIL ) { + grStencilMask( fxMesa->Stencil.WriteMask ); + /* set stencil ref value = desired clear value */ + grStencilFunc( GR_CMP_ALWAYS, fxMesa->Stencil.Clear, 0xff ); + grStencilOp( GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE ); + grEnable( GR_STENCIL_MODE_EXT ); + + if ( ctx->Stencil.Enabled ) { + grStencilOp( fxMesa->Stencil.FailFunc, + fxMesa->Stencil.ZFailFunc, + fxMesa->Stencil.ZPassFunc ); + grStencilMask( fxMesa->Stencil.WriteMask ); + grStencilFunc( fxMesa->Stencil.Function, + fxMesa->Stencil.RefValue, + fxMesa->Stencil.ValueMask ); + grEnable_NoLock( GR_STENCIL_MODE_EXT ); + } else { + grDisable( GR_STENCIL_MODE_EXT ); + } + + } + UNLOCK_HARDWARE( fxMesa ); + +#else + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %d, %d, %d, %d )\n", + __FUNCTION__, (int) x, (int) y, (int) width, (int) height ); + } + + /* Need this check to respond to glScissor and clipping updates */ + if ((fxMesa->new_state & (TDFX_NEW_CLIP | TDFX_NEW_DEPTH)) || + (fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK)) { + tdfxDDUpdateHwState(ctx); + } + + /* we can't clear accum buffers */ + mask &= ~(DD_ACCUM_BIT); + + if (mask & DD_STENCIL_BIT) { + if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask != 0xff) { + /* Napalm seems to have trouble with stencil write masks != 0xff */ + /* do stencil clear in software */ + mask &= ~(DD_STENCIL_BIT); + softwareMask |= DD_STENCIL_BIT; + } + } + + if (fxMesa->glVis->RedBits != 8) { + /* can only do color masking if running in 24/32bpp on Napalm */ + if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] || + ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) { + softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)); + mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); + } + } + + if (fxMesa->haveHwStencil) { + /* + * If we want to clear stencil, it must be enabled + * in the HW, even if the stencil test is not enabled + * in the OGL state. + */ + LOCK_HARDWARE(fxMesa); + if (mask & DD_STENCIL_BIT) { + FX_grStencilMask_NoLock(/*ctx->Stencil.WriteMask*/ 0xff); + /* set stencil ref value = desired clear value */ + FX_grStencilFunc_NoLock(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff); + FX_grStencilOp_NoLock(GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE); + FX_grEnable_NoLock(GR_STENCIL_MODE_EXT); + } + else { + FX_grDisable_NoLock(GR_STENCIL_MODE_EXT); + } + UNLOCK_HARDWARE(fxMesa); + } + + /* + * FIXME: This is just plain ugly... + */ + BEGIN_CLIP_LOOP(fxMesa); + { + /* + * This could probably be done fancier but doing each possible case + * explicitly is less error prone. + */ + switch (mask & ~DD_STENCIL_BIT) { + case DD_BACK_LEFT_BIT | DD_DEPTH_BIT: + /* back buffer & depth */ + FX_grColorMaskv_NoLock(ctx, true4); /* work around Voodoo3 bug */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) { + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + } + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT: + /* XXX it appears that the depth buffer isn't cleared when + * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set. + * This is a work-around/ + */ + /* clear depth */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grColorMaskv_NoLock(ctx, false4); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + /* clear front */ + FX_grColorMaskv_NoLock(ctx, true4); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_BACK_LEFT_BIT: + /* back buffer only */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT: + /* front buffer only */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT: + /* front and back */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT: + /* clear front */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + /* clear back and depth */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Mask) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_DEPTH_BIT: + /* just the depth buffer */ + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grColorMaskv_NoLock(ctx, false4); + FX_grDepthMask_NoLock(FXTRUE); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + FX_grColorMaskv_NoLock(ctx, true4); + if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (!ctx->Depth.Test || !ctx->Depth.Mask) + FX_grDepthMask_NoLock(FXFALSE); + break; + default: + /* clear no color buffers or depth buffer but might clear stencil */ + if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) { + /* XXX need this RenderBuffer call to work around Glide bug */ + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grDepthMask_NoLock(FXFALSE); + FX_grColorMaskv_NoLock(ctx, false4); + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + FX_grColorMaskv_NoLock(ctx, true4); + if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + } + } + } + END_CLIP_LOOP(fxMesa); + + if (fxMesa->haveHwStencil && (mask & DD_STENCIL_BIT)) { + /* We changed the stencil state above. Signal that we need to + * upload it again. + */ + fxMesa->dirty |= TDFX_UPLOAD_STENCIL; + } + +#endif + return softwareMask; +} + + + +static void tdfxDDFinish( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + grFinish(); + UNLOCK_HARDWARE( fxMesa ); +} + +static void tdfxDDFlush( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + grFlush(); + UNLOCK_HARDWARE( fxMesa ); +} + + + +static const char *texSource(int k) +{ + switch (k) { + case GR_CMBX_ZERO: + return "GR_CMBX_ZERO"; + case GR_CMBX_TEXTURE_ALPHA: + return "GR_CMBX_TEXTURE_ALPHA"; + case GR_CMBX_ALOCAL: + return "GR_CMBX_ALOCAL"; + case GR_CMBX_AOTHER: + return "GR_CMBX_AOTHER"; + case GR_CMBX_B: + return "GR_CMBX_B"; + case GR_CMBX_CONSTANT_ALPHA: + return "GR_CMBX_CONSTANT_ALPHA"; + case GR_CMBX_CONSTANT_COLOR: + return "GR_CMBX_CONSTANT_COLOR"; + case GR_CMBX_DETAIL_FACTOR: + return "GR_CMBX_DETAIL_FACTOR"; + case GR_CMBX_ITALPHA: + return "GR_CMBX_ITALPHA"; + case GR_CMBX_ITRGB: + return "GR_CMBX_ITRGB"; + case GR_CMBX_LOCAL_TEXTURE_ALPHA: + return "GR_CMBX_LOCAL_TEXTURE_ALPHA"; + case GR_CMBX_LOCAL_TEXTURE_RGB: + return "GR_CMBX_LOCAL_TEXTURE_RGB"; + case GR_CMBX_LOD_FRAC: + return "GR_CMBX_LOD_FRAC"; + case GR_CMBX_OTHER_TEXTURE_ALPHA: + return "GR_CMBX_OTHER_TEXTURE_ALPHA"; + case GR_CMBX_OTHER_TEXTURE_RGB: + return "GR_CMBX_OTHER_TEXTURE_RGB"; + case GR_CMBX_TEXTURE_RGB: + return "GR_CMBX_TEXTURE_RGB"; + case GR_CMBX_TMU_CALPHA: + return "GR_CMBX_TMU_CALPHA"; + case GR_CMBX_TMU_CCOLOR: + return "GR_CMBX_TMU_CCOLOR"; + default: + return ""; + } +} + +static const char *texMode(int k) +{ + switch (k) { + case GR_FUNC_MODE_ZERO: + return "GR_FUNC_MODE_ZERO"; + case GR_FUNC_MODE_X: + return "GR_FUNC_MODE_X"; + case GR_FUNC_MODE_ONE_MINUS_X: + return "GR_FUNC_MODE_ONE_MINUS_X"; + case GR_FUNC_MODE_NEGATIVE_X: + return "GR_FUNC_MODE_NEGATIVE_X"; + case GR_FUNC_MODE_X_MINUS_HALF: + return "GR_FUNC_MODE_X_MINUS_HALF"; + default: + return ""; + } +} + +static const char *texInvert(int k) +{ + return k ? "FXTRUE" : "FXFALSE"; +} + +static void uploadTextureEnv( tdfxContextPtr fxMesa ) +{ + if (TDFX_IS_NAPALM(fxMesa)) { + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { +#if 0 + printf("upload env %d\n", unit); + printf(" cSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceA)); + printf(" cModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeA)); + printf(" cSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceB)); + printf(" cModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeB)); + printf(" cSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceC)); + printf(" cInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertC)); + printf(" cSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceD)); + printf(" cInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertD)); + printf(" cShift = %d\t", fxMesa->TexCombineExt[unit].Color.Shift); + printf(" cInvert = %d\n", fxMesa->TexCombineExt[unit].Color.Invert); + printf(" aSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceA)); + printf(" aModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeA)); + printf(" aSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceB)); + printf(" aModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeB)); + printf(" aSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceC)); + printf(" aInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertC)); + printf(" aSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceD)); + printf(" aInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertD)); + printf(" aShift = %d\t", fxMesa->TexCombineExt[unit].Alpha.Shift); + printf(" aInvert = %d\n", fxMesa->TexCombineExt[unit].Alpha.Invert); + printf(" Color = 0x%08x\n", fxMesa->TexCombineExt[unit].EnvColor); +#endif + (*grTexColorCombineExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].Color.SourceA, + fxMesa->TexCombineExt[unit].Color.ModeA, + fxMesa->TexCombineExt[unit].Color.SourceB, + fxMesa->TexCombineExt[unit].Color.ModeB, + fxMesa->TexCombineExt[unit].Color.SourceC, + fxMesa->TexCombineExt[unit].Color.InvertC, + fxMesa->TexCombineExt[unit].Color.SourceD, + fxMesa->TexCombineExt[unit].Color.InvertD, + fxMesa->TexCombineExt[unit].Color.Shift, + fxMesa->TexCombineExt[unit].Color.Invert); + (*grTexAlphaCombineExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].Alpha.SourceA, + fxMesa->TexCombineExt[unit].Alpha.ModeA, + fxMesa->TexCombineExt[unit].Alpha.SourceB, + fxMesa->TexCombineExt[unit].Alpha.ModeB, + fxMesa->TexCombineExt[unit].Alpha.SourceC, + fxMesa->TexCombineExt[unit].Alpha.InvertC, + fxMesa->TexCombineExt[unit].Alpha.SourceD, + fxMesa->TexCombineExt[unit].Alpha.InvertD, + fxMesa->TexCombineExt[unit].Alpha.Shift, + fxMesa->TexCombineExt[unit].Alpha.Invert); + (*grConstantColorValueExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].EnvColor); + } + } + else { + /* Voodoo3 */ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + struct tdfx_texcombine *comb = &fxMesa->TexCombine[unit]; + FX_grTexCombine_NoLock(TDFX_TMU0 + unit, + comb->FunctionRGB, + comb->FactorRGB, + comb->FunctionAlpha, + comb->FactorAlpha, + comb->InvertRGB, + comb->InvertAlpha); + } + } +} + + +static void uploadTextureParams( tdfxContextPtr fxMesa ) +{ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + const struct tdfx_texparams *p = &fxMesa->TexParams[unit]; + /* + printf("upload params %d\n", unit); + printf(" clamp %x %x\n", env->sClamp, env->tClamp); + printf(" filter %x %x\n", env->minFilt, env->magFilt); + printf(" mipmap %x %x\n", env->mmMode, env->LODblend); + printf(" lod bias %f\n", env->LodBias); + */ + FX_grTexClampMode_NoLock(GR_TMU0 + unit, p->sClamp, p->tClamp); + FX_grTexFilterMode_NoLock(GR_TMU0 + unit, p->minFilt, p->magFilt); + FX_grTexMipMapMode_NoLock(GR_TMU0 + unit, p->mmMode, p->LODblend); + FX_grTexLodBiasValue_NoLock(GR_TMU0 + unit, p->LodBias); + } +} + + +static void uploadTextureSource( tdfxContextPtr fxMesa ) +{ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + const struct tdfx_texsource *src = &fxMesa->TexSource[unit]; + /* + printf("upload source %d @ %d %p\n", unit, src->StartAddress, src->Info); + */ + if (src->Info) { + /* + printf(" smallLodLog2=%d largeLodLog2=%d ar=%d format=%d data=%p\n", + src->Info->smallLodLog2, src->Info->largeLodLog2, + src->Info->aspectRatioLog2, src->Info->format, + src->Info->data); + */ + FX_grTexSource_NoLock(GR_TMU0 + unit, + src->StartAddress, + src->EvenOdd, + src->Info); + } + } +} + + +static void uploadTextureImages( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + if (ctx->Texture.Unit[unit].ReallyEnabled == TEXTURE0_2D) { + struct gl_texture_object *tObj = ctx->Texture.Unit[unit].CurrentD[2]; + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + if (ti && ti->reloadImages) { + /* + printf("download texture image on unit %d\n", unit); + */ + tdfxTMDownloadTexture(fxMesa, tObj); + ti->reloadImages = GL_FALSE; + } + } + } +} + + + +/* + * If scissoring is enabled, compute intersection of scissor region + * with all X clip rects, resulting in new cliprect list. + * If number of cliprects is zero or one, call grClipWindow to setup + * the clip region. Otherwise we'll call grClipWindow inside the + * BEGIN_CLIP_LOOP macro. + */ +void tdfxUploadClipping( tdfxContextPtr fxMesa ) +{ + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; + + assert(dPriv); + + if (fxMesa->numClipRects == 0) { + /* all drawing clipped away */ + grClipWindow(0, 0, 0, 0); + } + else if (fxMesa->numClipRects == 1) { + grClipWindow(fxMesa->pClipRects[0].x1, + fxMesa->screen_height - fxMesa->pClipRects[0].y2, + fxMesa->pClipRects[0].x2, + fxMesa->screen_height - fxMesa->pClipRects[0].y1); + } + /* else, we'll do a cliprect loop around all drawing */ + + grDRIPosition( dPriv->x, dPriv->y, dPriv->w, dPriv->h, + fxMesa->numClipRects, fxMesa->pClipRects ); +} + + +void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa ) +{ + if ( !fxMesa->dirty ) + return; + + if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_COMBINE ) { + if (TDFX_IS_NAPALM(fxMesa)) { + (*grColorCombineExtProc)(fxMesa->ColorCombineExt.SourceA, + fxMesa->ColorCombineExt.ModeA, + fxMesa->ColorCombineExt.SourceB, + fxMesa->ColorCombineExt.ModeB, + fxMesa->ColorCombineExt.SourceC, + fxMesa->ColorCombineExt.InvertC, + fxMesa->ColorCombineExt.SourceD, + fxMesa->ColorCombineExt.InvertD, + fxMesa->ColorCombineExt.Shift, + fxMesa->ColorCombineExt.Invert); + } + else { + /* Voodoo 3 */ + grColorCombine( fxMesa->ColorCombine.Function, + fxMesa->ColorCombine.Factor, + fxMesa->ColorCombine.Local, + fxMesa->ColorCombine.Other, + fxMesa->ColorCombine.Invert ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_COMBINE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_COMBINE ) { + if (TDFX_IS_NAPALM(fxMesa)) { + (*grAlphaCombineExtProc)(fxMesa->AlphaCombineExt.SourceA, + fxMesa->AlphaCombineExt.ModeA, + fxMesa->AlphaCombineExt.SourceB, + fxMesa->AlphaCombineExt.ModeB, + fxMesa->AlphaCombineExt.SourceC, + fxMesa->AlphaCombineExt.InvertC, + fxMesa->AlphaCombineExt.SourceD, + fxMesa->AlphaCombineExt.InvertD, + fxMesa->AlphaCombineExt.Shift, + fxMesa->AlphaCombineExt.Invert); + } + else { + /* Voodoo 3 */ + grAlphaCombine( fxMesa->AlphaCombine.Function, + fxMesa->AlphaCombine.Factor, + fxMesa->AlphaCombine.Local, + fxMesa->AlphaCombine.Other, + fxMesa->AlphaCombine.Invert ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_COMBINE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_RENDER_BUFFER ) { + grRenderBuffer( fxMesa->DrawBuffer ); + fxMesa->dirty &= ~TDFX_UPLOAD_RENDER_BUFFER; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE) { + grStipplePattern( fxMesa->Stipple.Pattern ); + grStippleMode( fxMesa->Stipple.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_TEST ) { + grAlphaTestFunction( fxMesa->Color.AlphaFunc ); + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_TEST; + } + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_REF ) { + grAlphaTestReferenceValue( fxMesa->Color.AlphaRef ); + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_REF; + } + if ( fxMesa->dirty & TDFX_UPLOAD_BLEND_FUNC ) { + if (grAlphaBlendFunctionExtProc) { + (*grAlphaBlendFunctionExtProc)( fxMesa->Color.BlendSrcRGB, + fxMesa->Color.BlendDstRGB, + GR_BLEND_OP_ADD, + fxMesa->Color.BlendSrcA, + fxMesa->Color.BlendDstA, + GR_BLEND_OP_ADD ); + } + else { + grAlphaBlendFunction( fxMesa->Color.BlendSrcRGB, + fxMesa->Color.BlendDstRGB, + fxMesa->Color.BlendSrcA, + fxMesa->Color.BlendDstA ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_BLEND_FUNC; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MODE ) { + grDepthBufferMode( fxMesa->Depth.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MODE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_BIAS ) { + grDepthBiasLevel( fxMesa->Depth.Bias ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_BIAS; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_FUNC ) { + grDepthBufferFunction( fxMesa->Depth.Func ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_FUNC; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MASK ) { + grDepthMask( fxMesa->Depth.Mask ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MASK; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_DITHER) { + grDitherMode( fxMesa->Color.Dither ); + } + + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_MODE ) { + grFogMode( fxMesa->Fog.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_MODE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_COLOR ) { + grFogColorValue( fxMesa->Fog.Color ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_COLOR; + } + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_TABLE ) { + grFogTable( fxMesa->Fog.Table ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_TABLE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) { + grCullMode( fxMesa->CullMode ); + fxMesa->dirty &= ~TDFX_UPLOAD_CULL; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CLIP ) { + tdfxUploadClipping( fxMesa ); + fxMesa->dirty &= ~TDFX_UPLOAD_CLIP; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK ) { + if ( grColorMaskExtProc && fxMesa->glCtx->Visual->RedBits == 8) { + grColorMaskExtProc( fxMesa->Color.ColorMask[RCOMP], + fxMesa->Color.ColorMask[GCOMP], + fxMesa->Color.ColorMask[BCOMP], + fxMesa->Color.ColorMask[ACOMP] ); + } else { + grColorMask( fxMesa->Color.ColorMask[RCOMP] || + fxMesa->Color.ColorMask[GCOMP] || + fxMesa->Color.ColorMask[BCOMP], + fxMesa->Color.ColorMask[ACOMP] ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_MASK; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CONSTANT_COLOR ) { + grConstantColorValue( fxMesa->Color.MonoColor ); + fxMesa->dirty &= ~TDFX_UPLOAD_CONSTANT_COLOR; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_LINE ) { + if (fxMesa->glCtx->Line.SmoothFlag && fxMesa->glCtx->Line.Width == 1.0) + grEnable(GR_AA_ORDERED); + else + grDisable(GR_AA_ORDERED); + fxMesa->dirty &= ~TDFX_UPLOAD_LINE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) { + if (fxMesa->glCtx->Stencil.Enabled) { + grEnable(GR_STENCIL_MODE_EXT); + FX_grStencilOp_NoLock(fxMesa->Stencil.FailFunc, + fxMesa->Stencil.ZFailFunc, + fxMesa->Stencil.ZPassFunc); + FX_grStencilFunc_NoLock(fxMesa->Stencil.Function, + fxMesa->Stencil.RefValue, + fxMesa->Stencil.ValueMask); + FX_grStencilMask_NoLock(fxMesa->Stencil.WriteMask); + } + else { + grDisable(GR_STENCIL_MODE_EXT); + } + fxMesa->dirty &= ~TDFX_UPLOAD_STENCIL; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) { + grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] ); + fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_ENV ) { + uploadTextureEnv(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_ENV; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PARAMS ) { + uploadTextureParams(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PARAMS; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PALETTE ) { + if (fxMesa->TexPalette.Data) { + grTexDownloadTable(fxMesa->TexPalette.Type, fxMesa->TexPalette.Data); + } + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PALETTE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_SOURCE ) { + uploadTextureSource(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_SOURCE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_IMAGES ) { + uploadTextureImages(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_IMAGES; + } + + fxMesa->dirty = 0; +} + + + +void tdfxDDInitRenderFuncs( GLcontext *ctx ) +{ + ctx->Driver.Clear = tdfxDDClear; + ctx->Driver.Finish = tdfxDDFinish; + ctx->Driver.Flush = tdfxDDFlush; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h new file mode 100644 index 000000000..9d1c25069 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h @@ -0,0 +1,54 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_RENDER_H__ +#define __TDFX_RENDER_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "tdfx_context.h" + +extern void tdfxDDInitRenderFuncs( GLcontext *ctx ); + +extern void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa ); + +extern void tdfxUploadClipping( tdfxContextPtr fxMesa ); + +#define FLUSH_BATCH( fxMesa ) + + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c new file mode 100644 index 000000000..801cf42e0 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c @@ -0,0 +1,106 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include <X11/Xlibint.h> + +#include "tdfx_dri.h" +#include "tdfx_context.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" +#include "tdfx_pipeline.h" + + +#ifdef DEBUG_LOCKING +char *prevLockFile = 0; +int prevLockLine = 0; +#endif + + +GLboolean tdfxCreateScreen( __DRIscreenPrivate *sPriv ) +{ + tdfxScreenPrivate *fxScreen; + TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; + + /* Allocate the private area */ + fxScreen = (tdfxScreenPrivate *) Xmalloc( sizeof(tdfxScreenPrivate) ); + if ( !fxScreen ) + return GL_FALSE; + + fxScreen->driScrnPriv = sPriv; + sPriv->private = (void *) fxScreen; + + fxScreen->regs.handle = fxDRIPriv->regs; + fxScreen->regs.size = fxDRIPriv->regsSize; + fxScreen->deviceID = fxDRIPriv->deviceID; + fxScreen->width = fxDRIPriv->width; + fxScreen->height = fxDRIPriv->height; + fxScreen->mem = fxDRIPriv->mem; + fxScreen->cpp = fxDRIPriv->cpp; + fxScreen->stride = fxDRIPriv->stride; + fxScreen->fifoOffset = fxDRIPriv->fifoOffset; + fxScreen->fifoSize = fxDRIPriv->fifoSize; + fxScreen->fbOffset = fxDRIPriv->fbOffset; + fxScreen->backOffset = fxDRIPriv->backOffset; + fxScreen->depthOffset = fxDRIPriv->depthOffset; + fxScreen->textureOffset = fxDRIPriv->textureOffset; + fxScreen->textureSize = fxDRIPriv->textureSize; + + + if ( drmMap( sPriv->fd, fxScreen->regs.handle, + fxScreen->regs.size, &fxScreen->regs.map ) ) { + return GL_FALSE; + } + + tdfxDDSetupInit(); + tdfxDDTriangleFuncsInit(); + tdfxDDFastPathInit(); + + tdfxDDGlideExtensionsInit(); + + return GL_TRUE; +} + +void tdfxDestroyScreen( __DRIscreenPrivate *sPriv ) +{ + tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; + + if ( fxScreen ) { + drmUnmap( fxScreen->regs.map, fxScreen->regs.size ); + + Xfree( fxScreen ); + sPriv->private = NULL; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h new file mode 100644 index 000000000..330c394a6 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h @@ -0,0 +1,77 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_SCREEN_H__ +#define __TDFX_SCREEN_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "dri_mesaint.h" + +typedef struct { + drmHandle handle; + drmSize size; + drmAddress map; +} tdfxRegion, *tdfxRegionPtr; + +typedef struct { + tdfxRegion regs; + + int deviceID; + int width; + int height; + int mem; + int cpp; + int stride; + + int fifoOffset; + int fifoSize; + + int fbOffset; + int backOffset; + int depthOffset; + int textureOffset; + int textureSize; + + __DRIscreenPrivate *driScrnPriv; +} tdfxScreenPrivate; + + +extern GLboolean tdfxCreateScreen( __DRIscreenPrivate *driScrnPriv ); +extern void tdfxDestroyScreen( __DRIscreenPrivate *driScrnPriv ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c new file mode 100644 index 000000000..61dafe3a8 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c @@ -0,0 +1,1335 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_span.h" +#include "tdfx_render.h" + + +#define DBG 0 + + +#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \ + tdfxScreenPrivate *fxPriv = fxMesa->fxScreen; \ + GLuint pitch = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) \ + ? (fxMesa->screen_width * BYTESPERPIXEL) : \ + (info.strideInBytes); \ + GLuint height = fxMesa->height; \ + char *buf = (char *)((char *)info.lfbPtr + \ + dPriv->x * fxPriv->cpp + \ + dPriv->y * pitch); \ + GLuint p; \ + (void) buf; (void) p; + + +#define INIT_MONO_PIXEL( p ) p = fxMesa->Color.MonoColor; + +#define CLIPPIXEL( _x, _y ) ( _x >= minx && _x < maxx && \ + _y >= miny && _y < maxy ) + +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } + +#define Y_FLIP(_y) (height - _y - 1) + + +#define HW_WRITE_LOCK() \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + FLUSH_BATCH( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + LOCK_HARDWARE( fxMesa ); \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \ + { + +#define HW_WRITE_UNLOCK() \ + grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer ); \ + } + + +#define HW_READ_LOCK() \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + FLUSH_BATCH( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + LOCK_HARDWARE( fxMesa ); \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \ + { + +#define HW_READ_UNLOCK() \ + grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer ); \ + } + + +#define HW_WRITE_CLIPLOOP() \ + do { \ + int _nc = fxMesa->numClipRects; \ + while (_nc--) { \ + int minx = fxMesa->pClipRects[_nc].x1 - fxMesa->x_offset; \ + int miny = fxMesa->pClipRects[_nc].y1 - fxMesa->y_offset; \ + int maxx = fxMesa->pClipRects[_nc].x2 - fxMesa->x_offset; \ + int maxy = fxMesa->pClipRects[_nc].y2 - fxMesa->y_offset; + +#define HW_READ_CLIPLOOP() \ + do { \ + const __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \ + XF86DRIClipRectPtr rect = dPriv->pClipRects; \ + int _nc = dPriv->numClipRects; \ + while (_nc--) { \ + const int minx = rect->x1 - fxMesa->x_offset; \ + const int miny = rect->y1 - fxMesa->y_offset; \ + const int maxx = rect->x2 - fxMesa->x_offset; \ + const int maxy = rect->y2 - fxMesa->y_offset; \ + rect++; + +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) + + + +#define LFB_MODE GR_LFBWRITEMODE_565 + + +/* 16 bit, RGB565 color spanline and pixel functions */ \ + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ + rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \ + rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \ + rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \ + rgba[3] = 0xff; \ + } while (0) + +#define TAG(x) tdfx##x##_RGB565 +#define BYTESPERPIXEL 2 +#include "spantmp.h" +#undef BYTESPERPIXEL + + +/* 16 bit, BGR565 color spanline and pixel functions */ \ +#if 0 + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)b & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)r & 0xf8) >> 3)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ + rgba[0] = (p << 3) & 0xf8; \ + rgba[1] = (p >> 3) & 0xfc; \ + rgba[2] = (p >> 8) & 0xf8; \ + rgba[3] = 0xff; \ + } while (0) + +#define TAG(x) tdfx##x##_BGR565 +#define BYTESPERPIXEL 2 +#include "spantmp.h" +#undef BYTESPERPIXEL +#endif + + +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_888 + + +/* 24 bit, RGB888 color spanline and pixel functions */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(buf + _x*3 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 0xff; \ +} while (0) + +#define TAG(x) tdfx##x##_RGB888 +#define BYTESPERPIXEL 4 +#include "spantmp.h" +#undef BYTESPERPIXEL + + +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_8888 + + +/* 32 bit, ARGB8888 color spanline and pixel functions */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16) | \ + (a << 24) ) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = (p >> 24) & 0xff; \ +} while (0) + +#define TAG(x) tdfx##x##_ARGB8888 +#define BYTESPERPIXEL 4 +#include "spantmp.h" +#undef BYTESPERPIXEL + + + +/* ================================================================ + * Old span functions below... + */ + + +/* + * Examine the cliprects to generate an array of flags to indicate + * which pixels in a span are visible. Note: (x,y) is a screen + * coordinate. + */ +static void +generate_vismask(const tdfxContextPtr fxMesa, GLint x, GLint y, GLint n, + GLubyte vismask[]) +{ + GLboolean initialized = GL_FALSE; + GLint i, j; + + /* Ensure we clear the visual mask */ + MEMSET(vismask, 0, n); + + /* turn on flags for all visible pixels */ + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + + if (y >= rect->y1 && y < rect->y2) { + if (x >= rect->x1 && x + n <= rect->x2) { + /* common case, whole span inside cliprect */ + MEMSET(vismask, 1, n); + return; + } + if (x < rect->x2 && x + n >= rect->x1) { + /* some of the span is inside the rect */ + GLint start, end; + if (!initialized) { + MEMSET(vismask, 0, n); + initialized = GL_TRUE; + } + if (x < rect->x1) + start = rect->x1 - x; + else + start = 0; + if (x + n > rect->x2) + end = rect->x2 - x; + else + end = n; + assert(start >= 0); + assert(end <= n); + for (j = start; j < end; j++) + vismask[j] = 1; + } + } + } +} + +/* + * Examine cliprects and determine if the given screen pixel is visible. + */ +static GLboolean +visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY) +{ + int i; + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + if (scrX >= rect->x1 && + scrX < rect->x2 && + scrY >= rect->y1 && scrY < rect->y2) return GL_TRUE; + } + return GL_FALSE; +} + + + +/* + * Depth buffer read/write functions. + */ +/* + * To read the frame buffer, we need to lock and unlock it. The + * four macros {READ,WRITE}_FB_SPAN_{LOCK,UNLOCK} + * do this for us. + * + * Note that the lock must be matched with an unlock. These + * macros include a spare curly brace, so they must + * be syntactically matched. + * + * Note, also, that you can't lock a buffer twice with different + * modes. That is to say, you can't lock a buffer in both read + * and write modes. The strideInBytes and LFB pointer will be + * the same with read and write locks, so you can use either. + * o The HW has different state for reads and writes, so + * locking it twice may give screwy results. + * o The DRM won't let you lock twice. It hangs. This is probably + * because of the LOCK_HARDWARE IN THE *_FB_SPAN_LOCK macros, + * and could be eliminated with nonlocking lock routines. But + * what's the point after all. + */ +#define READ_FB_SPAN_LOCK(fxMesa, info, target_buffer) \ + UNLOCK_HARDWARE(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + (info).size=sizeof(info); \ + if (grLfbLock(GR_LFB_READ_ONLY, \ + target_buffer, \ + GR_LFBWRITEMODE_ANY, \ + GR_ORIGIN_UPPER_LEFT, \ + FXFALSE, \ + &(info))) { + +#define READ_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ + grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \ + } else { \ + fprintf(stderr, "tdfxDriver: Can't get %s (%d) read lock\n", \ + (target_buffer == GR_BUFFER_BACKBUFFER) \ + ? "back buffer" \ + : ((target_buffer == GR_BUFFER_AUXBUFFER) \ + ? "depth buffer" \ + : "unknown buffer"), \ + target_buffer); \ + } + +#define WRITE_FB_SPAN_LOCK(fxMesa, info, target_buffer, write_mode) \ + UNLOCK_HARDWARE(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + info.size=sizeof(info); \ + if (grLfbLock(GR_LFB_WRITE_ONLY, \ + target_buffer, \ + write_mode, \ + GR_ORIGIN_UPPER_LEFT, \ + FXFALSE, \ + &info)) { + +#define WRITE_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ + grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \ + } else { \ + fprintf(stderr, "tdfxDriver: Can't get %s (%d) write lock\n", \ + (target_buffer == GR_BUFFER_BACKBUFFER) \ + ? "back buffer" \ + : ((target_buffer == GR_BUFFER_AUXBUFFER) \ + ? "depth buffer" \ + : "unknown buffer"), \ + target_buffer); \ + } + +/* + * Because the Linear Frame Buffer is not necessarily aligned + * with the depth buffer, we have to do some fiddling + * around to get the right addresses. + * + * Perhaps a picture is in order. The Linear Frame Buffer + * looks like this: + * + * |<----------------------info.strideInBytes------------->| + * |<-----physicalStrideInBytes------->| + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * | | | + * | Legal Memory | Forbidden Zone | + * | | | + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * + * You can only reliably read and write legal locations. Reads + * and writes from the Forbidden Zone will return undefined values, + * and may cause segmentation faults. + * + * Now, the depth buffer may not end up in a location such each + * scan line is an LFB line. For example, the depth buffer may + * look like this: + * + * wrapped ordinary. + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * |0000000000000000000000 | | back + * |1111111111111111111111 | | buffer + * |2222222222222222222222 | | + * |4096b align. padxx00000000000000000| Forbidden Zone | depth + * |0000 11111111111111111| | buffer + * |1111 22222222222222222| | + * |2222 | | + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * where each number is the scan line number. We know it will + * be aligned on 128 byte boundaries, at least. Aligning this + * on a scanline boundary causes the back and depth buffers to + * thrash in the SST1 cache. (Note that the back buffer is always + * allocated at the beginning of LFB memory, and so it is always + * properly aligned with the LFB stride.) + * + * We call the beginning of the line (which is the rightmost + * part of the depth line in the picture above) the *ordinary* part + * of the scanline, and the end of the line (which is the + * leftmost part, one line below) the *wrapped* part of the scanline. + * a.) We need to know what x value to subtract from the screen + * x coordinate to index into the wrapped part. + * b.) We also need to figure out if we need to read from the ordinary + * part scan line, or from the wrapped part of the scan line. + * + * [ad a] + * The first wrapped x coordinate is that coordinate such that + * depthBufferOffset&(info.strideInBytes) + x*elmentSize {*} + * > physicalStrideInBytes + * where depthBufferOffset is the LFB distance in bytes + * from the back buffer to the depth buffer. The expression + * depthBufferOffset&(info.strideInBytes) + * is then the offset (in bytes) from the beginining of (any) + * depth buffer line to first element in the line. + * Simplifying inequation {*} above we see that x is the smallest + * value such that + * x*elementSize > physicalStrideInBytes {**} + * - depthBufferOffset&(info.strideInBytes) + * Now, we know that both the summands on the right are multiples of + * 128, and elementSize <= 4, so if equality holds in {**}, x would + * be a multiple of 32. Thus we can set x to + * xwrapped = (physicalStrideInBytes + * - depthBufferOffset&(info.strideInBytes))/elementSize + * + 1 + * + * [ad b] + * Question b is now simple. We read from the wrapped scan line if + * x is greater than xwrapped. + */ +#define TILE_WIDTH_IN_BYTES 128 +#define TILE_WIDTH_IN_ZOXELS(bpz) (TILE_WIDTH_IN_BYTES/(bpz)) +#define TILE_HEIGHT_IN_LINES 32 +typedef struct +{ + void *lfbPtr; + void *lfbWrapPtr; + FxU32 LFBStrideInElts; + GLint firstWrappedX; +} +LFBParameters; + +/* + * We need information about the back buffer. Note that + * this function *cannot be called* while the aux buffer + * is locked, or the caller will hang. + * + * Only Glide knows the LFB address of the back and depth + * offsets. The upper levels of Mesa know the depth offset, + * but that is not in LFB space, it is tiled memory space, + * and is not useable for us. + */ +static void +GetBackBufferInfo(tdfxContextPtr fxMesa, GrLfbInfo_t * backBufferInfo) +{ + READ_FB_SPAN_LOCK(fxMesa, *backBufferInfo, GR_BUFFER_BACKBUFFER); + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_BACKBUFFER); +} + +static void +GetFbParams(tdfxContextPtr fxMesa, + GrLfbInfo_t * info, + GrLfbInfo_t * backBufferInfo, + LFBParameters * ReadParamsp, FxU32 elementSize) +{ + FxU32 physicalStrideInBytes, bufferOffset; + FxU32 strideInBytes = info->strideInBytes; + char *lfbPtr = (char *) (info->lfbPtr); /* For arithmetic, use char * */ + + /* + * These two come directly from the info structure. + */ + ReadParamsp->lfbPtr = (void *) lfbPtr; + ReadParamsp->LFBStrideInElts = strideInBytes / elementSize; + /* + * Now, calculate the value of firstWrappedX. + * + * The physical stride is the screen width in bytes rounded up to + * the next highest multiple of 128 bytes. Note that this fails + * when TILE_WIDTH_IN_BYTES is not a power of two. + * + * The buffer Offset is the distance between the beginning of + * the LFB space, which is the beginning of the back buffer, + * and the buffer we are gathering information about. + * We want to make this routine usable for operations on the + * back buffer, though we don't actually use it on the back + * buffer. Note, then, that if bufferOffset == 0, the firstWrappedX + * is in the forbidden zone, and is therefore never reached. + * + * Note that if + * physicalStrideInBytes + * < bufferOffset&(info->strideInBytes-1) + * the buffer begins in the forbidden zone. We assert for this. + */ + bufferOffset = (FxU32)(lfbPtr - (char *) backBufferInfo->lfbPtr); + physicalStrideInBytes + = (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1) + & ~(TILE_WIDTH_IN_BYTES - 1); + assert(physicalStrideInBytes > (bufferOffset & (strideInBytes - 1))); + ReadParamsp->firstWrappedX + = (physicalStrideInBytes + - (bufferOffset & (strideInBytes - 1))) / elementSize; + /* + * This is the address of the next physical line. + */ + ReadParamsp->lfbWrapPtr + = (void *) ((char *) backBufferInfo->lfbPtr + + (bufferOffset & ~(strideInBytes - 1)) + + (TILE_HEIGHT_IN_LINES) * strideInBytes); +} + +/* + * These macros fetch data from the frame buffer. The type is + * the type of data we want to fetch. It should match the type + * whose size was used with GetFbParams to fill in the structure + * in *ReadParamsp. We have a macro to read the ordinary + * part, a second macro to read the wrapped part, and one which + * will do either. When we are reading a span, we will know + * when the ordinary part ends, so there's no need to test for + * it. However, when reading and writing pixels, we don't + * necessarily know. I suppose it's a matter of taste whether + * it's better in the macro or in the call. + * + * Recall that x and y are screen coordinates. + */ +#define GET_FB_DATA(ReadParamsp, type, x, y) \ + (((x) < (ReadParamsp)->firstWrappedX) \ + ? (((type *)((ReadParamsp)->lfbPtr)) \ + [(y) * ((ReadParamsp)->LFBStrideInElts) \ + + (x)]) \ + : (((type *)((ReadParamsp)->lfbWrapPtr)) \ + [((y)) * ((ReadParamsp)->LFBStrideInElts) \ + + ((x) - (ReadParamsp)->firstWrappedX)])) +#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \ + (((type *)((ReadParamsp)->lfbPtr)) \ + [(y) * ((ReadParamsp)->LFBStrideInElts) \ + + (x)]) +#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) \ + (((type *)((ReadParamsp)->lfbWrapPtr)) \ + [((y)) * ((ReadParamsp)->LFBStrideInElts) \ + + ((x) - (ReadParamsp)->firstWrappedX)]) +#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) +#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) +#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) + +static void +tdfxDDWriteDepthSpan(GLcontext * ctx, + GLuint n, GLint x, GLint y, const GLdepth depth[], + const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->y_offset + fxMesa->height - 1; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GrLfbInfo_t info; + GLubyte visMask[MAX_WIDTH]; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthSpan(...)\n"); + } + + assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); + /* + * Convert x and y to screen coordinates. + */ + x += fxMesa->x_offset; + y = bottom - y; + if (mask) { + GLint i; + GLushort d16; + GrLfbInfo_t backBufferInfo; + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + int wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (mask[i] && visMask[i]) { + d16 = depth[i]; + PUT_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y, d16); + } + } + for (; i < n; i++) { + if (mask[i] && visMask[i]) { + d16 = depth[i]; + PUT_WRAPPED_FB_DATA(&ReadParams, GLushort, x + i, y, d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + int wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + GLuint d32; + if (mask[i] && visMask[i]) { + if (stencil_size > 0) { + d32 = + GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + for (; i < n; i++) { + GLuint d32; + if (mask[i] && visMask[i]) { + if (stencil_size > 0) { + d32 = + GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } + else { + GLint i; + GLuint d32; + GLushort d16; + GrLfbInfo_t backBufferInfo; + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + GLuint wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i]) { + d16 = depth[i]; + PUT_ORDINARY_FB_DATA(&ReadParams, + GLushort, + x + i, y, + d16); + } + } + for (; i < n; i++) { + if (visMask[i]) { + d16 = depth[i]; + PUT_WRAPPED_FB_DATA(&ReadParams, + GLushort, + x + i, y, + d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + GLuint wrappedPartStart; + + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i]) { + if (stencil_size > 0) { + d32 = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + for (; i < n; i++) { + if (visMask[i]) { + if (stencil_size > 0) { + d32 = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } +} + +static void +tdfxDDReadDepthSpan(GLcontext * ctx, + GLuint n, GLint x, GLint y, GLdepth depth[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLuint depth_size = fxMesa->glVis->DepthBits; + GrLfbInfo_t info; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDReadDepthSpan(...)\n"); + } + + /* + * Convert to screen coordinates. + */ + x += fxMesa->x_offset; + y = bottom - y; + switch (depth_size) { + case 16: + { + LFBParameters ReadParams; + GrLfbInfo_t backBufferInfo; + int wrappedPartStart; + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + /* + * Read the line. + */ + for (i = 0; i < wrappedPartStart; i++) { + depth[i] = + GET_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y); + } + for (; i < n; i++) { + depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLushort, + x + i, y); + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + case 24: + case 32: + { + LFBParameters ReadParams; + GrLfbInfo_t backBufferInfo; + int wrappedPartStart; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + /* + * Read the line. + */ + for (i = 0; i < wrappedPartStart; i++) { + const GLuint mask = + (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; + depth[i] = + GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); + depth[i] &= mask; + } + for (; i < n; i++) { + const GLuint mask = + (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; + depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); + depth[i] &= mask; + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } +} + + +static void +tdfxDDWriteDepthPixels(GLcontext * ctx, + GLuint n, const GLint x[], const GLint y[], + const GLdepth depth[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLushort d16; + GLuint d32; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GrLfbInfo_t info; + int xpos; + int ypos; + GrLfbInfo_t backBufferInfo; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthPixels(...)\n"); + } + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + for (i = 0; i < n; i++) { + if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) { + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d16 = depth[i]; + PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + for (i = 0; i < n; i++) { + if (mask[i]) { + if (visible_pixel(fxMesa, x[i], y[i])) { + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + if (stencil_size > 0) { + d32 = + GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); + d32 = (d32 & 0xFF000000) | (depth[i] & 0xFFFFFF); + } + else { + d32 = depth[i]; + } + PUT_FB_DATA(&ReadParams, GLuint, xpos, ypos, d32); + } + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } +} + + +static void +tdfxDDReadDepthPixels(GLcontext * ctx, GLuint n, + const GLint x[], const GLint y[], GLdepth depth[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLushort d16; + int xpos; + int ypos; + GrLfbInfo_t info; + GLuint stencil_size; + GrLfbInfo_t backBufferInfo; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDReadDepthPixels(...)\n"); + } + + assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + for (i = 0; i < n; i++) { + /* + * Convert to screen coordinates. + */ + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d16 = GET_FB_DATA(&ReadParams, GLushort, xpos, ypos); + depth[i] = d16; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + stencil_size = fxMesa->glVis->StencilBits; + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + for (i = 0; i < n; i++) { + GLuint d32; + + /* + * Convert to screen coordinates. + */ + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d32 = GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); + if (stencil_size > 0) { + d32 &= 0x00FFFFFF; + } + depth[i] = d32; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + default: + assert(0); + } +} + +/* + * Stencil buffer read/write functions. + */ +#define EXTRACT_S_FROM_ZS(zs) (((zs) >> 24) & 0xFF) +#define EXTRACT_Z_FROM_ZS(zs) ((zs) & 0xffffff) +#define BUILD_ZS(z, s) (((s) << 24) | (z)) + +static void +write_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, + const GLstencil stencil[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + LFBParameters ReadParams; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + int wrappedPartStart; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + generate_vismask(fxMesa, scrX, scrY, n, visMask); + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i] && (!mask || mask[i])) { + GLuint z = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + scrX + i, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); + } + } + for (; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + GLuint z = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + scrX + i, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +read_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, + GLstencil stencil[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + GLuint i; + LFBParameters ReadParams; + int wrappedPartStart; + + /* + * Convert to screen coordinates. + */ + x += winX; + y = winY - y; + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + stencil[i] = (GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + x + i, y) >> 24) & 0xFF; + } + for (; i < n; i++) { + stencil[i] = (GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + x + i, y) >> 24) & 0xFF; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +write_stencil_pixels(GLcontext * ctx, GLuint n, + const GLint x[], const GLint y[], + const GLstencil stencil[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + LFBParameters ReadParams; + GLuint i; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + for (i = 0; i < n; i++) { + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + if ((!mask || mask[i]) && visible_pixel(fxMesa, scrX, scrY)) { + GLuint z = + GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_FB_DATA(&ReadParams, GLuint, scrX, scrY, z); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +read_stencil_pixels(GLcontext * ctx, GLuint n, const GLint x[], + const GLint y[], GLstencil stencil[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + GLuint i; + LFBParameters ReadParams; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + for (i = 0; i < n; i++) { + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + stencil[i] = + (GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) >> 24) & 0xFF; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + +#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \ + ((vis->RedBits == r) && \ + (vis->GreenBits == g) && \ + (vis->BlueBits == b) && \ + (vis->AlphaBits == a)) + +void tdfxDDInitSpanFuncs( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) ) + { + /* 16bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_RGB565; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_RGB565; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB565; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_RGB565; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB565; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_RGB565; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_RGB565; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 0) ) + { + /* 24bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_RGB888; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_RGB888; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB888; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_RGB888; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB888; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_RGB888; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_RGB888; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) ) + { + /* 32bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_ARGB8888; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_ARGB8888; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB8888; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB8888; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB8888; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_ARGB8888; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_ARGB8888; + } + else + { + abort(); + } + + if ( fxMesa->haveHwStencil ) { + ctx->Driver.WriteStencilSpan = write_stencil_span; + ctx->Driver.ReadStencilSpan = read_stencil_span; + ctx->Driver.WriteStencilPixels = write_stencil_pixels; + ctx->Driver.ReadStencilPixels = read_stencil_pixels; + } + + ctx->Driver.WriteDepthSpan = tdfxDDWriteDepthSpan; + ctx->Driver.WriteDepthPixels = tdfxDDWriteDepthPixels; + ctx->Driver.ReadDepthSpan = tdfxDDReadDepthSpan; + ctx->Driver.ReadDepthPixels = tdfxDDReadDepthPixels; + + ctx->Driver.WriteCI8Span = NULL; + ctx->Driver.WriteCI32Span = NULL; + ctx->Driver.WriteMonoCISpan = NULL; + ctx->Driver.WriteCI32Pixels = NULL; + ctx->Driver.WriteMonoCIPixels = NULL; + ctx->Driver.ReadCI32Span = NULL; + ctx->Driver.ReadCI32Pixels = NULL; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h new file mode 100644 index 000000000..47303c600 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h @@ -0,0 +1,48 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_SPAN_H__ +#define __TDFX_SPAN_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c new file mode 100644 index 000000000..c5e1a5dfc --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c @@ -0,0 +1,1526 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "types.h" +#include "pb.h" + +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" +#include "tdfx_texstate.h" +#include "tdfx_tris.h" +#include "tdfx_render.h" + + + +/* ============================================================= + * Alpha blending + */ + +static void tdfxUpdateAlphaMode( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCmpFnc_t func; + GrAlphaBlendFnc_t srcRGB, dstRGB, srcA, dstA; + GrAlpha_t ref = ctx->Color.AlphaRef; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Color.AlphaEnabled ) { + switch ( ctx->Color.AlphaFunc ) { + case GL_NEVER: + func = GR_CMP_NEVER; + break; + case GL_LESS: + func = GR_CMP_LESS; + break; + case GL_LEQUAL: + func = GR_CMP_LEQUAL; + break; + case GL_EQUAL: + func = GR_CMP_EQUAL; + break; + case GL_GEQUAL: + func = GR_CMP_GEQUAL; + break; + case GL_GREATER: + func = GR_CMP_GREATER; + break; + case GL_NOTEQUAL: + func = GR_CMP_NOTEQUAL; + break; + case GL_ALWAYS: + default: + func = GR_CMP_ALWAYS; + break; + } + } else { + func = GR_CMP_ALWAYS; + } + + if ( ctx->Color.BlendEnabled + && (fxMesa->Fallback & TDFX_FALLBACK_BLEND) == 0 ) { + switch ( ctx->Color.BlendSrcRGB ) { + case GL_ZERO: + srcRGB = GR_BLEND_ZERO; + break; + case GL_ONE: + srcRGB = GR_BLEND_ONE; + break; + case GL_DST_COLOR: + srcRGB = GR_BLEND_DST_COLOR; + break; + case GL_ONE_MINUS_DST_COLOR: + srcRGB = GR_BLEND_ONE_MINUS_DST_COLOR; + break; + case GL_SRC_ALPHA: + srcRGB = GR_BLEND_SRC_ALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + srcRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; + break; + case GL_DST_ALPHA: + srcRGB = GR_BLEND_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + srcRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + break; + case GL_SRC_ALPHA_SATURATE: + srcRGB = GR_BLEND_ALPHA_SATURATE; + break; + default: + srcRGB = GR_BLEND_ONE; + } + + switch ( ctx->Color.BlendSrcA ) { + case GL_ZERO: + srcA = GR_BLEND_ZERO; + break; + case GL_ONE: + srcA = GR_BLEND_ONE; + break; + case GL_DST_COLOR: + srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_COLOR: + srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA: + srcA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_ALPHA: + srcA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_DST_ALPHA: + srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_ALPHA: + srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA_SATURATE: + srcA = GR_BLEND_ONE; + break; + default: + srcA = GR_BLEND_ONE; + } + + switch ( ctx->Color.BlendDstRGB ) { + case GL_ZERO: + dstRGB = GR_BLEND_ZERO; + break; + case GL_ONE: + dstRGB = GR_BLEND_ONE; + break; + case GL_SRC_COLOR: + dstRGB = GR_BLEND_SRC_COLOR; + break; + case GL_ONE_MINUS_SRC_COLOR: + dstRGB = GR_BLEND_ONE_MINUS_SRC_COLOR; + break; + case GL_SRC_ALPHA: + dstRGB = GR_BLEND_SRC_ALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + dstRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; + break; + case GL_DST_ALPHA: + dstRGB = GR_BLEND_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + dstRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + break; + default: + dstRGB = GR_BLEND_ZERO; + } + + switch ( ctx->Color.BlendDstA ) { + case GL_ZERO: + dstA = GR_BLEND_ZERO; + break; + case GL_ONE: + dstA = GR_BLEND_ONE; + break; + case GL_SRC_COLOR: + dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_COLOR: + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA: + dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_ALPHA: + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_DST_ALPHA: + dstA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_ALPHA: + dstA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + default: + dstA = GR_BLEND_ZERO; + } + } else { + /* blend disabled */ + srcRGB = GR_BLEND_ONE; + dstRGB = GR_BLEND_ZERO; + srcA = GR_BLEND_ONE; + dstA = GR_BLEND_ZERO; + } + + if ( fxMesa->Color.AlphaFunc != func ) { + fxMesa->Color.AlphaFunc = func; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_TEST; + } + if ( fxMesa->Color.AlphaRef != ref ) { + fxMesa->Color.AlphaRef = ref; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_REF; + } + + if ( fxMesa->Color.BlendSrcRGB != srcRGB || + fxMesa->Color.BlendDstRGB != dstRGB || + fxMesa->Color.BlendSrcA != srcA || + fxMesa->Color.BlendDstA != dstA ) + { + fxMesa->Color.BlendSrcRGB = srcRGB; + fxMesa->Color.BlendDstRGB = dstRGB; + fxMesa->Color.BlendSrcA = srcA; + fxMesa->Color.BlendDstA = dstA; + fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC; + } +} + +static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLclampf ref ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; +} + +static void tdfxDDBlendEquation( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; +} + +static void tdfxDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + + /* + * XXX - Voodoo5 seems to suffer from precision problems in some + * blend modes. To pass all the conformance tests we'd have to + * fall back to software for many modes. Revisit someday. + */ +} + +static void tdfxDDBlendFuncSeparate( GLcontext *ctx, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; +} + +/* ============================================================= + * Stipple + */ + +static void tdfxUpdateStipple( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GrStippleMode_t mode = GR_STIPPLE_DISABLE; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + + if (ctx->Polygon.StippleFlag) { + mode = GR_STIPPLE_PATTERN; + } + + if ( fxMesa->Stipple.Mode != mode ) { + fxMesa->Stipple.Mode = mode; + fxMesa->dirty |= TDFX_UPLOAD_STIPPLE; + } +} + + +/* ============================================================= + * Depth testing + */ + +static void tdfxUpdateZMode( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GrCmpFnc_t func; + FxI32 bias; + FxBool mask; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE); + + if ( ctx->Depth.Test ) { + switch ( ctx->Depth.Func ) { + case GL_NEVER: + func = GR_CMP_NEVER; + break; + case GL_LESS: + func = GR_CMP_LESS; + break; + case GL_LEQUAL: + func = GR_CMP_LEQUAL; + break; + case GL_EQUAL: + func = GR_CMP_EQUAL; + break; + case GL_GEQUAL: + func = GR_CMP_GEQUAL; + break; + case GL_GREATER: + func = GR_CMP_GREATER; + break; + case GL_NOTEQUAL: + func = GR_CMP_NOTEQUAL; + break; + case GL_ALWAYS: + default: + func = GR_CMP_ALWAYS; + break; + } + + if ( ctx->Depth.Mask ) { + mask = FXTRUE; + } + else { + mask = FXFALSE; + } + } + else { + /* depth testing disabled */ + func = GR_CMP_ALWAYS; /* fragments always pass */ + mask = FXFALSE; /* zbuffer is not touched */ + } + + fxMesa->Depth.Clear = (FxU32) (((1 << fxMesa->glVis->DepthBits) - 1) + * ctx->Depth.Clear); + + if ( fxMesa->Depth.Bias != bias ) { + fxMesa->Depth.Bias = bias; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS; + } + if ( fxMesa->Depth.Func != func ) { + fxMesa->Depth.Func = func; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_FUNC | TDFX_UPLOAD_DEPTH_MASK; + } + if ( fxMesa->Depth.Mask != mask ) { + fxMesa->Depth.Mask = mask; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_MASK; + } +} + +static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + +static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + +static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + + + +/* ============================================================= + * Stencil + */ + + +/* Evaluate all stencil state and make the Glide calls. + */ +static GrStencil_t convertGLStencilOp( GLenum op ) +{ + switch ( op ) { + case GL_KEEP: + return GR_STENCILOP_KEEP; + case GL_ZERO: + return GR_STENCILOP_ZERO; + case GL_REPLACE: + return GR_STENCILOP_REPLACE; + case GL_INCR: + return GR_STENCILOP_INCR_CLAMP; + case GL_DECR: + return GR_STENCILOP_DECR_CLAMP; + case GL_INVERT: + return GR_STENCILOP_INVERT; + case GL_INCR_WRAP_EXT: + return GR_STENCILOP_INCR_WRAP; + case GL_DECR_WRAP_EXT: + return GR_STENCILOP_DECR_WRAP; + default: + gl_problem( NULL, "bad stencil op in convertGLStencilOp" ); + } + return GR_STENCILOP_KEEP; /* never get, silence compiler warning */ +} + + +static void tdfxUpdateStencil( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if (fxMesa->haveHwStencil) { + if (ctx->Stencil.Enabled) { + fxMesa->Stencil.Function = ctx->Stencil.Function - GL_NEVER; + fxMesa->Stencil.RefValue = ctx->Stencil.Ref; + fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask; + fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask; + fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc); + fxMesa->Stencil.ZFailFunc =convertGLStencilOp(ctx->Stencil.ZFailFunc); + fxMesa->Stencil.ZPassFunc =convertGLStencilOp(ctx->Stencil.ZPassFunc); + fxMesa->Stencil.Clear = ctx->Stencil.Clear & 0xff; + } + fxMesa->dirty |= TDFX_UPLOAD_STENCIL; + } +} + + +static void tdfxDDStencilFunc( GLcontext *ctx, GLenum func, + GLint ref, GLuint mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + +static void tdfxDDStencilMask( GLcontext *ctx, GLuint mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + +static void tdfxDDStencilOp( GLcontext *ctx, GLenum sfail, + GLenum zfail, GLenum zpass ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + + +/* ============================================================= + * Fog - orthographic fog still not working + */ + +static void tdfxUpdateFogAttrib( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrFogMode_t mode; + GrColor_t color; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Fog.Enabled ) { + mode = GR_FOG_WITH_TABLE_ON_Q; + } else { + mode = GR_FOG_DISABLE; + } + + color = TDFXPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F), + (GLubyte)(ctx->Fog.Color[1]*255.0F), + (GLubyte)(ctx->Fog.Color[2]*255.0F)); + + if ( fxMesa->Fog.Mode != mode ) { + fxMesa->Fog.Mode = mode; + fxMesa->dirty |= TDFX_UPLOAD_FOG_MODE; + } + if ( fxMesa->Fog.Color != color ) { + fxMesa->Fog.Color = color; + fxMesa->dirty |= TDFX_UPLOAD_FOG_COLOR; + } + if ( fxMesa->Fog.TableMode != ctx->Fog.Mode || + fxMesa->Fog.Density != ctx->Fog.Density || + fxMesa->Fog.Near != ctx->Fog.Start || + fxMesa->Fog.Far != ctx->Fog.End ) + { + switch( ctx->Fog.Mode ) { + case GL_EXP: + guFogGenerateExp( fxMesa->Fog.Table, ctx->Fog.Density ); + break; + case GL_EXP2: + guFogGenerateExp2( fxMesa->Fog.Table, ctx->Fog.Density ); + break; + case GL_LINEAR: + guFogGenerateLinear( fxMesa->Fog.Table, + ctx->Fog.Start, ctx->Fog.End ); + break; + } + + fxMesa->Fog.TableMode = ctx->Fog.Mode; + fxMesa->Fog.Density = ctx->Fog.Density; + fxMesa->Fog.Near = ctx->Fog.Start; + fxMesa->Fog.Far = ctx->Fog.End; + fxMesa->dirty |= TDFX_UPLOAD_FOG_TABLE; + } +} + +static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_FOG; +} + + +/* ============================================================= + * Clipping + */ + +static int intersect_rect( XF86DRIClipRectPtr out, + const XF86DRIClipRectPtr a, + const XF86DRIClipRectPtr b) +{ + *out = *a; + if (b->x1 > out->x1) out->x1 = b->x1; + if (b->y1 > out->y1) out->y1 = b->y1; + if (b->x2 < out->x2) out->x2 = b->x2; + if (b->y2 < out->y2) out->y2 = b->y2; + if (out->x1 >= out->x2) return 0; + if (out->y1 >= out->y2) return 0; + return 1; +} + + +/* + * Examine XF86 cliprect list and scissor state to recompute our + * cliprect list. + */ +void tdfxUpdateClipping( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + assert(ctx); + assert(fxMesa); + assert(dPriv); + + if ( dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset || + dPriv->w != fxMesa->width || dPriv->h != fxMesa->height ) { + fxMesa->x_offset = dPriv->x; + fxMesa->y_offset = dPriv->y; + fxMesa->width = dPriv->w; + fxMesa->height = dPriv->h; + fxMesa->y_delta = + fxMesa->screen_height - fxMesa->y_offset - fxMesa->height; + } + + if (fxMesa->scissoredClipRects && fxMesa->pClipRects) { + free(fxMesa->pClipRects); + } + + if (ctx->Scissor.Enabled) { + /* intersect OpenGL scissor box with all cliprects to make a new + * list of cliprects. + */ + XF86DRIClipRectRec scissor; + int x1 = ctx->Scissor.X + fxMesa->x_offset; + int y1 = fxMesa->screen_height - fxMesa->y_delta + - ctx->Scissor.Y - ctx->Scissor.Height; + int x2 = x1 + ctx->Scissor.Width; + int y2 = y1 + ctx->Scissor.Height; + scissor.x1 = MAX2(x1, 0); + scissor.y1 = MAX2(y1, 0); + scissor.x2 = MAX2(x2, 0); + scissor.y2 = MAX2(y2, 0); + + assert(scissor.x2 >= scissor.x1); + assert(scissor.y2 >= scissor.y1); + + fxMesa->pClipRects = malloc(dPriv->numClipRects + * sizeof(XF86DRIClipRectRec)); + if (fxMesa->pClipRects) { + int i; + fxMesa->numClipRects = 0; + for (i = 0; i < dPriv->numClipRects; i++) { + if (intersect_rect(&fxMesa->pClipRects[fxMesa->numClipRects], + &scissor, &dPriv->pClipRects[i])) { + fxMesa->numClipRects++; + } + } + fxMesa->scissoredClipRects = GL_TRUE; + } + else { + /* out of memory, forgo scissor */ + fxMesa->numClipRects = dPriv->numClipRects; + fxMesa->pClipRects = dPriv->pClipRects; + fxMesa->scissoredClipRects = GL_FALSE; + } + } + else { + fxMesa->numClipRects = dPriv->numClipRects; + fxMesa->pClipRects = dPriv->pClipRects; + fxMesa->scissoredClipRects = GL_FALSE; + } + + fxMesa->dirty |= TDFX_UPLOAD_CLIP; +} + + + +/* ============================================================= + * Culling + */ + +static void tdfxUpdateCull( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCullMode_t mode = GR_CULL_DISABLE; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Polygon.CullFlag && + (ctx->PB->primitive == GL_POLYGON || + ctx->PB->primitive == GL_BITMAP) ) { + switch ( ctx->Polygon.CullFaceMode ) { + case GL_FRONT: + if ( ctx->Polygon.FrontFace == GL_CCW ) { + mode = GR_CULL_POSITIVE; + } else { + mode = GR_CULL_NEGATIVE; + } + break; + + case GL_BACK: + if ( ctx->Polygon.FrontFace == GL_CCW ) { + mode = GR_CULL_NEGATIVE; + } else { + mode = GR_CULL_POSITIVE; + } + break; + + case GL_FRONT_AND_BACK: + default: + mode = GR_CULL_DISABLE; + break; + } + } + + if ( fxMesa->CullMode != mode ) { + fxMesa->CullMode = mode; + fxMesa->dirty |= TDFX_UPLOAD_CULL; + } +} + +static void tdfxDDCullFace( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; +} + +static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; +} + + +/* ============================================================= + * Line drawing. + */ + +static void tdfxUpdateLine( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + fxMesa->dirty |= TDFX_UPLOAD_LINE; +} + + +static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_LINE; +} + + +/* ============================================================= + * Color Attributes + */ + +static GLboolean tdfxDDColorMask( GLcontext *ctx, + GLboolean r, GLboolean g, + GLboolean b, GLboolean a ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + if ( fxMesa->Color.ColorMask[RCOMP] != r || + fxMesa->Color.ColorMask[GCOMP] != g || + fxMesa->Color.ColorMask[BCOMP] != b || + fxMesa->Color.ColorMask[ACOMP] != a ) { + fxMesa->Color.ColorMask[RCOMP] = r; + fxMesa->Color.ColorMask[GCOMP] = g; + fxMesa->Color.ColorMask[BCOMP] = b; + fxMesa->Color.ColorMask[ACOMP] = a; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_MASK; + + if (ctx->Visual->RedBits < 8) { + /* Can't do RGB colormasking in 16bpp mode. */ + /* We can completely ignore the alpha mask. */ + if (r != g || g != b) { + fxMesa->Fallback |= TDFX_FALLBACK_COLORMASK; + } + else { + fxMesa->Fallback &= ~TDFX_FALLBACK_COLORMASK; + } + } + } + + return GL_FALSE; /* This forces the software paths to do colormasking. */ + /* This function will return void when we use Mesa 3.5 */ +} + +static void tdfxDDColor( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrColor_t color; + + FLUSH_BATCH( fxMesa ); + + color = tdfxPackColor( fxMesa->fxScreen->cpp, r, g, b, a ); + + if ( fxMesa->Color.MonoColor != color ) { + fxMesa->Color.MonoColor = color; + fxMesa->dirty |= TDFX_UPLOAD_CONSTANT_COLOR; + } +} + +static void tdfxDDClearColor( GLcontext *ctx, + GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + fxMesa->Color.ClearColor = TDFXPACKCOLOR888( red, green, blue ); + fxMesa->Color.ClearAlpha = alpha; +} + + +/* ============================================================= + * Light Model + */ + +static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname, + const GLfloat *param ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) { + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_SPECULAR; + + if ( ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) { + fxMesa->Fallback |= TDFX_FALLBACK_SPECULAR; + } + } +} + +static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + /* FIXME: Can we implement native flat shading? */ + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + + +/* ============================================================= + * Scissor + */ + +static void +tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CLIP; +} + +/* ============================================================= + * Render + */ + +static void tdfxUpdateRenderAttrib( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->dirty |= TDFX_UPLOAD_RENDER_BUFFER; +} + +/* ============================================================= + * Viewport + */ + +static void tdfxUpdateViewport( GLcontext *ctx ) +{ + /* XXX: Implement this when we're doing clip coordinates */ + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } +} + + +static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y, + GLsizei w, GLsizei h ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_VIEWPORT; +} + + +static void tdfxDDNearFar( GLcontext *ctx, GLfloat nearVal, GLfloat farVal ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_VIEWPORT; +} + + +/* ============================================================= + * State enable/disable + */ + +static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + switch ( cap ) { + case GL_ALPHA_TEST: + case GL_BLEND: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + break; + + case GL_CULL_FACE: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; + break; + + case GL_DEPTH_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; + break; + + case GL_DITHER: + FLUSH_BATCH( fxMesa ); + if ( state ) { + fxMesa->Color.Dither = GR_DITHER_2x2; + } else { + fxMesa->Color.Dither = GR_DITHER_DISABLE; + } + fxMesa->dirty |= TDFX_UPLOAD_DITHER; + break; + + case GL_FOG: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_FOG; + break; + + case GL_INDEX_LOGIC_OP: + case GL_COLOR_LOGIC_OP: + FLUSH_BATCH( fxMesa ); + if ( state && ctx->Color.LogicOp != GL_COPY ) { + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + } else { + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; + } + break; + + case GL_LINE_SMOOTH: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_LINE; + break; + + case GL_POLYGON_STIPPLE: + FLUSH_BATCH(fxMesa); + fxMesa->new_state |= TDFX_NEW_STIPPLE; + break; + + case GL_SCISSOR_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CLIP; + break; + + case GL_STENCIL_TEST: + FLUSH_BATCH( fxMesa ); + if (fxMesa->haveHwStencil) + fxMesa->new_state |= TDFX_NEW_STENCIL; + else if (state) + fxMesa->Fallback |= TDFX_FALLBACK_STENCIL; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_STENCIL; + break; + + case GL_TEXTURE_1D: + case GL_TEXTURE_3D: + if (state) + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_2D: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + default: + return; + } +} + + + +/* Set the buffer used for drawing */ +/* XXX support for separate read/draw buffers hasn't been tested */ +static GLboolean tdfxDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_BUFFER; + + switch ( mode ) { + case GL_FRONT_LEFT: + fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER; + fxMesa->new_state |= TDFX_NEW_RENDER; + return GL_TRUE; + + case GL_BACK_LEFT: + fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER; + fxMesa->new_state |= TDFX_NEW_RENDER; + return GL_TRUE; + + case GL_NONE: + FX_grColorMaskv( ctx, false4 ); + return GL_TRUE; + + default: + fxMesa->Fallback |= TDFX_FALLBACK_BUFFER; + return GL_FALSE; + } +} + + +/* Set the buffer used for reading */ +/* XXX support for separate read/draw buffers hasn't been tested */ +static void tdfxDDSetReadBuffer( GLcontext *ctx, + GLframebuffer *buffer, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + (void) buffer; + + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_BUFFER; + + switch ( mode ) { + case GL_FRONT_LEFT: + fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; + break; + + case GL_BACK_LEFT: + fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; + break; + + default: + fxMesa->Fallback |= TDFX_FALLBACK_BUFFER; + break; + } +} + +/* ============================================================= + * Polygon stipple + */ + +static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLubyte *m = mask; + GLubyte q[4]; + int i,j,k; + int active = (ctx->Polygon.StippleFlag && ctx->PB->primitive == GL_POLYGON); + + FLUSH_BATCH(fxMesa); + + if (active) { + ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; + } + + q[0] = mask[0]; + q[1] = mask[4]; + q[2] = mask[8]; + q[3] = mask[12]; + + for (k = 0 ; k < 8 ; k++) + for (j = 0 ; j < 4; j++) + for (i = 0 ; i < 4 ; i++,m++) { + if (*m != q[j]) { + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; + fxMesa->Stipple.Pattern = 0xffffffff; /* ensure all pixels on */ + return; + } + } + + /* We can do it, so flag an upload of the stipple pattern */ + fxMesa->Stipple.Pattern = ( (q[0] << 0) | + (q[1] << 8) | + (q[2] << 16) | + (q[3] << 24) ); + fxMesa->dirty |= TDFX_UPLOAD_STIPPLE; +} + +/* Always called between RenderStart and RenderFinish --> We already + * hold the lock. + */ +static void tdfxDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + + tdfxUpdateCull(ctx); + if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) { + grCullMode( fxMesa->CullMode ); + fxMesa->dirty &= ~TDFX_UPLOAD_CULL; + } + + tdfxUpdateStipple(ctx); + if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE ) { + grStipplePattern ( fxMesa->Stipple.Pattern ); + grStippleMode ( fxMesa->Stipple.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE; + } +} + + + +static void tdfxDDPrintState( const char *msg, GLuint flags ) +{ + fprintf( stderr, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & TDFX_NEW_COLOR) ? "color, " : "", + (flags & TDFX_NEW_ALPHA) ? "alpha, " : "", + (flags & TDFX_NEW_DEPTH) ? "depth, " : "", + (flags & TDFX_NEW_RENDER) ? "render, " : "", + (flags & TDFX_NEW_FOG) ? "fog, " : "", + (flags & TDFX_NEW_STENCIL) ? "stencil, " : "", + (flags & TDFX_NEW_STIPPLE) ? "stipple, " : "", + (flags & TDFX_NEW_CLIP) ? "clip, " : "", + (flags & TDFX_NEW_VIEWPORT) ? "viewport, " : "", + (flags & TDFX_NEW_CULL) ? "cull, " : "", + (flags & TDFX_NEW_GLIDE) ? "glide, " : "", + (flags & TDFX_NEW_TEXTURE) ? "texture, " : "", + (flags & TDFX_NEW_CONTEXT) ? "context, " : ""); +} + + + +void tdfxDDUpdateHwState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + int new_state = fxMesa->new_state; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( new_state ) + { + FLUSH_BATCH( fxMesa ); + + fxMesa->new_state = 0; + + if ( 0 ) + tdfxDDPrintState( "tdfxUpdateHwState", new_state ); + + /* Update the various parts of the context's state. + */ + if ( new_state & TDFX_NEW_ALPHA ) { + tdfxUpdateAlphaMode( ctx ); + } + + if ( new_state & TDFX_NEW_DEPTH ) + tdfxUpdateZMode( ctx ); + + if ( new_state & TDFX_NEW_FOG ) + tdfxUpdateFogAttrib( ctx ); + + if ( new_state & TDFX_NEW_CLIP ) + tdfxUpdateClipping( ctx ); + + if ( new_state & TDFX_NEW_STIPPLE ) + tdfxUpdateStipple( ctx ); + + if ( new_state & TDFX_NEW_CULL ) + tdfxUpdateCull( ctx ); + + if ( new_state & TDFX_NEW_LINE ) + tdfxUpdateLine( ctx ); + + if ( new_state & TDFX_NEW_VIEWPORT ) + tdfxUpdateViewport( ctx ); + + if ( new_state & TDFX_NEW_RENDER ) + tdfxUpdateRenderAttrib( ctx ); + + if ( new_state & TDFX_NEW_STENCIL ) + tdfxUpdateStencil( ctx ); + + if ( new_state & TDFX_NEW_TEXTURE ) { + tdfxUpdateTextureState( ctx ); + } + else if ( new_state & TDFX_NEW_TEXTURE_BIND ) { + tdfxUpdateTextureBinding( ctx ); + } + } + + if ( 0 ) { + FxI32 bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE); + + if ( fxMesa->Depth.Bias != bias ) { + fxMesa->Depth.Bias = bias; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS; + } + } + + if ( fxMesa->dirty ) { + LOCK_HARDWARE( fxMesa ); + tdfxEmitHwStateLocked( fxMesa ); + UNLOCK_HARDWARE( fxMesa ); + } +} + + +static void tdfxDDRenderStart( GLcontext *ctx ) +{ + tdfxDDUpdateHwState( ctx ); + LOCK_HARDWARE( TDFX_CONTEXT(ctx) ); +} + +static void tdfxDDRenderFinish( GLcontext *ctx ) +{ + UNLOCK_HARDWARE( TDFX_CONTEXT(ctx) ); +} + +#define INTERESTED (~(NEW_MODELVIEW | \ + NEW_PROJECTION | \ + NEW_TEXTURE_MATRIX | \ + NEW_USER_CLIP | \ + NEW_CLIENT_STATE | \ + NEW_TEXTURE_ENABLE)) + +static void tdfxDDUpdateState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + /* Have to do this here to detect texture, line fallbacks in time: + */ + if ( fxMesa->new_state & (TDFX_NEW_TEXTURE | TDFX_NEW_LINE) ) + tdfxDDUpdateHwState( ctx ); + + if ( ctx->NewState & INTERESTED ) { + tdfxDDChooseRenderState( ctx ); + } + + /* The choise of vertex setup function only depends on whether fog + * and/or texturing is enabled. + */ + if ( ctx->NewState & (NEW_FOG | NEW_TEXTURE_ENABLE | NEW_TEXTURING)) { + tdfxDDChooseRasterSetupFunc( ctx ); + } + + if ( 0 ) + fprintf( stderr, "fallback %x indirect %x\n", + fxMesa->Fallback, fxMesa->IndirectTriangles ); + + if ( fxMesa->Fallback ) { + ctx->IndirectTriangles |= ctx->TriangleCaps; + } + else { + ctx->IndirectTriangles &= ~DD_SW_RASTERIZE; + ctx->IndirectTriangles |= fxMesa->IndirectTriangles; + + ctx->Driver.PointsFunc = fxMesa->PointsFunc; + ctx->Driver.LineFunc = fxMesa->LineFunc; + ctx->Driver.TriangleFunc = fxMesa->TriangleFunc; + ctx->Driver.QuadFunc = fxMesa->QuadFunc; + ctx->Driver.RenderVBRawTab = fxMesa->RenderVBRawTab; + } +} + + + +/* Initialize the context's Glide state mirror. These values will be + * used as Glide function call parameters when the time comes. + */ +void tdfxInitState( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + GLint i; + + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + + fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + + fxMesa->sScale0 = fxMesa->tScale0 = 1.0; + fxMesa->sScale1 = fxMesa->tScale1 = 1.0; + + fxMesa->TexPalette.Type = 0; + fxMesa->TexPalette.Data = NULL; + + for ( i = 0 ; i < TDFX_NUM_TMU ; i++ ) { + fxMesa->TexSource[i].StartAddress = 0; + fxMesa->TexSource[i].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[i].Info = NULL; + + fxMesa->TexCombine[i].FunctionRGB = 0; + fxMesa->TexCombine[i].FactorRGB = 0; + fxMesa->TexCombine[i].FunctionAlpha = 0; + fxMesa->TexCombine[i].FactorAlpha = 0; + fxMesa->TexCombine[i].InvertRGB = FXFALSE; + fxMesa->TexCombine[i].InvertAlpha = FXFALSE; + + fxMesa->TexCombineExt[i].Alpha.SourceA = 0; + /* XXX more state to init here */ + fxMesa->TexCombineExt[i].Color.SourceA = 0; + fxMesa->TexCombineExt[i].EnvColor = 0x0; + + fxMesa->TexParams[i].sClamp = GR_TEXTURECLAMP_WRAP; + fxMesa->TexParams[i].tClamp = GR_TEXTURECLAMP_WRAP; + fxMesa->TexParams[i].minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + fxMesa->TexParams[i].magFilt = GR_TEXTUREFILTER_BILINEAR; + fxMesa->TexParams[i].mmMode = GR_MIPMAP_DISABLE; + fxMesa->TexParams[i].LODblend = FXFALSE; + fxMesa->TexParams[i].LodBias = 0.0; + + fxMesa->TexState.EnvMode[i] = ~0; + fxMesa->TexState.TexFormat[i] = ~0; + fxMesa->TexState.Enabled = 0; + } + + if ( ctx->Visual->DBflag) { + fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER; + fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; + } else { + fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER; + fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; + } + + fxMesa->Color.ClearColor = 0x00000000; + fxMesa->Color.ClearAlpha = 0x00; + fxMesa->Color.ColorMask[RCOMP] = FXTRUE; + fxMesa->Color.ColorMask[BCOMP] = FXTRUE; + fxMesa->Color.ColorMask[GCOMP] = FXTRUE; + fxMesa->Color.ColorMask[ACOMP] = FXTRUE; + fxMesa->Color.MonoColor = 0xffffffff; + + fxMesa->Color.AlphaFunc = GR_CMP_ALWAYS; + fxMesa->Color.AlphaRef = 0x00; + fxMesa->Color.BlendSrcRGB = GR_BLEND_ONE; + fxMesa->Color.BlendDstRGB = GR_BLEND_ZERO; + fxMesa->Color.BlendSrcA = GR_BLEND_ONE; + fxMesa->Color.BlendSrcA = GR_BLEND_ZERO; + + fxMesa->Color.Dither = GR_DITHER_2x2; + + if ( fxMesa->glVis->DepthBits > 0 ) { + fxMesa->Depth.Mode = GR_DEPTHBUFFER_ZBUFFER; + } else { + fxMesa->Depth.Mode = GR_DEPTHBUFFER_DISABLE; + } + fxMesa->Depth.Bias = 0; + fxMesa->Depth.Func = GR_CMP_LESS; + fxMesa->Depth.Clear = 0; /* computed later */ + fxMesa->Depth.Mask = FXTRUE; + + + fxMesa->Fog.Mode = GR_FOG_DISABLE; + fxMesa->Fog.Color = 0x00000000; + fxMesa->Fog.Table = NULL; + fxMesa->Fog.Density = 1.0; + fxMesa->Fog.Near = 1.0; + fxMesa->Fog.Far = 1.0; + + fxMesa->Stencil.Function = GR_CMP_ALWAYS; + fxMesa->Stencil.RefValue = 0; + fxMesa->Stencil.ValueMask = 0xff; + fxMesa->Stencil.WriteMask = 0xff; + fxMesa->Stencil.FailFunc = 0; + fxMesa->Stencil.ZFailFunc = 0; + fxMesa->Stencil.ZPassFunc = 0; + fxMesa->Stencil.Clear = 0; + + fxMesa->Stipple.Mode = GR_STIPPLE_DISABLE; + fxMesa->Stipple.Pattern = 0xffffffff; + + fxMesa->Scissor.minX = 0; + fxMesa->Scissor.minY = 0; + fxMesa->Scissor.maxX = 0; + fxMesa->Scissor.maxY = 0; + + fxMesa->Viewport.Mode = GR_WINDOW_COORDS; + fxMesa->Viewport.X = 0; + fxMesa->Viewport.Y = 0; + fxMesa->Viewport.Width = 0; + fxMesa->Viewport.Height = 0; + fxMesa->Viewport.Near = 0.0; + fxMesa->Viewport.Far = 0.0; + + fxMesa->CullMode = GR_CULL_DISABLE; + + fxMesa->Glide.ColorFormat = GR_COLORFORMAT_ABGR; + fxMesa->Glide.Origin = GR_ORIGIN_LOWER_LEFT; + fxMesa->Glide.Initialized = FXFALSE; +} + + + +void tdfxDDInitStateFuncs( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + ctx->Driver.UpdateState = tdfxDDUpdateState; + + ctx->Driver.ClearIndex = NULL; + ctx->Driver.ClearColor = tdfxDDClearColor; + ctx->Driver.Index = NULL; + ctx->Driver.Color = tdfxDDColor; + ctx->Driver.SetDrawBuffer = tdfxDDSetDrawBuffer; + ctx->Driver.SetReadBuffer = tdfxDDSetReadBuffer; + + ctx->Driver.IndexMask = NULL; + ctx->Driver.ColorMask = tdfxDDColorMask; + + ctx->Driver.NearFar = tdfxDDNearFar; + + ctx->Driver.RenderStart = tdfxDDRenderStart; + ctx->Driver.RenderFinish = tdfxDDRenderFinish; + ctx->Driver.RasterSetup = NULL; + + ctx->Driver.RenderVBClippedTab = NULL; + ctx->Driver.RenderVBCulledTab = NULL; + ctx->Driver.RenderVBRawTab = NULL; + + ctx->Driver.ReducedPrimitiveChange = tdfxDDReducedPrimitiveChange; + ctx->Driver.MultipassFunc = NULL; + + ctx->Driver.AlphaFunc = tdfxDDAlphaFunc; + ctx->Driver.BlendEquation = tdfxDDBlendEquation; + ctx->Driver.BlendFunc = tdfxDDBlendFunc; + ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate; + ctx->Driver.ClearDepth = tdfxDDClearDepth; + ctx->Driver.ClearStencil = NULL; + ctx->Driver.CullFace = tdfxDDCullFace; + ctx->Driver.FrontFace = tdfxDDFrontFace; + ctx->Driver.DepthFunc = tdfxDDDepthFunc; + ctx->Driver.DepthMask = tdfxDDDepthMask; + ctx->Driver.DepthRange = NULL; + ctx->Driver.Enable = tdfxDDEnable; + ctx->Driver.Fogfv = tdfxDDFogfv; + ctx->Driver.Hint = NULL; + ctx->Driver.Lightfv = NULL; + ctx->Driver.LightModelfv = tdfxDDLightModelfv; + ctx->Driver.LineStipple = NULL; + ctx->Driver.LineWidth = tdfxDDLineWidth; +#if 0 + ctx->Driver.LogicOpcode = tdfxDDLogicOpCode; + ctx->Driver.PolygonMode = NULL; +#endif + ctx->Driver.PolygonStipple = tdfxDDPolygonStipple; + ctx->Driver.Scissor = tdfxDDScissor; + ctx->Driver.ShadeModel = tdfxDDShadeModel; + + ctx->Driver.BindTexture = tdfxDDBindTexture; + ctx->Driver.DeleteTexture = tdfxDDDeleteTexture; + ctx->Driver.TexEnv = tdfxDDTexEnv; + ctx->Driver.TexParameter = tdfxDDTexParameter; + ctx->Driver.TexImage2D = tdfxDDTexImage2D; + ctx->Driver.TexSubImage2D = tdfxDDTexSubImage2D; + ctx->Driver.GetTexImage = tdfxDDGetTexImage; + ctx->Driver.UpdateTexturePalette = tdfxDDTexturePalette; + + if ( fxMesa->haveHwStencil ) { + ctx->Driver.StencilFunc = tdfxDDStencilFunc; + ctx->Driver.StencilMask = tdfxDDStencilMask; + ctx->Driver.StencilOp = tdfxDDStencilOp; + } else { + ctx->Driver.StencilFunc = NULL; + ctx->Driver.StencilMask = NULL; + ctx->Driver.StencilOp = NULL; + } + + ctx->Driver.Viewport = tdfxDDViewport; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h new file mode 100644 index 000000000..735c858b4 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h @@ -0,0 +1,55 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_STATE_H__ +#define __TDFX_STATE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" +#include "tdfx_context.h" + +extern void tdfxDDInitStateFuncs( GLcontext *ctx ); + +extern void tdfxDDUpdateHwState( GLcontext *ctx ); + +extern void tdfxInitState( tdfxContextPtr fxMesa ); + +extern void tdfxUpdateClipping( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c index 9322ac74a..8d5b627f5 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c @@ -1,9 +1,8 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c,v 1.3 2000/12/08 21:34:20 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -12,121 +11,210 @@ * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> * - * See fxapi.h for more revision/author details. */ - -#include "fxdrv.h" -#include "fxddtex.h" -#include "fxtexman.h" -#include "fxsetup.h" #include "image.h" #include "texutil.h" +#include "tdfx_context.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" -void -fxPrintTextureData(tfxTexInfo * ti) + +static int +logbase2(int n) { - fprintf(stderr, "Texture Data:\n"); - if (ti->tObj) { - fprintf(stderr, "\tName: %d\n", ti->tObj->Name); - fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel); - fprintf(stderr, "\tSize: %d x %d\n", - ti->tObj->Image[ti->tObj->BaseLevel]->Width, - ti->tObj->Image[ti->tObj->BaseLevel]->Height); + GLint i = 1; + GLint log2 = 0; + + if (n < 0) { + return -1; } - else - fprintf(stderr, "\tName: UNNAMED\n"); - fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed); - fprintf(stderr, "\tTMU: %ld\n", (unsigned long)ti->whichTMU); - fprintf(stderr, "\t%s\n", (ti->isInTM) ? "In TMU" : "Not in TMU"); - if (ti->tm[0]) - fprintf(stderr, "\tMem0: %x-%x\n", (unsigned) ti->tm[0]->startAddr, - (unsigned) ti->tm[0]->endAddr); - if (ti->tm[1]) - fprintf(stderr, "\tMem1: %x-%x\n", (unsigned) ti->tm[1]->startAddr, - (unsigned) ti->tm[1]->endAddr); - fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel); - fprintf(stderr, "\tFilters: min %d min %d\n", - (int) ti->minFilt, (int) ti->maxFilt); - fprintf(stderr, "\tClamps: s %d t %d\n", (int) ti->sClamp, - (int) ti->tClamp); - fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale); - fprintf(stderr, "\tInt Scales: s %d t %d\n", - ti->int_sScale / 0x800000, ti->int_tScale / 0x800000); - fprintf(stderr, "\t%s\n", - (ti->fixedPalette) ? "Fixed palette" : "Non fixed palette"); - fprintf(stderr, "\t%s\n", - (ti->validated) ? "Validated" : "Not validated"); -} + while (n > i) { + i *= 2; + log2++; + } + if (i != n) { + return -1; + } + else { + return log2; + } +} -/************************************************************************/ -/*************************** Texture Mapping ****************************/ -/************************************************************************/ +/* + * Compute various texture image parameters. + * Input: w, h - source texture width and height + * Output: lodlevel - Glide lod level token for the larger texture dimension + * aspectratio - Glide aspect ratio token + * sscale - S scale factor used during triangle setup + * tscale - T scale factor used during triangle setup + * wscale - OpenGL -> Glide image width scale factor + * hscale - OpenGL -> Glide image height scale factor + * + * Sample results: + * w h lodlevel aspectRatio + * 128 128 GR_LOD_LOG2_128 (=7) GR_ASPECT_LOG2_1x1 (=0) + * 64 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x1 (=0) + * 64 32 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_2x1 (=1) + * 32 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x2 (=-1) + * 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0) + */ static void -fxTexInvalidate(GLcontext * ctx, struct gl_texture_object *tObj) +tdfxTexGetInfo(const GLcontext *ctx, int w, int h, + GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio, + float *sscale, float *tscale, + int *wscale, int *hscale) { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - tfxTexInfo *ti; + int logw, logh, ar, lod, ws, hs; + float s, t; + + ASSERT(w >= 1); + ASSERT(h >= 1); + + logw = logbase2(w); + logh = logbase2(h); + ar = logw - logh; /* aspect ratio = difference in log dimensions */ + + /* Hardware only allows a maximum aspect ratio of 8x1, so handle + |ar| > 3 by scaling the image and using an 8x1 aspect ratio */ + if (ar >= 0) { + ASSERT(width >= height); + lod = logw; + s = 256.0; + ws = 1; + if (ar <= GR_ASPECT_LOG2_8x1) { + t = 256 >> ar; + hs = 1; + } + else { + /* have to stretch image height */ + t = 32.0; + hs = 1 << (ar - 3); + } + } + else { + ASSERT(width < height); + lod = logh; + t = 256.0; + hs = 1; + if (ar >= GR_ASPECT_LOG2_1x8) { + s = 256 >> -ar; + ws = 1; + } + else { + /* have to stretch image width */ + s = 32.0; + ws = 1 << (-ar - 3); + } + } - ti = fxTMGetTexInfo(tObj); - if (ti->isInTM) - fxTMMoveOutTM(fxMesa, tObj); /* TO DO: SLOW but easy to write */ + if (ar < GR_ASPECT_LOG2_1x8) + ar = GR_ASPECT_LOG2_1x8; + else if (ar > GR_ASPECT_LOG2_8x1) + ar = GR_ASPECT_LOG2_8x1; - ti->validated = GL_FALSE; - fxMesa->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; + if (lodlevel) + *lodlevel = (GrLOD_t) lod; + if (aspectratio) + *aspectratio = (GrAspectRatio_t) ar; + if (sscale) + *sscale = s; + if (tscale) + *tscale = t; + if (wscale) + *wscale = ws; + if (hscale) + *hscale = hs; +} + + +/* + * We need to call this when a texture object's minification filter + * or texture image sizes change. + */ +static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj) +{ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + GLint minl, maxl; + + if (!ti) + return; + + minl = maxl = tObj->BaseLevel; + + if (tObj->Image[minl]) { + maxl = MIN2(tObj->MaxLevel, tObj->Image[minl]->MaxLog2); + + /* compute largeLodLog2, aspect ratio and texcoord scale factors */ + tdfxTexGetInfo(ctx, tObj->Image[minl]->Width, tObj->Image[minl]->Height, + &ti->info.largeLodLog2, + &ti->info.aspectRatioLog2, + &(ti->sScale), &(ti->tScale), NULL, NULL); + } + + if (tObj->Image[maxl] && (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) { + /* mipmapping: need to compute smallLodLog2 */ + tdfxTexGetInfo(ctx, tObj->Image[maxl]->Width, + tObj->Image[maxl]->Height, + &ti->info.smallLodLog2, NULL, + NULL, NULL, NULL, NULL); + } + else { + /* not mipmapping: smallLodLog2 = largeLodLog2 */ + ti->info.smallLodLog2 = ti->info.largeLodLog2; + } + + ti->minLevel = minl; + ti->maxLevel = maxl; + ti->info.data = NULL; } -static tfxTexInfo * -fxAllocTexObjData(fxMesaContext fxMesa) + +static tdfxTexInfo * +fxAllocTexObjData(tdfxContextPtr fxMesa) { - tfxTexInfo *ti; + tdfxTexInfo *ti; int i; - if (!(ti = CALLOC(sizeof(tfxTexInfo)))) { - gl_problem(NULL, "fx Driver: out of memory !\n"); + if (!(ti = CALLOC(sizeof(tdfxTexInfo)))) { + gl_problem(NULL, "tdfx driver: out of memory"); return NULL; } - ti->validated = GL_FALSE; ti->isInTM = GL_FALSE; - ti->whichTMU = FX_TMU_NONE; + ti->whichTMU = TDFX_TMU_NONE; - ti->tm[FX_TMU0] = NULL; - ti->tm[FX_TMU1] = NULL; + ti->tm[TDFX_TMU0] = NULL; + ti->tm[TDFX_TMU1] = NULL; ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; - ti->maxFilt = GR_TEXTUREFILTER_BILINEAR; + ti->magFilt = GR_TEXTUREFILTER_BILINEAR; ti->sClamp = GR_TEXTURECLAMP_WRAP; ti->tClamp = GR_TEXTURECLAMP_WRAP; @@ -145,14 +233,16 @@ fxAllocTexObjData(fxMesaContext fxMesa) /* * Called via glBindTexture. */ + void -fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj) +tdfxDDBindTexture(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj) { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - tfxTexInfo *ti; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDTexBind(%d,%x)\n", tObj->Name, + fprintf(stderr, "fxmesa: fxDDTexBind(%d,%p)\n", tObj->Name, tObj->DriverData); } @@ -163,22 +253,23 @@ fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj) tObj->DriverData = fxAllocTexObjData(fxMesa); } - ti = fxTMGetTexInfo(tObj); + ti = TDFX_TEXTURE_DATA(tObj); + ti->lastTimeUsed = fxMesa->texBindNumber++; - fxMesa->texBindNumber++; - ti->lastTimeUsed = fxMesa->texBindNumber; - - fxMesa->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; + fxMesa->new_state |= TDFX_NEW_TEXTURE; } + +/* + * Called via glTexEnv. + */ void -fxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname, - const GLfloat * param) +tdfxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname, + const GLfloat * param) { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_DRIVER) { + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { if (param) fprintf(stderr, "fxmesa: texenv(%x,%x)\n", pname, (GLint) (*param)); @@ -186,40 +277,24 @@ fxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname, fprintf(stderr, "fxmesa: texenv(%x)\n", pname); } - /* apply any lod biasing right now */ - if (pname == GL_TEXTURE_LOD_BIAS_EXT) { - FX_grTexLodBiasValue(GR_TMU0, *param); - if (fxMesa->haveTwoTMUs) { - FX_grTexLodBiasValue(GR_TMU1, *param); - } - } - - /* invalidate currently bound texture(s) */ - { - int i; - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - struct gl_texture_object *tObj = ctx->Texture.Unit[i].CurrentD[2]; - if (!tObj->DriverData) { - tObj->DriverData = fxAllocTexObjData(fxMesa); - } - fxTexInvalidate(ctx, tObj); - } - } - - fxMesa->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; + fxMesa->new_state |= TDFX_NEW_TEXTURE; } + +/* + * Called via glTexParameter. + */ void -fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, - GLenum pname, const GLfloat * params) +tdfxDDTexParameter(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj, + GLenum pname, const GLfloat * params) { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GLenum param = (GLenum) (GLint) params[0]; - tfxTexInfo *ti; + tdfxTexInfo *ti; if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDTexParam(%d,%x,%x,%x)\n", tObj->Name, + fprintf(stderr, "fxmesa: fxDDTexParam(%d,%p,%x,%x)\n", tObj->Name, tObj->DriverData, pname, param); } @@ -229,10 +304,9 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, if (!tObj->DriverData) tObj->DriverData = fxAllocTexObjData(fxMesa); - ti = fxTMGetTexInfo(tObj); + ti = TDFX_TEXTURE_DATA(tObj); switch (pname) { - case GL_TEXTURE_MIN_FILTER: switch (param) { case GL_NEAREST: @@ -245,56 +319,69 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, ti->minFilt = GR_TEXTUREFILTER_BILINEAR; ti->LODblend = FXFALSE; break; + case GL_NEAREST_MIPMAP_LINEAR: + if (TDFX_IS_NAPALM(fxMesa)) { + if (fxMesa->haveTwoTMUs) { + ti->mmMode = GR_MIPMAP_NEAREST; + ti->LODblend = FXTRUE; + } + else { + ti->mmMode = GR_MIPMAP_NEAREST_DITHER; + ti->LODblend = FXFALSE; + } + ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + break; + } + /* XXX Voodoo3/Banshee mipmap blending seems to produce + * incorrectly filtered colors for the smallest mipmap levels. + * To work-around we fall-through here and use a different filter. + */ case GL_NEAREST_MIPMAP_NEAREST: ti->mmMode = GR_MIPMAP_NEAREST; ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; ti->LODblend = FXFALSE; break; + case GL_LINEAR_MIPMAP_LINEAR: + if (TDFX_IS_NAPALM(fxMesa)) { + if (fxMesa->haveTwoTMUs) { + ti->mmMode = GR_MIPMAP_NEAREST; + ti->LODblend = FXTRUE; + } + else { + ti->mmMode = GR_MIPMAP_NEAREST_DITHER; + ti->LODblend = FXFALSE; + } + ti->minFilt = GR_TEXTUREFILTER_BILINEAR; + break; + } + /* XXX Voodoo3/Banshee mipmap blending seems to produce + * incorrectly filtered colors for the smallest mipmap levels. + * To work-around we fall-through here and use a different filter. + */ case GL_LINEAR_MIPMAP_NEAREST: ti->mmMode = GR_MIPMAP_NEAREST; ti->minFilt = GR_TEXTUREFILTER_BILINEAR; ti->LODblend = FXFALSE; break; - case GL_NEAREST_MIPMAP_LINEAR: - if (fxMesa->haveTwoTMUs) { - ti->mmMode = GR_MIPMAP_NEAREST; - ti->LODblend = FXTRUE; - } - else { - ti->mmMode = GR_MIPMAP_NEAREST_DITHER; - ti->LODblend = FXFALSE; - } - ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; - break; - case GL_LINEAR_MIPMAP_LINEAR: - if (fxMesa->haveTwoTMUs) { - ti->mmMode = GR_MIPMAP_NEAREST; - ti->LODblend = FXTRUE; - } - else { - ti->mmMode = GR_MIPMAP_NEAREST_DITHER; - ti->LODblend = FXFALSE; - } - ti->minFilt = GR_TEXTUREFILTER_BILINEAR; - break; default: break; } - fxTexInvalidate(ctx, tObj); + RevalidateTexture(ctx, tObj); + fxMesa->new_state |= TDFX_NEW_TEXTURE; break; case GL_TEXTURE_MAG_FILTER: switch (param) { case GL_NEAREST: - ti->maxFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + ti->magFilt = GR_TEXTUREFILTER_POINT_SAMPLED; break; case GL_LINEAR: - ti->maxFilt = GR_TEXTUREFILTER_BILINEAR; + ti->magFilt = GR_TEXTUREFILTER_BILINEAR; break; default: break; } - fxTexInvalidate(ctx, tObj); + fxMesa->new_state |= TDFX_NEW_TEXTURE; break; case GL_TEXTURE_WRAP_S: @@ -308,8 +395,7 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, default: break; } - fxMesa->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; + fxMesa->new_state |= TDFX_NEW_TEXTURE; break; case GL_TEXTURE_WRAP_T: @@ -323,14 +409,12 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, default: break; } - fxMesa->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; + fxMesa->new_state |= TDFX_NEW_TEXTURE; break; case GL_TEXTURE_BORDER_COLOR: /* TO DO */ break; - case GL_TEXTURE_MIN_LOD: /* TO DO */ break; @@ -338,10 +422,10 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, /* TO DO */ break; case GL_TEXTURE_BASE_LEVEL: - fxTexInvalidate(ctx, tObj); + RevalidateTexture(ctx, tObj); break; case GL_TEXTURE_MAX_LEVEL: - fxTexInvalidate(ctx, tObj); + RevalidateTexture(ctx, tObj); break; default: @@ -355,11 +439,11 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, * Here, we delete the Glide data associated with the texture. */ void -fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj) +tdfxDDDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - fxTMFreeTexture(fxMesa, tObj); - ctx->NewState |= NEW_TEXTURING; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTMFreeTexture(fxMesa, tObj); + fxMesa->new_state |= TDFX_NEW_TEXTURE; } @@ -367,10 +451,9 @@ fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj) * Return true if texture is resident, false otherwise. */ GLboolean -fxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj) +tdfxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj) { - tfxTexInfo *ti = fxTMGetTexInfo(tObj); - /*printf("resident %d\n", (int) (ti && ti->isInTM));*/ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); return (GLboolean) (ti && ti->isInTM); } @@ -446,214 +529,40 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table) void -fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj) +tdfxDDTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (tObj) { /* per-texture palette */ - tfxTexInfo *ti; - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDTexPalette(%d,%x)\n", - tObj->Name, tObj->DriverData); - } + tdfxTexInfo *ti; if (!tObj->DriverData) tObj->DriverData = fxAllocTexObjData(fxMesa); - ti = fxTMGetTexInfo(tObj); + ti = TDFX_TEXTURE_DATA(tObj); convertPalette(ti->palette.data, &tObj->Palette); - fxTexInvalidate(ctx, tObj); + /*tdfxTexInvalidate(ctx, tObj);*/ } else { /* global texture palette */ - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDTexPalette(global)\n"); - } convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette); - fxMesa->new_state |= FX_NEW_TEXTURING; - ctx->Driver.RenderStart = fxSetupFXUnits; - } -} - - -/* - * Enable/disable the shared texture palette feature. - */ -void -fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDTexUseGlbPalette(%d)\n", state); - } - - if (state) { - FX_grTexDownloadTable(fxMesa, GR_TMU0, GR_TEXTABLE_PALETTE_6666_EXT, - &(fxMesa->glbPalette)); - if (fxMesa->haveTwoTMUs) - FX_grTexDownloadTable(fxMesa, GR_TMU1, GR_TEXTABLE_PALETTE_6666_EXT, - &(fxMesa->glbPalette)); - } - else { - if ((ctx->Texture.Unit[0].Current == ctx->Texture.Unit[0].CurrentD[2]) - && (ctx->Texture.Unit[0].Current != NULL)) { - struct gl_texture_object *tObj = ctx->Texture.Unit[0].Current; - - if (!tObj->DriverData) - tObj->DriverData = fxAllocTexObjData(fxMesa); - - fxTexInvalidate(ctx, tObj); - } - } -} - - -static int -logbase2(int n) -{ - GLint i = 1; - GLint log2 = 0; - - if (n < 0) { - return -1; - } - - while (n > i) { - i *= 2; - log2++; - } - if (i != n) { - return -1; - } - else { - return log2; } + fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX too heavy-handed */ } -/* Need different versions for different cpus. - */ -#define INT_TRICK(pow2) (0x800000 * (pow2)) - -/* - * Compute various texture image parameters. - * Input: w, h - source texture width and height - * Output: lodlevel - Glide lod level token - * aspectratio - Glide aspect ratio token - * sscale - S scale factor used during triangle setup - * tscale - T scale factor used during triangle setup - * i_sscale - integer S scale used during triangle setup - * i_tscale - integer T scale used during triangle setup - * wscale - OpenGL -> Glide image width scale factor - * hscale - OpenGL -> Glide image height scale factor - */ -void -fxTexGetInfo(const GLcontext *ctx, int w, int h, - GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio, - float *sscale, float *tscale, - int *i_sscale, int *i_tscale, - int *wscale, int *hscale) -{ - int logw, logh, ar, lod, is, it, ws, hs; - float s, t; - - ASSERT(w >= 1); - ASSERT(h >= 1); - - logw = logbase2(w); - logh = logbase2(h); - ar = logw - logh; /* aspect ratio = difference in log dimensions */ - - /* Hardware only allows a maximum aspect ratio of 8x1, so handle - |ar| > 3 by scaling the image and using an 8x1 aspect ratio */ - if (ar >= 0) { - ASSERT(width >= height); - lod = logw; -#if 1 - s = 256.0; - is = INT_TRICK(8); -#else - s = ctx->Const.MaxTextureSize; - is = INT_TRICK(ctx->Const.MaxTextureLevels - 1); -#endif - ws = 1; - if (ar < 3) { -#if 1 - t = 256 >> ar; - it = INT_TRICK(8 - ar); -#else - t = ctx->Const.MaxTextureSize >> ar; - it = INT_TRICK(ctx->Const.MaxTextureLevels - 1 - ar); -#endif - hs = 1; - } - else { - t = 32.0; - it = INT_TRICK(5); - hs = 1 << (ar - 3); - } - } - else { - ASSERT(width < height); - lod = logh; -#if 1 - t = 256.0; - it = INT_TRICK(8); -#else - t = ctx->Const.MaxTextureSize; - it = INT_TRICK(ctx->Const.MaxTextureLevels - 1); -#endif - hs = 1; - if (-ar < 3) { -#if 1 - s = 256 >> -ar; - is = INT_TRICK(8 + ar); -#else - s = ctx->Const.MaxTextureSize >> - ar; - is = INT_TRICK(ctx->Const.MaxTextureLevels - 1 + ar); -#endif - ws = 1; - } - else { - s = 32.0; - is = INT_TRICK(5); - ws = 1 << (-ar - 3); - } - } - if (ar < -3) - ar = -3; - if (ar > 3) - ar = 3; - - if (lodlevel) - *lodlevel = (GrLOD_t) lod; - if (aspectratio) - *aspectratio = (GrAspectRatio_t) ar; - if (sscale) - *sscale = s; - if (tscale) - *tscale = t; - if (wscale) - *wscale = ws; - if (hscale) - *hscale = hs; - if (i_sscale) - *i_sscale = is; - if (i_tscale) - *i_tscale = it; -} /* * Given an OpenGL internal texture format, return the corresponding - * Glide internal texture format and base texture format. + * Glide internal texture format and MesaIntTexFormat. * If allow32bpp is true, we'll return 32-bit texel formats when * appropriate. */ -void -fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, - GLint *glFormat, MesaIntTexFormat *mesaFormat, - GLint *texelSize, GLboolean allow32bpp) +static void +tdfxTexGetFormat(GLenum intFormatHint, GLboolean allow32bpp, + GrTextureFormat_t *glideFormat, + MesaIntTexFormat *mesaFormat, + GLint *texelSize) { - switch (glformat) { + switch (intFormatHint) { case 1: case GL_LUMINANCE: case GL_LUMINANCE4: @@ -662,8 +571,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_LUMINANCE16: if (glideFormat) *glideFormat = GR_TEXFMT_INTENSITY_8; - if (glFormat) - *glFormat = GL_LUMINANCE; if (mesaFormat) *mesaFormat = MESA_L8; if (texelSize) @@ -679,8 +586,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_LUMINANCE16_ALPHA16: if (glideFormat) *glideFormat = GR_TEXFMT_ALPHA_INTENSITY_88; - if (glFormat) - *glFormat = GL_LUMINANCE_ALPHA; if (mesaFormat) *mesaFormat = MESA_A8_L8; if (texelSize) @@ -693,8 +598,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_INTENSITY16: if (glideFormat) *glideFormat = GR_TEXFMT_ALPHA_8; - if (glFormat) - *glFormat = GL_INTENSITY; if (mesaFormat) *mesaFormat = MESA_I8; if (texelSize) @@ -707,8 +610,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_ALPHA16: if (glideFormat) *glideFormat = GR_TEXFMT_ALPHA_8; - if (glFormat) - *glFormat = GL_ALPHA; if (mesaFormat) *mesaFormat = MESA_A8; if (texelSize) @@ -719,8 +620,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_RGB5: if (glideFormat) *glideFormat = GR_TEXFMT_RGB_565; - if (glFormat) - *glFormat = GL_RGB; if (mesaFormat) *mesaFormat = MESA_R5_G6_B5; if (texelSize) @@ -735,8 +634,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, if (allow32bpp) { if (glideFormat) *glideFormat = GR_TEXFMT_ARGB_8888; - if (glFormat) - *glFormat = GL_RGB; if (mesaFormat) *mesaFormat = MESA_FF_R8_G8_B8; if (texelSize) @@ -745,8 +642,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, else { if (glideFormat) *glideFormat = GR_TEXFMT_RGB_565; - if (glFormat) - *glFormat = GL_RGB; if (mesaFormat) *mesaFormat = MESA_R5_G6_B5; if (texelSize) @@ -757,8 +652,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_RGBA4: if (glideFormat) *glideFormat = GR_TEXFMT_ARGB_4444; - if (glFormat) - *glFormat = GL_RGBA; if (mesaFormat) *mesaFormat = MESA_A4_R4_G4_B4; if (texelSize) @@ -773,8 +666,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, if (allow32bpp) { if (glideFormat) *glideFormat = GR_TEXFMT_ARGB_8888; - if (glFormat) - *glFormat = GL_RGBA; if (mesaFormat) *mesaFormat = MESA_A8_R8_G8_B8; if (texelSize) @@ -783,8 +674,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, else { if (glideFormat) *glideFormat = GR_TEXFMT_ARGB_4444; - if (glFormat) - *glFormat = GL_RGBA; if (mesaFormat) *mesaFormat = MESA_A4_R4_G4_B4; if (texelSize) @@ -794,8 +683,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_RGB5_A1: if (glideFormat) *glideFormat = GR_TEXFMT_ARGB_1555; - if (glFormat) - *glFormat = GL_RGBA; if (mesaFormat) *mesaFormat = MESA_A1_R5_G5_B5; if (texelSize) @@ -810,8 +697,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_COLOR_INDEX16_EXT: if (glideFormat) *glideFormat = GR_TEXFMT_P_8; - if (glFormat) - *glFormat = GL_RGBA; /* XXX why is this RGBA? */ if (mesaFormat) *mesaFormat = MESA_C8; if (texelSize) @@ -820,8 +705,6 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_COMPRESSED_RGB_FXT1_3DFX: if (glideFormat) *glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; - if (glFormat) - *glFormat = GL_COMPRESSED_RGB_FXT1_3DFX; if (mesaFormat) *mesaFormat = MESA_A8_R8_G8_B8; if (texelSize) @@ -830,15 +713,13 @@ fxTexGetFormat(GLenum glformat, GrTextureFormat_t *glideFormat, case GL_COMPRESSED_RGBA_FXT1_3DFX: if (glideFormat) *glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; - if (glFormat) - *glFormat = GL_COMPRESSED_RGBA_FXT1_3DFX; if (mesaFormat) *mesaFormat = MESA_A8_R8_G8_B8; if (texelSize) *texelSize = 4; break; default: - gl_problem(NULL, "bad texture format in fxTexGetFormat()\n"); + gl_problem(NULL, "bad texture format in fxTexGetFormat()"); break; } } @@ -865,24 +746,30 @@ fxTexusError(const char *string, FxBool fatal) } GLboolean -fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, - GLenum format, GLenum type, const GLvoid * pixels, - const struct gl_pixelstore_attrib * packing, - struct gl_texture_object * texObj, - struct gl_texture_image * texImage, - GLboolean * retainInternalCopy) +tdfxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage, + GLboolean * retainInternalCopy) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - const GLboolean allow32bpt = fxMesa->isNapalm; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLboolean allow32bpt = TDFX_IS_NAPALM(fxMesa); GrTextureFormat_t gldformat; - tfxTexInfo *ti; - tfxMipMapLevel *mml; + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; GLint dstWidth, dstHeight, wScale, hScale, texelSize, dstStride; MesaIntTexFormat intFormat; GLboolean isCompressedFormat; GLint texsize; void *uncompressedImage; + /* + printf("TexImage id=%d int 0x%x format 0x%x type 0x%x %dx%d\n", + texObj->Name, texImage->IntFormat, format, type, + texImage->Width, texImage->Height); + */ + isCompressedFormat = texImage->IsCompressed; if (target != GL_TEXTURE_2D || texImage->Border > 0) return GL_FALSE; @@ -890,38 +777,39 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, if (!texObj->DriverData) texObj->DriverData = fxAllocTexObjData(fxMesa); - ti = fxTMGetTexInfo(texObj); + ti = TDFX_TEXTURE_DATA(texObj); mml = &ti->mipmapLevel[level]; /* Determine the appropriate GL internal texel format, Mesa internal * texel format, and texelSize (bytes) given the user's internal * texture format hint. */ - fxTexGetFormat(texImage->IntFormat, &gldformat, NULL, &intFormat, - &texelSize, allow32bpt); + tdfxTexGetFormat(texImage->IntFormat, allow32bpt, + &gldformat, &intFormat, &texelSize); /* Determine width and height scale factors for texture. * Remember, Glide is limited to 8:1 aspect ratios. */ - fxTexGetInfo(ctx, - texImage->Width, texImage->Height, - NULL, /* lod level */ - NULL, /* aspect ratio */ - NULL, NULL, /* sscale, tscale */ - NULL, NULL, /* i_sscale, i_tscale */ - &wScale, &hScale); + tdfxTexGetInfo(ctx, + texImage->Width, texImage->Height, + NULL, /* lod level */ + NULL, /* aspect ratio */ + NULL, NULL, /* sscale, tscale */ + &wScale, &hScale); dstWidth = texImage->Width * wScale; dstHeight = texImage->Height * hScale; if (isCompressedFormat) { - texsize = fxDDCompressedImageSize(ctx, - texImage->IntFormat, - 2, - texImage->Width, - texImage->Height, - 1); - } else { + texsize = tdfxDDCompressedImageSize(ctx, + texImage->IntFormat, + 2, + texImage->Width, + texImage->Height, + 1); + } + else { texsize = dstWidth * dstHeight * texelSize; } + /* * If the image is not compressed, this doesn't * matter, but it might as well have a sensible @@ -948,7 +836,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, uncompressedImage = (void *)MALLOC(dstWidth * dstHeight * texelSize); if (!uncompressedImage) { - return(GL_FALSE); + return GL_FALSE; } if (isCompressedFormat) { mml->data = MALLOC(texsize); @@ -964,8 +852,11 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, mml->width = dstWidth; mml->height = dstHeight; mml->dataSize = texsize; - fxTexInvalidate(ctx, texObj); - } else { + ti->info.format = gldformat; + tdfxTMMoveOutTM(fxMesa, texObj); + /*tdfxTexInvalidate(ctx, texObj);*/ + } + else { /* * Here we don't have to allocate anything, but we * do have to point uncompressedImage to the uncompressed @@ -994,19 +885,20 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, /*printf("convert failed\n");*/ return GL_FALSE; /* not necessarily an error */ } - /* - * Now compress it if necessary. - */ + + /* + * Now compress it if necessary. + */ if (isCompressedFormat) { TxErrorCallbackFnc_t oldErrorCallback; - (*txErrorSetCallbackPtr)(fxTexusError, &oldErrorCallback); - (*txImgQuantizePtr)((char *)mml->data, - (char *)uncompressedImage, - texImage->Width, - texImage->Height, - gldformat, - TX_DITHER_NONE); - (*txErrorSetCallbackPtr)(oldErrorCallback, NULL); + (*txErrorSetCallbackProc)(fxTexusError, &oldErrorCallback); + (*txImgQuantizeProc)((char *)mml->data, + (char *)uncompressedImage, + texImage->Width, + texImage->Height, + gldformat, + TX_DITHER_NONE); + (*txErrorSetCallbackProc)(oldErrorCallback, NULL); if (uncompressedImage != mml->data) { /* * We do not need this any more, errors or no. @@ -1016,17 +908,17 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, TexusError = FXFALSE; if (TexusFatalError) { FREE(mml->data); - mml->data = (unsigned short *)0; + mml->data = NULL; TexusFatalError = FXFALSE; - return(GL_FALSE); + return GL_FALSE; } } - if (ti->validated && ti->isInTM) { - fxTMReloadMipMapLevel(ctx, texObj, level); - } - else { - fxTexInvalidate(ctx, texObj); - } + + + RevalidateTexture(ctx, texObj); + + ti->reloadImages = GL_TRUE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; *retainInternalCopy = GL_FALSE; return GL_TRUE; @@ -1034,17 +926,18 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, GLboolean -fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, const GLvoid * pixels, - const struct gl_pixelstore_attrib * packing, - struct gl_texture_object * texObj, - struct gl_texture_image * texImage) +tdfxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage) { - tfxTexInfo *ti; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; GLint wscale, hscale, dstStride = 0; - tfxMipMapLevel *mml; + tdfxMipMapLevel *mml; GLboolean result; void *uncompressedImage = (void *)0; FxU32 uncompressedSize; @@ -1056,11 +949,18 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, if (!texObj->DriverData) return GL_FALSE; - ti = fxTMGetTexInfo(texObj); + /* + printf("TexSubImage id=%d lvl=%d int=0x%x format=0x%x type=0x%x x=%d y=%d w=%d h=%d fullW=%d fullH=%d\n", + texObj->Name, level, + texImage->IntFormat, format, type, xoffset, yoffset, width, height, + texImage->Width, texImage->Height); + */ + + ti = TDFX_TEXTURE_DATA(texObj); mml = &ti->mipmapLevel[level]; - fxTexGetInfo(ctx, texImage->Width, texImage->Height, NULL, NULL, - NULL, NULL, NULL, NULL, &wscale, &hscale); + tdfxTexGetInfo(ctx, texImage->Width, texImage->Height, NULL, NULL, + NULL, NULL, &wscale, &hscale); /* * Must have an existing texture image! @@ -1142,7 +1042,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, width = (mml->width + 0x7) &~ 0x7; height = (mml->height + 0x3) &~ 0x3; /* - * A texel is 8888 for this format. + * A texel is 8888 for this format. */ uncompressedSize = mml->width * mml->height * 4; uncompressedImage = (void *)MALLOC(uncompressedSize); @@ -1157,19 +1057,20 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, format, type, pixels, packing); if (!result) { FREE(uncompressedImage); + printf("TexSubImage convert failed\n"); return GL_FALSE; } /* * Now that we have converted the data, then compress it. */ - (*txErrorSetCallbackPtr)(fxTexusError, &oldErrorCallback); - (*txImgQuantizePtr)((char *)mml->data, + (*txErrorSetCallbackProc)(fxTexusError, &oldErrorCallback); + (*txImgQuantizeProc)((char *)mml->data, (char *)uncompressedImage, mml->width, mml->height, mml->glideFormat, TX_DITHER_NONE); - (*txErrorSetCallbackPtr)(oldErrorCallback, NULL); + (*txErrorSetCallbackProc)(oldErrorCallback, NULL); result = TexusFatalError; TexusFatalError = TexusError = FXFALSE; /* @@ -1212,15 +1113,8 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, return GL_FALSE; } - if (ti->validated && ti->isInTM) - /* Don't use this, it's very broken. Download whole image for now.*/ -#if 0 - fxTMReloadSubMipMapLevel(ctx, texObj, level, yoffset, height); -#else - fxTMReloadMipMapLevel(ctx, texObj, level); -#endif - else - fxTexInvalidate(ctx, texObj); + ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */ + fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX this might be a bit much */ return GL_TRUE; } @@ -1231,18 +1125,18 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, /**********************************************************************/ GLboolean -fxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, - GLint level, GLsizei imageSize, - const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage, - GLboolean *retainInternalCopy) +tdfxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, + GLint level, GLsizei imageSize, + const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - const GLboolean allow32bpt = fxMesa->isNapalm; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLboolean allow32bpt = TDFX_IS_NAPALM(fxMesa); GrTextureFormat_t gldformat; - tfxTexInfo *ti; - tfxMipMapLevel *mml; + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; GLint dstWidth, dstHeight, wScale, hScale, texelSize; MesaIntTexFormat intFormat; GLboolean isCompressedFormat; @@ -1254,48 +1148,48 @@ fxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, if (!texObj->DriverData) texObj->DriverData = fxAllocTexObjData(fxMesa); - ti = fxTMGetTexInfo(texObj); + ti = TDFX_TEXTURE_DATA(texObj); mml = &ti->mipmapLevel[level]; - isCompressedFormat = fxDDIsCompressedGlideFormatMacro(texImage->IntFormat); + isCompressedFormat = tdfxDDIsCompressedGlideFormatMacro(texImage->IntFormat); if (!isCompressedFormat) { gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(format)" ); return GL_FALSE; - } + } /* Determine the apporpriate GL internal texel format, Mesa internal * texel format, and texelSize (bytes) given the user's internal * texture format hint. */ - fxTexGetFormat(texImage->IntFormat, &gldformat, NULL, &intFormat, - &texelSize, allow32bpt); + tdfxTexGetFormat(texImage->IntFormat, allow32bpt, + &gldformat, &intFormat, &texelSize); /* Determine width and height scale factors for texture. * Remember, Glide is limited to 8:1 aspect ratios. */ - fxTexGetInfo(ctx, - texImage->Width, texImage->Height, - NULL, /* lod level */ - NULL, /* aspect ratio */ - NULL, NULL, /* sscale, tscale */ - NULL, NULL, /* i_sscale, i_tscale */ - &wScale, &hScale); + tdfxTexGetInfo(ctx, + texImage->Width, texImage->Height, + NULL, /* lod level */ + NULL, /* aspect ratio */ + NULL, NULL, /* sscale, tscale */ + &wScale, &hScale); dstWidth = texImage->Width * wScale; dstHeight = texImage->Height * hScale; /* housekeeping */ _mesa_set_teximage_component_sizes(intFormat, texImage); - texsize = fxDDCompressedImageSize(ctx, - texImage->IntFormat, - 2, - texImage->Width, - texImage->Height, - 1); + texsize = tdfxDDCompressedImageSize(ctx, + texImage->IntFormat, + 2, + texImage->Width, + texImage->Height, + 1); if (texsize != imageSize) { gl_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage2D(texsize)"); return GL_FALSE; } + /* allocate new storage for texture image, if needed */ if (!mml->data || mml->glideFormat != gldformat || mml->width != dstWidth || mml->height != dstHeight || @@ -1311,50 +1205,59 @@ fxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, mml->glideFormat = gldformat; mml->width = dstWidth; mml->height = dstHeight; - fxTexInvalidate(ctx, texObj); + tdfxTMMoveOutTM(fxMesa, texObj); + /*tdfxTexInvalidate(ctx, texObj);*/ } + /* save the texture data */ MEMCPY(mml->data, data, imageSize); - if (ti->validated && ti->isInTM) { - fxTMReloadMipMapLevel(ctx, texObj, level); - } - else { - fxTexInvalidate(ctx, texObj); - } + + RevalidateTexture(ctx, texObj); + + ti->reloadImages = GL_TRUE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; *retainInternalCopy = GL_FALSE; return GL_TRUE; } GLboolean -fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, - GLint level, GLint xoffset, - GLint yoffset, GLsizei width, - GLint height, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) +tdfxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) { - tfxTexInfo *ti; - tfxMipMapLevel *mml; - /* - * We punt if we are not replacing the entire image. This - * is allowed by the spec. - */ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; + + /* + * We punt if we are not replacing the entire image. This + * is allowed by the spec. + */ if ((xoffset != 0) && (yoffset != 0) && (width != texImage->Width) && (height != texImage->Height)) { - return(GL_FALSE); + return GL_FALSE; } - ti = fxTMGetTexInfo(texObj); + + ti = TDFX_TEXTURE_DATA(texObj); mml = &ti->mipmapLevel[level]; if (imageSize != mml->dataSize) { - return(GL_FALSE); + return GL_FALSE; } MEMCPY(data, mml->data, imageSize); - return(GL_TRUE); + + ti->reloadImages = GL_TRUE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + + return GL_TRUE; } + #if 0 static void PrintTexture(int w, int h, int c, const GLubyte * data) @@ -1375,15 +1278,15 @@ PrintTexture(int w, int h, int c, const GLubyte * data) GLboolean -fxDDTestProxyTexImage(GLcontext *ctx, GLenum target, - GLint level, GLint internalFormat, - GLenum format, GLenum type, - GLint width, GLint height, - GLint depth, GLint border ) +tdfxDDTestProxyTexImage(GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; - struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; switch (target) { case GL_PROXY_TEXTURE_1D: @@ -1391,13 +1294,13 @@ fxDDTestProxyTexImage(GLcontext *ctx, GLenum target, case GL_PROXY_TEXTURE_2D: { struct gl_texture_object *tObj; - tfxTexInfo *ti; + tdfxTexInfo *ti; int memNeeded; tObj = ctx->Texture.Proxy2D; if (!tObj->DriverData) tObj->DriverData = fxAllocTexObjData(fxMesa); - ti = fxTMGetTexInfo(tObj); + ti = TDFX_TEXTURE_DATA(tObj); /* assign the parameters to test against */ tObj->Image[level]->Width = width; @@ -1413,8 +1316,7 @@ fxDDTestProxyTexImage(GLcontext *ctx, GLenum target, tObj->MinFilter = GL_LINEAR_MIPMAP_LINEAR; tObj->MagFilter = GL_NEAREST; } - ti->validated = GL_FALSE; - fxTexValidate(ctx, tObj); + RevalidateTexture(ctx, tObj); /* printf("small lodlog2 0x%x\n", ti->info.smallLodLog2); @@ -1457,13 +1359,13 @@ fxDDTestProxyTexImage(GLcontext *ctx, GLenum target, * a glGetTexImage() call or to prepare for software texturing. */ GLvoid * -fxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, - const struct gl_texture_object *texObj, - GLenum * formatOut, GLenum * typeOut, - GLboolean * freeImageOut) +tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum * formatOut, GLenum * typeOut, + GLboolean * freeImageOut) { - tfxTexInfo *ti; - tfxMipMapLevel *mml; + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; if (target != GL_TEXTURE_2D) return NULL; @@ -1471,7 +1373,7 @@ fxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, if (!texObj->DriverData) return NULL; - ti = fxTMGetTexInfo(texObj); + ti = TDFX_TEXTURE_DATA(texObj); mml = &ti->mipmapLevel[level]; if (mml->data) { MesaIntTexFormat mesaFormat; @@ -1544,16 +1446,16 @@ fxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, */ uncompressedImage = MALLOC(mml->width * mml->height * 4); if (!uncompressedImage) { - gl_problem(NULL, "can't get memory in fxDDGetTexImage"); - return(NULL); + gl_problem(NULL, "can't get memory in tdfxDDGetTexImage"); + return NULL; } - (*txImgDequantizeFXT1Ptr)((FxU32 *)uncompressedImage, - (FxU32 *)mml->data, - mml->width, - mml->height); + (*txImgDequantizeFXT1Proc)((FxU32 *)uncompressedImage, + (FxU32 *)mml->data, + mml->width, + mml->height); break; default: - gl_problem(NULL, "Bad glideFormat in fxDDGetTexImage"); + gl_problem(NULL, "Bad glideFormat in tdfxDDGetTexImage"); return NULL; } _mesa_unconvert_teximage(mesaFormat, mml->width, mml->height, @@ -1577,13 +1479,13 @@ fxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, * copy out the compressed data. */ void -fxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, - GLint lod, void *image, - const struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) +tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, + GLint lod, void *image, + const struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) { - tfxTexInfo *ti; - tfxMipMapLevel *mml; + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; if (target != GL_TEXTURE_2D) return; @@ -1591,7 +1493,7 @@ fxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, if (!texObj->DriverData) return; - ti = fxTMGetTexInfo(texObj); + ti = TDFX_TEXTURE_DATA(texObj); mml = &ti->mipmapLevel[lod]; if (mml->data) { MEMCPY(image, mml->data, mml->dataSize); @@ -1603,16 +1505,9 @@ fxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, * texture format. */ GLint -fxDDSpecificCompressedTexFormat(GLcontext *ctx, - GLint internalFormat, - GLint numDimensions, - GLint *levelp, - GLsizei *widthp, - GLsizei *heightp, - GLsizei *depthp, - GLint *borderp, - GLenum *formatp, - GLenum *typep) +tdfxDDSpecificCompressedTexFormat(GLcontext *ctx, + GLint internalFormat, + GLint numDimensions) { if (numDimensions != 2) { return internalFormat; @@ -1625,39 +1520,10 @@ fxDDSpecificCompressedTexFormat(GLcontext *ctx, * This is just to ease the transition to a Glide with * the texus2 library. */ - if (!txImgQuantizePtr || !txImgDequantizeFXT1Ptr) { - return(internalFormat); + if (!txImgQuantizeProc || !txImgDequantizeFXT1Proc) { + return internalFormat; } switch (internalFormat) { - /* - * GL_S3_s3tc uses negative level values. - */ - case GL_RGB_S3TC: - case GL_RGB4_S3TC: - { - GLint level; - if (levelp) { - level = *levelp; - if (level < 0) { - level = -level; - *levelp = level; - } - } - } - return GL_COMPRESSED_RGB_FXT1_3DFX; - case GL_RGBA_S3TC: - case GL_RGBA4_S3TC: - { - GLint level; - if (levelp) { - level = *levelp; - if (level < 0) { - level = -level; - *levelp = level; - } - } - } - return GL_COMPRESSED_RGBA_FXT1_3DFX; case GL_COMPRESSED_RGB_ARB: return GL_COMPRESSED_RGB_FXT1_3DFX; case GL_COMPRESSED_RGBA_ARB: @@ -1671,14 +1537,14 @@ fxDDSpecificCompressedTexFormat(GLcontext *ctx, * texture format. */ GLint -fxDDBaseCompressedTexFormat(GLcontext *ctx, - GLint internalFormat) +tdfxDDBaseCompressedTexFormat(GLcontext *ctx, + GLint internalFormat) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: - return(GL_RGB); + return GL_RGB; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return(GL_RGBA); + return GL_RGBA; } return -1; } @@ -1689,9 +1555,9 @@ fxDDBaseCompressedTexFormat(GLcontext *ctx, * function pointer. */ GLboolean -fxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat) +tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat) { - return(fxDDIsCompressedFormatMacro(internalFormat)); + return tdfxDDIsCompressedFormatMacro(internalFormat); } @@ -1707,12 +1573,12 @@ fxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat) * exactly the right parameters. */ GLsizei -fxDDCompressedImageSize(GLcontext *ctx, - GLenum intFormat, - GLuint numDimensions, - GLuint width, - GLuint height, - GLuint depth) +tdfxDDCompressedImageSize(GLcontext *ctx, + GLenum intFormat, + GLuint numDimensions, + GLuint width, + GLuint height, + GLuint depth) { if (numDimensions != 2) { return 0; @@ -1731,7 +1597,7 @@ fxDDCompressedImageSize(GLcontext *ctx, */ width = (width + 0x7) &~ 0x7; height = (height + 0x3) &~ 0x3; - return(width * height); + return width * height; } - return(0); + return 0; } diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h new file mode 100644 index 000000000..95ef3b018 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h @@ -0,0 +1,157 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef _TDFX_TEX_H_ +#define _TDFX_TEX_H_ + + +#include "texutil.h" + + +#define tdfxDDIsCompressedFormatMacro(internalFormat) \ + (((internalFormat) == GL_COMPRESSED_RGB_FXT1_3DFX) || \ + ((internalFormat) == GL_COMPRESSED_RGBA_FXT1_3DFX)) +#define tdfxDDIsCompressedGlideFormatMacro(internalFormat) \ + ((internalFormat) == GR_TEXFMT_ARGB_CMP_FXT1) + + + +extern void +tdfxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj); + +extern void +tdfxDDBindTexture(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj); + +extern void +tdfxDDDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj); + +extern GLboolean +tdfxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj); + +extern void +tdfxDDTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj); + +#if 000 /* DEAD? */ +extern void +fxDDTexUseGlobalPalette(GLcontext * ctx, GLboolean state); +#endif + +extern void +tdfxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname, + const GLfloat * param); + +extern void +tdfxDDTexParameter(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj, + GLenum pname, const GLfloat * params); + +extern GLboolean +tdfxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage, + GLboolean * retainInternalCopy); + +extern GLboolean +tdfxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage); + +extern GLboolean +tdfxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, + GLint level, GLsizei imageSize, + const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + +extern GLboolean +tdfxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + +extern GLboolean +tdfxDDTestProxyTexImage(GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border); + +extern GLvoid * +tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum * formatOut, GLenum * typeOut, + GLboolean * freeImageOut); + +extern void +tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, + GLint lod, void *image, + const struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + +extern GLint +tdfxDDSpecificCompressedTexFormat(GLcontext *ctx, + GLint internalFormat, + GLint numDimensions); + +extern GLint +tdfxDDBaseCompressedTexFormat(GLcontext *ctx, + GLint internalFormat); + +extern GLboolean +tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat); + +extern GLsizei +tdfxDDCompressedImageSize(GLcontext *ctx, + GLenum intFormat, + GLuint numDimensions, + GLuint width, + GLuint height, + GLuint depth); + + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c new file mode 100644 index 000000000..97fe9d4c6 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c @@ -0,0 +1,968 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" + + +#define BAD_ADDRESS ((FxU32) -1) + + +#if 0 /* DEBUG use */ +/* + * Verify the consistancy of the texture memory manager. + * This involves: + * Traversing all texture objects and computing total memory used. + * Traverse the free block list and computing total memory free. + * Compare the total free and total used amounts to the total memory size. + * Make various assertions about the results. + */ +static void +VerifyFreeList(tdfxContextPtr fxMesa, FxU32 tmu) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *block; + int prevStart = -1, prevEnd = -1; + int totalFree = 0; + int numObj = 0, numRes = 0; + int totalUsed = 0; + + for (block = shared->tmFree[tmu]; block; block = block->next) { + assert( block->endAddr > 0 ); + assert( block->startAddr <= shared->totalTexMem[tmu] ); + assert( block->endAddr <= shared->totalTexMem[tmu] ); + assert( (int) block->startAddr > prevStart ); + assert( (int) block->startAddr >= prevEnd ); + prevStart = (int) block->startAddr; + prevEnd = (int) block->endAddr; + totalFree += (block->endAddr - block->startAddr); + } + assert(totalFree == shared->freeTexMem[tmu]); + + { + struct gl_texture_object *obj; + for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) { + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(obj); + numObj++; + if (ti) { + if (ti->isInTM) { + numRes++; + assert(ti->tm[0]); + if (ti->tm[tmu]) + totalUsed += (ti->tm[tmu]->endAddr - ti->tm[tmu]->startAddr); + } + else { + assert(!ti->tm[0]); + } + } + } + } + + printf("totalFree: %d totalUsed: %d totalMem: %d #objs=%d #res=%d\n", + shared->freeTexMem[tmu], totalUsed, shared->totalTexMem[tmu], + numObj, numRes); + + assert(totalUsed + totalFree == shared->totalTexMem[tmu]); +} + + +static void +dump_texmem(tdfxContextPtr fxMesa) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj; + tdfxMemRange *r; + FxU32 prev; + + printf("DUMP Objects:\n"); + for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) { + tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj); + + if (info && info->isInTM) { + printf("Obj %8p: %4d info = %p\n", obj, obj->Name, info); + + printf(" isInTM=%d whichTMU=%d lastTimeUsed=%d\n", + info->isInTM, info->whichTMU, info->lastTimeUsed); + printf(" tm[0] = %p", info->tm[0]); + assert(info->tm[0]); + if (info->tm[0]) { + printf(" tm startAddr = %d endAddr = %d", + info->tm[0]->startAddr, + info->tm[0]->endAddr); + } + printf("\n"); + printf(" tm[1] = %p", info->tm[1]); + if (info->tm[1]) { + printf(" tm startAddr = %d endAddr = %d", + info->tm[1]->startAddr, + info->tm[1]->endAddr); + } + printf("\n"); + } + } + + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + + printf("Free memory unit 0: %d bytes\n", shared->freeTexMem[0]); + prev = 0; + for (r = shared->tmFree[0]; r; r = r->next) { + printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev); + prev = r->endAddr; + } + + printf("Free memory unit 1: %d bytes\n", shared->freeTexMem[1]); + prev = 0; + for (r = shared->tmFree[1]; r; r = r->next) { + printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev); + prev = r->endAddr; + } + +} +#endif + + + +#ifdef TEXSANITY +static void +fubar(void) +{ +} + +/* + * Sanity Check + */ +static void +sanity(tdfxContextPtr fxMesa) +{ + tdfxMemRange *tmp, *prev, *pos; + + prev = 0; + tmp = fxMesa->tmFree[0]; + while (tmp) { + if (!tmp->startAddr && !tmp->endAddr) { + fprintf(stderr, "Textures fubar\n"); + fubar(); + } + if (tmp->startAddr >= tmp->endAddr) { + fprintf(stderr, "Node fubar\n"); + fubar(); + } + if (prev && (prev->startAddr >= tmp->startAddr || + prev->endAddr > tmp->startAddr)) { + fprintf(stderr, "Sorting fubar\n"); + fubar(); + } + prev = tmp; + tmp = tmp->next; + } + prev = 0; + tmp = fxMesa->tmFree[1]; + while (tmp) { + if (!tmp->startAddr && !tmp->endAddr) { + fprintf(stderr, "Textures fubar\n"); + fubar(); + } + if (tmp->startAddr >= tmp->endAddr) { + fprintf(stderr, "Node fubar\n"); + fubar(); + } + if (prev && (prev->startAddr >= tmp->startAddr || + prev->endAddr > tmp->startAddr)) { + fprintf(stderr, "Sorting fubar\n"); + fubar(); + } + prev = tmp; + tmp = tmp->next; + } +} +#endif + + + + + +/* + * Allocate and initialize a new MemRange struct. + * Try to allocate it from the pool of free MemRange nodes rather than malloc. + */ +static tdfxMemRange * +NewRangeNode(tdfxContextPtr fxMesa, FxU32 start, FxU32 end) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *result; + + _glthread_LOCK_MUTEX(mesaShared->Mutex); + if (shared && shared->tmPool) { + result = shared->tmPool; + shared->tmPool = shared->tmPool->next; + } + else { + result = MALLOC(sizeof(tdfxMemRange)); + + } + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + + if (!result) { + /*fprintf(stderr, "fxDriver: out of memory!\n");*/ + return NULL; + } + + result->startAddr = start; + result->endAddr = end; + result->next = NULL; + + return result; +} + + +/* + * Initialize texture memory. + * We take care of one or both TMU's here. + */ +void +tdfxTMInit(tdfxContextPtr fxMesa) +{ + if (!fxMesa->glCtx->Shared->DriverData) { + const char *extensions; + struct tdfxSharedState *shared = CALLOC_STRUCT(tdfxSharedState); + if (!shared) + return; + + extensions = FX_grGetString(fxMesa, GR_EXTENSION); + if (strstr(extensions, "TEXUMA")) { + FxU32 start, end; + shared->umaTexMemory = GL_TRUE; + FX_grEnable(fxMesa, GR_TEXTURE_UMA_EXT); + start = FX_grTexMinAddress(fxMesa, 0); + end = FX_grTexMaxAddress(fxMesa, 0); + shared->totalTexMem[0] = end - start; + shared->totalTexMem[1] = 0; + shared->freeTexMem[0] = end - start; + shared->freeTexMem[1] = 0; + shared->tmFree[0] = NewRangeNode(fxMesa, start, end); + shared->tmFree[1] = NULL; + /*printf("UMA tex memory: %d\n", (int) (end - start));*/ + } + else { + const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1; + int tmu; + shared->umaTexMemory = GL_FALSE; + for (tmu = 0; tmu < numTMUs; tmu++) { + FxU32 start = FX_grTexMinAddress(fxMesa, tmu); + FxU32 end = FX_grTexMaxAddress(fxMesa, tmu); + shared->totalTexMem[tmu] = end - start; + shared->freeTexMem[tmu] = end - start; + shared->tmFree[tmu] = NewRangeNode(fxMesa, start, end); + /*printf("Split tex memory: %d\n", (int) (end - start));*/ + } + } + + shared->tmPool = NULL; + fxMesa->glCtx->Shared->DriverData = shared; + /*printf("Texture memory init UMA: %d\n", shared->umaTexMemory);*/ + } +} + + +/* + * Clean-up texture memory before destroying context. + */ +void +tdfxTMClose(tdfxContextPtr fxMesa) +{ + if (fxMesa->glCtx->Shared->RefCount == 1) { + /* refcount will soon go to zero, free our 3dfx stuff */ + struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData; + + const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1; + int tmu; + tdfxMemRange *tmp, *next; + + /* Deallocate the pool of free tdfxMemRange nodes */ + tmp = shared->tmPool; + while (tmp) { + next = tmp->next; + FREE(tmp); + tmp = next; + } + + /* Delete the texture memory block tdfxMemRange nodes */ + for (tmu = 0; tmu < numTMUs; tmu++) { + tmp = shared->tmFree[tmu]; + while (tmp) { + next = tmp->next; + FREE(tmp); + tmp = next; + } + } + + FREE(shared); + fxMesa->glCtx->Shared->DriverData = NULL; + } +} + + + +/* + * Delete a tdfxMemRange struct. + * We keep a linked list of free/available tdfxMemRange structs to + * avoid extra malloc/free calls. + */ +#if 0 +static void +DeleteRangeNode_NoLock(struct TdfxSharedState *shared, tdfxMemRange *range) +{ + /* insert at head of list */ + range->next = shared->tmPool; + shared->tmPool = range; +} +#endif + +#define DELETE_RANGE_NODE(shared, range) \ + (range)->next = (shared)->tmPool; \ + (shared)->tmPool = (range) + + + +/* + * When we've run out of texture memory we have to throw out an + * existing texture to make room for the new one. This function + * determins the texture to throw out. + */ +static struct gl_texture_object * +FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu) +{ + const GLuint bindnumber = fxMesa->texBindNumber; + struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj; + GLfloat lowestPriority; + GLuint oldestAge; + + oldestObj = NULL; + oldestAge = 0; + + lowestPriority = 1.0F; + lowestPriorityObj = NULL; + + for (obj = fxMesa->glCtx->Shared->TexObjectList; obj; obj = obj->Next) { + tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj); + + if (info && info->isInTM && + ((info->whichTMU == tmu) || (info->whichTMU == TDFX_TMU_BOTH) || + (info->whichTMU == TDFX_TMU_SPLIT))) { + GLuint age, lasttime; + + assert(info->tm[0]); + lasttime = info->lastTimeUsed; + + if (lasttime > bindnumber) + age = bindnumber + (UINT_MAX - lasttime + 1); /* TO DO: check wrap around */ + else + age = bindnumber - lasttime; + + if (age >= oldestAge) { + oldestAge = age; + oldestObj = obj; + } + + /* examine priority */ + if (obj->Priority < lowestPriority) { + lowestPriority = obj->Priority; + lowestPriorityObj = obj; + } + } + } + + if (lowestPriority < 1.0) { + ASSERT(lowestPriorityObj); + /* + printf("discard %d pri=%f\n", lowestPriorityObj->Name, lowestPriority); + */ + return lowestPriorityObj; + } + else { + /* + printf("discard %d age=%d\n", oldestObj->Name, oldestAge); + */ + return oldestObj; + } +} + + +#if 0 +static void +FlushTexMemory(tdfxContextPtr fxMesa) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + struct gl_texture_object *obj; + + for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) { + if (obj->RefCount < 2) { + /* don't flush currently bound textures */ + tdfxTMMoveOutTM_NoLock(fxMesa, obj); + } + } +} +#endif + + +/* + * Find the address (offset?) at which we can store a new texture. + * <tmu> is the texture unit. + * <size> is the texture size in bytes. + */ +static FxU32 +FindStartAddr(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 size) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *prev, *block; + FxU32 result; +#if 0 + int discardedCount = 0; +#define MAX_DISCARDS 10 +#endif + + if (shared->umaTexMemory) { + assert(tmu == TDFX_TMU0); + } + + _glthread_LOCK_MUTEX(mesaShared->Mutex); + while (1) { + prev = NULL; + block = shared->tmFree[tmu]; + while (block) { + if (block->endAddr - block->startAddr >= size) { + /* The texture will fit here */ + result = block->startAddr; + block->startAddr += size; + if (block->startAddr == block->endAddr) { + /* Remove this node since it's empty */ + if (prev) { + prev->next = block->next; + } + else { + shared->tmFree[tmu] = block->next; + } + DELETE_RANGE_NODE(shared, block); + } + shared->freeTexMem[tmu] -= size; + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return result; + } + prev = block; + block = block->next; + } + /* We failed to find a block large enough to accomodate <size> bytes. + * Find the oldest texObject and free it. + */ +#if 0 + discardedCount++; + if (discardedCount > MAX_DISCARDS + 1) { + gl_problem(NULL, "tdfx driver: extreme texmem fragmentation"); + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return BAD_ADDRESS; + } + else if (discardedCount > MAX_DISCARDS) { + /* texture memory is probably really fragmented, flush it */ + FlushTexMemory(fxMesa); + } + else +#endif + { + struct gl_texture_object *obj = FindOldestObject(fxMesa, tmu); + if (obj) { + tdfxTMMoveOutTM_NoLock(fxMesa, obj); + fxMesa->stats.texSwaps++; + } + else { + gl_problem(NULL, "tdfx driver: extreme texmem fragmentation"); + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return BAD_ADDRESS; + } + } + } + + /* never get here, but play it safe */ + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return BAD_ADDRESS; +} + + +/* + * Remove the given tdfxMemRange node from hardware texture memory. + */ +static void +RemoveRange_NoLock(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *block, *prev; + + if (shared->umaTexMemory) { + assert(tmu == TDFX_TMU0); + } + + if (!range) + return; + + if (range->startAddr == range->endAddr) { + DELETE_RANGE_NODE(shared, range); + return; + } + shared->freeTexMem[tmu] += range->endAddr - range->startAddr; + + /* find position in linked list to insert this tdfxMemRange node */ + prev = NULL; + block = shared->tmFree[tmu]; + while (block) { + assert(range->startAddr != block->startAddr); + if (range->startAddr > block->startAddr) { + prev = block; + block = block->next; + } + else { + break; + } + } + + /* Insert the free block, combine with adjacent blocks when possible */ + range->next = block; + if (block) { + if (range->endAddr == block->startAddr) { + /* Combine */ + block->startAddr = range->startAddr; + DELETE_RANGE_NODE(shared, range); + range = block; + } + } + if (prev) { + if (prev->endAddr == range->startAddr) { + /* Combine */ + prev->endAddr = range->endAddr; + prev->next = range->next; + DELETE_RANGE_NODE(shared, range); + } + else { + prev->next = range; + } + } + else { + shared->tmFree[tmu] = range; + } +} + + +#if 0 /* NOT USED */ +static void +RemoveRange(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + _glthread_LOCK_MUTEX(mesaShared->Mutex); + RemoveRange_NoLock(fxMesa, tmu, range); + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); +} +#endif + + +/* + * Allocate space for a texture image. + * <tmu> is the texture unit + * <texmemsize> is the number of bytes to allocate + */ +static tdfxMemRange * +AllocTexMem(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 texmemsize) +{ + FxU32 startAddr; + startAddr = FindStartAddr(fxMesa, tmu, texmemsize); + if (startAddr == BAD_ADDRESS) { + printf("AllocTexMem returned NULL! tmu=%d texmemsize=%d\n", + tmu, texmemsize); + return NULL; + } + else { + tdfxMemRange *range; + range = NewRangeNode(fxMesa, startAddr, startAddr + texmemsize); + return range; + } +} + + +/* + * Download (copy) the given texture data (all mipmap levels) into the + * Voodoo's texture memory. + * The texture memory must have already been allocated. + */ +void +tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) +{ + tdfxTexInfo *ti; + GLint l; + FxU32 targetTMU; + + assert(tObj); + ti = TDFX_TEXTURE_DATA(tObj); + assert(ti); + targetTMU = ti->whichTMU; + + switch (targetTMU) { + case TDFX_TMU0: + case TDFX_TMU1: + if (ti->tm[targetTMU]) { + for (l = ti->minLevel; l <= ti->maxLevel + && ti->mipmapLevel[l].data; l++) { + GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; + FX_grTexDownloadMipMapLevel_NoLock(targetTMU, + ti->tm[targetTMU]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[l].data); + } + } + break; + case TDFX_TMU_SPLIT: + if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) { + for (l = ti->minLevel; l <= ti->maxLevel + && ti->mipmapLevel[l].data; l++) { + GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, + ti->tm[TDFX_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_ODD, + ti->mipmapLevel[l].data); + + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, + ti->tm[TDFX_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_EVEN, + ti->mipmapLevel[l].data); + } + } + break; + case TDFX_TMU_BOTH: + if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) { + for (l = ti->minLevel; l <= ti->maxLevel + && ti->mipmapLevel[l].data; l++) { + GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, + ti->tm[TDFX_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[l].data); + + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, + ti->tm[TDFX_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[l].data); + } + } + break; + default: + gl_problem(NULL, "error in tdfxTMDownloadTexture: bad tmu"); + return; + } +} + + +void +tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, + GLint level) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + GrLOD_t glideLod; + FxU32 tmu; + + tmu = ti->whichTMU; + glideLod = ti->info.largeLodLog2 - level + tObj->BaseLevel; + ASSERT(ti->isInTM); + + switch (tmu) { + case TDFX_TMU0: + case TDFX_TMU1: + FX_grTexDownloadMipMapLevel(fxMesa, tmu, + ti->tm[tmu]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[level].data); + break; + case TDFX_TMU_SPLIT: + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU0, + ti->tm[GR_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_ODD, + ti->mipmapLevel[level].data); + + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU1, + ti->tm[GR_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_EVEN, + ti->mipmapLevel[level].data); + break; + case TDFX_TMU_BOTH: + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU0, + ti->tm[GR_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[level].data); + + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU1, + ti->tm[GR_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[level].data); + break; + + default: + gl_problem(ctx, "error in tdfxTMReloadMipMapLevel(): wrong tmu"); + break; + } +} + + +/* + * Allocate space for the given texture in texture memory then + * download (copy) it into that space. + */ +void +tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj, + FxU32 targetTMU ) +{ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + FxU32 texmemsize; + + fxMesa->stats.reqTexUpload++; + + if (ti->isInTM) { + if (ti->whichTMU == targetTMU) + return; + if (targetTMU == TDFX_TMU_SPLIT || ti->whichTMU == TDFX_TMU_SPLIT) { + tdfxTMMoveOutTM_NoLock(fxMesa, tObj); + } + else { + if (ti->whichTMU == TDFX_TMU_BOTH) + return; + targetTMU = TDFX_TMU_BOTH; + } + } + + ti->whichTMU = targetTMU; + + switch (targetTMU) { + case TDFX_TMU0: + case TDFX_TMU1: + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, + &(ti->info)); + ti->tm[targetTMU] = AllocTexMem(fxMesa, targetTMU, texmemsize); + break; + case TDFX_TMU_SPLIT: + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD, + &(ti->info)); + ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize); + if (ti->tm[TDFX_TMU0]) + fxMesa->stats.memTexUpload += texmemsize; + + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_EVEN, + &(ti->info)); + ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize); + break; + case TDFX_TMU_BOTH: + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, + &(ti->info)); + ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize); + if (ti->tm[TDFX_TMU0]) + fxMesa->stats.memTexUpload += texmemsize; + + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, + &(ti->info)); + ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize); + break; + default: + gl_problem(NULL, "error in tdfxTMMoveInTM() -> bad tmu (%d)"); + return; + } + + ti->reloadImages = GL_TRUE; + ti->isInTM = GL_TRUE; + + fxMesa->stats.texUpload++; +} + + +/* + * Move the given texture out of hardware texture memory. + * This deallocates the texture's memory space. + */ +void +tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj ) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxTMMoveOutTM(%p (%d))\n", tObj, tObj->Name); + } + + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ + + if (!ti || !ti->isInTM) + return; + + switch (ti->whichTMU) { + case TDFX_TMU0: + case TDFX_TMU1: + RemoveRange_NoLock(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]); + break; + case TDFX_TMU_SPLIT: + case TDFX_TMU_BOTH: + assert(!shared->umaTexMemory); + RemoveRange_NoLock(fxMesa, TDFX_TMU0, ti->tm[TDFX_TMU0]); + RemoveRange_NoLock(fxMesa, TDFX_TMU1, ti->tm[TDFX_TMU1]); + break; + default: + gl_problem(NULL, "tdfx driver: bad tmu in tdfxTMMOveOutTM()"); + return; + } + + ti->isInTM = GL_FALSE; + ti->tm[0] = NULL; + ti->tm[1] = NULL; + ti->whichTMU = TDFX_TMU_NONE; + + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ +} + + +/* + * Called via glDeleteTexture to delete a texture object. + */ +void +tdfxTMFreeTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) +{ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + if (ti) { + int i; + tdfxTMMoveOutTM(fxMesa, tObj); + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + if (ti->mipmapLevel[i].data) { + FREE(ti->mipmapLevel[i].data); + ti->mipmapLevel[i].data = NULL; + } + } + FREE(ti); + tObj->DriverData = NULL; + } + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ +} + + + +/* + * After a context switch this function will be called to restore + * texture memory for the new context. + */ +void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + struct gl_texture_object *tObj; + int i; + + for ( tObj = ctx->Shared->TexObjectList ; tObj ; tObj = tObj->Next ) { + tdfxTexInfo *ti = TDFX_TEXTURE_DATA( tObj ); + if ( ti && ti->isInTM ) { + for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) { + if ( ctx->Texture.Unit[i].Current == tObj ) { + tdfxTMDownloadTexture( fxMesa, tObj ); + break; + } + } + if ( i == MAX_TEXTURE_UNITS ) { + tdfxTMMoveOutTM_NoLock( fxMesa, tObj ); + } + } + } + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h new file mode 100644 index 000000000..1965aaa84 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h @@ -0,0 +1,84 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_TEXMAN_H__ +#define __TDFX_TEXMAN_H__ + + +#include "tdfx_lock.h" + + +extern void tdfxTMInit( tdfxContextPtr fxMesa ); + +extern void tdfxTMClose( tdfxContextPtr fxMesa ); + +extern void tdfxTMDownloadTexture(tdfxContextPtr fxMesa, + struct gl_texture_object *tObj); + +extern void tdfxTMReloadMipMapLevel( GLcontext *ctx, + struct gl_texture_object *tObj, + GLint level ); + +extern void tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj, + FxU32 targetTMU ); + +extern void tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ); + +extern void tdfxTMFreeTexture( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ); + +extern void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa ); + + +#define tdfxTMMoveInTM( fxMesa, tObj, targetTMU ) \ + do { \ + LOCK_HARDWARE( fxMesa ); \ + tdfxTMMoveInTM_NoLock( fxMesa, tObj, targetTMU ); \ + UNLOCK_HARDWARE( fxMesa ); \ + } while (0) + +#define tdfxTMMoveOutTM( fxMesa, tObj ) \ + do { \ + LOCK_HARDWARE( fxMesa ); \ + tdfxTMMoveOutTM_NoLock( fxMesa, tObj ); \ + UNLOCK_HARDWARE( fxMesa ); \ + } while (0) + + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c new file mode 100644 index 000000000..9a74cba03 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c @@ -0,0 +1,2096 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_state.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" +#include "tdfx_texstate.h" + + +/* ============================================================= + * Texture + */ + +/* + * These macros are used below when handling COMBINE_EXT. + */ +#define TEXENV_OPERAND_INVERTED(operand) \ + (((operand) == GL_ONE_MINUS_SRC_ALPHA) \ + || ((operand) == GL_ONE_MINUS_SRC_COLOR)) +#define TEXENV_OPERAND_ALPHA(operand) \ + (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA)) +#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \ + if (!TEXENV_OPERAND_ALPHA(operand)) { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_RGB; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CCOLOR; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITRGB; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedColor; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } else { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } + +#define TEXENV_SETUP_MODE_RGB(param, operand) \ + switch (operand) { \ + case GL_SRC_COLOR: \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + case GL_ONE_MINUS_SRC_COLOR: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_MODE_A(param, operand) \ + switch (operand) { \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + + + +/* + * Setup a texture environment on Voodoo5. + * Return GL_TRUE for success, GL_FALSE for failure. + * If we fail, we'll have to use software rendering. + */ +static GLboolean +SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA, + const struct gl_texture_unit *texUnit, GLenum baseFormat, + struct tdfx_texcombine_ext *env) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrTCCUColor_t incomingRGB, incomingAlpha; + const GLenum envMode = texUnit->EnvMode; + + if (useIteratedRGBA) { + incomingRGB = GR_CMBX_ITRGB; + incomingAlpha = GR_CMBX_ITALPHA; + } + else { + incomingRGB = GR_CMBX_OTHER_TEXTURE_RGB; + incomingAlpha = GR_CMBX_OTHER_TEXTURE_ALPHA; + } + + /* invariant: */ + env->Color.Shift = 0; + env->Color.Invert = FXFALSE; + env->Alpha.Shift = 0; + env->Alpha.Invert = FXFALSE; + + switch (envMode) { + case GL_REPLACE: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceA = incomingRGB; + } + else { + /* Rv = Rt */ + env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + } + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceD = incomingAlpha; + } + else { + /* Av = At */ + env->Alpha.SourceD = GR_CMBX_LOCAL_TEXTURE_ALPHA; + } + env->Alpha.SourceA = GR_CMBX_ITALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_ZERO; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXFALSE; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_MODULATE: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + } + else { + /* Result = Frag * Tex */ + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.InvertC = FXFALSE; + } + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + } + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_DECAL: + /* -- Setup RGB combiner */ + if (baseFormat == GL_RGB) { + /* Rv = Rt */ + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_X; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + } + else { + /* Rv = Rf * (1 - At) + Rt * At */ + env->Color.SourceB = incomingRGB; + env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Color.InvertC = FXFALSE; + env->Color.SourceD = GR_CMBX_B; + env->Color.InvertD = FXFALSE; + } + env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.ModeA = GR_FUNC_MODE_X; + /* -- Setup Alpha combiner */ + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_BLEND: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + } + else { + /* Rv = Rf * (1 - Rt) + Rc * Rt */ + env->Color.SourceA = GR_CMBX_TMU_CCOLOR; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = incomingRGB; + env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.InvertC = FXFALSE; + env->Color.SourceD = GR_CMBX_B; + env->Color.InvertD = FXFALSE; + } + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ZERO; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af * (1 - It) + Ac * It */ + env->Alpha.SourceA = GR_CMBX_TMU_CALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = incomingAlpha; + env->Alpha.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Alpha.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.InvertC = FXFALSE; + env->Alpha.SourceD = GR_CMBX_B; + env->Alpha.InvertD = FXFALSE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + } + /* Also have to set up the tex env constant color */ + env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F, + texUnit->EnvColor[1] * 255.0F, + texUnit->EnvColor[2] * 255.0F, + texUnit->EnvColor[3] * 255.0F); + break; + case GL_ADD: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + } + else { + /* Rv = Rf + Tt */ + env->Color.SourceB = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.ModeB = GR_FUNC_MODE_X; + } + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af + It */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceB = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_X; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + } + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_COMBINE_EXT: + { + FxU32 A_RGB, B_RGB, C_RGB, D_RGB; + FxU32 Amode_RGB, Bmode_RGB; + FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB; + FxU32 Shift_RGB; + FxU32 A_A, B_A, C_A, D_A; + FxU32 Amode_A, Bmode_A; + FxBool Cinv_A, Dinv_A, Ginv_A; + FxU32 Shift_A; + + /* + * + * In the formulas below, we write: + * o "1(x)" for the identity function applied to x, + * so 1(x) = x. + * o "0(x)" for the constant function 0, so + * 0(x) = 0 for all values of x. + * + * Calculate the color combination. + */ + Shift_RGB = texUnit->CombineScaleShiftRGB; + Shift_A = texUnit->CombineScaleShiftA; + switch (texUnit->CombineModeRGB) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_FUNC_MODE_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_RGB(C_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + Cinv_RGB = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1]); + D_RGB = GR_CMBX_ZERO; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Bmode_RGB, + texUnit->CombineOperandRGB[1]); + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X; + } + else { + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + } + } + else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + } + else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) { + /* + * This case is wrong. + */ + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + else { + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_RGB, + texUnit->CombineSourceRGB[2], + texUnit->CombineOperandRGB[2], + incomingAlpha); + Cinv_RGB = FXFALSE; + D_RGB = GR_CMBX_B; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the texture values + * to zero. + */ + A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X; + Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE; + break; + } + /* + * Calculate the alpha combination. + */ + switch (texUnit->CombineModeA) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ITALPHA; + Bmode_A = GR_FUNC_MODE_ZERO; + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ZERO; + Bmode_A = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + Cinv_A = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1]); + D_A = GR_CMBX_ZERO; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + TEXENV_SETUP_MODE_A(Bmode_A, + texUnit->CombineOperandA[0]); + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_A = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X; + } else { + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + } + } else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_A = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X_MINUS_HALF; + } else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + } + else { + /* + * This case is wrong. + */ + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[2], + texUnit->CombineOperandA[2], + incomingAlpha); + Cinv_A = FXFALSE; + D_A = GR_CMBX_ZERO; + Dinv_A = Ginv_A = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the alpha values + * to one. + */ + A_A = B_A = C_A = D_A = GR_CMBX_ZERO; + Amode_A = Bmode_A = GR_FUNC_MODE_X; + Cinv_A = Dinv_A = FXFALSE; + Ginv_A = FXTRUE; + break; + } + /* + * Save the parameters. + */ + env->Color.SourceA = A_RGB; + env->Color.ModeA = Amode_RGB; + env->Color.SourceB = B_RGB; + env->Color.ModeB = Bmode_RGB; + env->Color.SourceC = C_RGB; + env->Color.InvertC = Cinv_RGB; + env->Color.SourceD = D_RGB; + env->Color.InvertD = Dinv_RGB; + env->Color.Shift = Shift_RGB; + env->Color.Invert = Ginv_RGB; + env->Alpha.SourceA = A_A; + env->Alpha.ModeA = Amode_A; + env->Alpha.SourceB = B_A; + env->Alpha.ModeB = Bmode_A; + env->Alpha.SourceC = C_A; + env->Alpha.InvertC = Cinv_A; + env->Alpha.SourceD = D_A; + env->Alpha.InvertD = Dinv_A; + env->Alpha.Shift = Shift_A; + env->Alpha.Invert = Ginv_A; + env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F, + texUnit->EnvColor[1] * 255.0F, + texUnit->EnvColor[2] * 255.0F, + texUnit->EnvColor[3] * 255.0F); + } + break; + + default: + gl_problem(ctx, "Bad envMode in SetupTexEnvNapalm"); + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; + + fxMesa->ColorCombineExt.SourceA = GR_CMBX_TEXTURE_RGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X, + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_TEXTURE_ALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + return GL_TRUE; /* success */ +} + + + +/* + * Setup the Voodoo3 texture environment for a single texture unit. + * Return GL_TRUE for success, GL_FALSE for failure. + * If failure, we'll use software rendering. + */ +static GLboolean +SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit, + GLenum envMode, GLenum baseFormat) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCombineLocal_t localc, locala; + struct tdfx_combine alphaComb, colorComb; + + if (1 /*iteratedRGBA*/) + localc = locala = GR_COMBINE_LOCAL_ITERATED; + else + localc = locala = GR_COMBINE_LOCAL_CONSTANT; + + switch (envMode) { + case GL_DECAL: + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + colorComb.Function = GR_COMBINE_FUNCTION_BLEND; + colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + break; + case GL_MODULATE: + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_LOCAL; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + case GL_BLEND: + /* + * XXX we can't do real GL_BLEND mode. These settings assume that + * the TexEnv color is black and incoming fragment color is white. + */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af * (1 - It) + Ac * It */ + /* XXX this is wrong */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + /* Av = Af * At */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXTRUE; + } + /* XXX return GL_FALSE for modes we don't support */ + break; + + case GL_REPLACE: + if ((baseFormat == GL_RGB) || (baseFormat == GL_LUMINANCE)) { + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + case GL_ADD: + if (baseFormat == GL_ALPHA || + baseFormat == GL_LUMINANCE_ALPHA || + baseFormat == GL_RGBA) { + /* product of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + else if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* fragment alpha is unchanged */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + ASSERT(baseFormat == GL_INTENSITY); + /* sum of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + /* rgb unchanged */ + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + /* sum of texel and fragment rgb */ + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + default: + gl_problem(NULL, "bad texture env mode in SetupSingleTexEnvVoodoo3"); + } + + if (colorComb.Function != fxMesa->ColorCombine.Function || + colorComb.Factor != fxMesa->ColorCombine.Factor || + colorComb.Local != fxMesa->ColorCombine.Local || + colorComb.Other != fxMesa->ColorCombine.Other || + colorComb.Invert != fxMesa->ColorCombine.Invert) { + fxMesa->ColorCombine = colorComb; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + } + + if (alphaComb.Function != fxMesa->AlphaCombine.Function || + alphaComb.Factor != fxMesa->AlphaCombine.Factor || + alphaComb.Local != fxMesa->AlphaCombine.Local || + alphaComb.Other != fxMesa->AlphaCombine.Other || + alphaComb.Invert != fxMesa->AlphaCombine.Invert) { + fxMesa->AlphaCombine = alphaComb; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + } + return GL_TRUE; +} + + +/* + * Setup the Voodoo3 texture environment for dual texture units. + * Return GL_TRUE for success, GL_FALSE for failure. + * If failure, we'll use software rendering. + */ +static GLboolean +SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0, + GLenum envMode0, GLenum baseFormat0, + GLenum envMode1, GLenum baseFormat1) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GrCombineLocal_t locala = GR_COMBINE_LOCAL_ITERATED; + const GrCombineLocal_t localc = GR_COMBINE_LOCAL_ITERATED; + const int tmu1 = 1 - tmu0; + + if (envMode0 == GL_MODULATE && envMode1 == GL_MODULATE) { + GLboolean isalpha[TDFX_NUM_TMU]; + + if (baseFormat0 == GL_ALPHA) + isalpha[tmu0] = GL_TRUE; + else + isalpha[tmu0] = GL_FALSE; + + if (baseFormat1 == GL_ALPHA) + isalpha[tmu1] = GL_TRUE; + else + isalpha[tmu1] = GL_FALSE; + + if (isalpha[TDFX_TMU1]) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + if (isalpha[TDFX_TMU0]) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else if (envMode0 == GL_REPLACE && envMode1 == GL_BLEND) { /* Quake */ + if (tmu1 == TDFX_TMU1) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else if (envMode0 == GL_REPLACE && envMode1 == GL_MODULATE) { + /* Quake 2/3 */ + if (tmu1 == TDFX_TMU1) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXTRUE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + if (baseFormat0 == GL_RGB) { + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else { + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + } + else if (envMode0 == GL_MODULATE && envMode1 == GL_ADD) { + /* Quake 3 sky */ + GLboolean isalpha[TDFX_NUM_TMU]; + if (baseFormat0 == GL_ALPHA) + isalpha[tmu0] = GL_TRUE; + else + isalpha[tmu0] = GL_FALSE; + if (baseFormat1 == GL_ALPHA) + isalpha[tmu1] = GL_TRUE; + else + isalpha[tmu1] = GL_FALSE; + + if (isalpha[TDFX_TMU1]) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + if (isalpha[TDFX_TMU0]) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else { + /*gl_problem(ctx, "Unexpected dual texture mode encountered\n");*/ + return GL_FALSE; + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + return GL_TRUE; +} + + +/* + * This function makes sure that the correct mipmap levels are loaded + * in the right places in memory and then makes the Glide calls to + * setup the texture source pointers. + */ +static void +setupSingleTMU(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) +{ + struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData; + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + const GLcontext *ctx = fxMesa->glCtx; + + /* Make sure we're not loaded incorrectly */ + if (ti->isInTM && !shared->umaTexMemory) { + /* if doing filtering between mipmap levels, alternate mipmap levels + * must be in alternate TMUs. + */ + if (ti->LODblend) { + if (ti->whichTMU != TDFX_TMU_SPLIT) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj); + } + else { + if (ti->whichTMU == TDFX_TMU_SPLIT) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj); + } + } + + /* Make sure we're loaded correctly */ + if (!ti->isInTM) { + /* Have to download the texture */ + if (shared->umaTexMemory) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0); + } + else { + /* Voodoo3 (split texture memory) */ + if (ti->LODblend) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU_SPLIT); + } + else { +#if 0 + /* XXX putting textures into the second memory bank when the + * first bank is full is not working at this time. + */ + if (fxMesa->haveTwoTMUs) { + GLint memReq = FX_grTexTextureMemRequired_NoLock( + GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); + if (shared->freeTexMem[TDFX_TMU0] > memReq) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0); + } + else { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU1); + } + } + else +#endif + { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0); + } + } + } + } + + if (ti->LODblend && ti->whichTMU == TDFX_TMU_SPLIT) { + /* mipmap levels split between texture banks */ + GLint u; + + if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + + for (u = 0; u < 2; u++) { + fxMesa->TexParams[u].sClamp = ti->sClamp; + fxMesa->TexParams[u].tClamp = ti->tClamp; + fxMesa->TexParams[u].minFilt = ti->minFilt; + fxMesa->TexParams[u].magFilt = ti->magFilt; + fxMesa->TexParams[u].mmMode = ti->mmMode; + fxMesa->TexParams[u].LODblend = ti->LODblend; + fxMesa->TexParams[u].LodBias = ctx->Texture.Unit[u].LodBias; + } + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + + fxMesa->TexSource[0].StartAddress = ti->tm[TDFX_TMU0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD; + fxMesa->TexSource[0].Info = &(ti->info); + fxMesa->TexSource[1].StartAddress = ti->tm[TDFX_TMU1]->startAddr; + fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[1].Info = &(ti->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + } + else { + FxU32 tmu; + + if (ti->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = ti->whichTMU; + + if (shared->umaTexMemory) { + assert(ti->whichTMU == TDFX_TMU0); + assert(tmu == TDFX_TMU0); + } + + if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + + /* KW: The alternative is to do the download to the other tmu. If + * we get to this point, I think it means we are thrashing the + * texture memory, so perhaps it's not a good idea. + */ + + if (fxMesa->TexParams[tmu].sClamp != ti->sClamp || + fxMesa->TexParams[tmu].tClamp != ti->tClamp || + fxMesa->TexParams[tmu].minFilt != ti->minFilt || + fxMesa->TexParams[tmu].magFilt != ti->magFilt || + fxMesa->TexParams[tmu].mmMode != ti->mmMode || + fxMesa->TexParams[tmu].LODblend != FXFALSE || + fxMesa->TexParams[tmu].LodBias != ctx->Texture.Unit[tmu].LodBias) { + fxMesa->TexParams[tmu].sClamp = ti->sClamp; + fxMesa->TexParams[tmu].tClamp = ti->tClamp; + fxMesa->TexParams[tmu].minFilt = ti->minFilt; + fxMesa->TexParams[tmu].magFilt = ti->magFilt; + fxMesa->TexParams[tmu].mmMode = ti->mmMode; + fxMesa->TexParams[tmu].LODblend = FXFALSE; + fxMesa->TexParams[tmu].LodBias = ctx->Texture.Unit[tmu].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + /* Glide texture source info */ + fxMesa->TexSource[0].Info = NULL; + fxMesa->TexSource[1].Info = NULL; + if (ti->tm[tmu]) { + fxMesa->TexSource[tmu].StartAddress = ti->tm[tmu]->startAddr; + fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu].Info = &(ti->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + } + } + + fxMesa->sScale0 = ti->sScale; + fxMesa->tScale0 = ti->tScale; +} + +static void +selectSingleTMUSrc(tdfxContextPtr fxMesa, GLint tmu, FxBool LODblend) +{ + if (LODblend) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + + if (fxMesa->haveTwoTMUs) { + const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + int tmu; + + if (shared->umaTexMemory) + tmu = GR_TMU0; + else + tmu = GR_TMU1; + + fxMesa->TexCombine[tmu].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[tmu].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[tmu].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[tmu].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[tmu].InvertRGB = FXFALSE; + fxMesa->TexCombine[tmu].InvertAlpha = FXFALSE; + } + fxMesa->tmuSrc = TDFX_TMU_SPLIT; + } + else { + if (tmu != TDFX_TMU1) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + if (fxMesa->haveTwoTMUs) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + fxMesa->tmuSrc = TDFX_TMU0; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */ + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + fxMesa->tmuSrc = TDFX_TMU1; + } + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; +} + +static void print_state(tdfxContextPtr fxMesa) +{ + GLcontext *ctx = fxMesa->glCtx; + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + GLenum base0 = tObj0->Image[tObj0->BaseLevel] ? tObj0->Image[tObj0->BaseLevel]->Format : 99; + GLenum base1 = tObj1->Image[tObj1->BaseLevel] ? tObj1->Image[tObj1->BaseLevel]->Format : 99; + + printf("Unit 0: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[0].ReallyEnabled, + fxMesa->TexState.Enabled); + printf(" EnvMode: GL=0x%x Gr=0x%x\n", ctx->Texture.Unit[0].EnvMode, + fxMesa->TexState.EnvMode[0]); + printf(" BaseFmt: GL=0x%x Gr=0x%x\n", base0, fxMesa->TexState.TexFormat[0]); + + + printf("Unit 1: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[1].ReallyEnabled, + fxMesa->TexState.Enabled); + printf(" EnvMode: GL=0x%x Gr:0x%x\n", ctx->Texture.Unit[1].EnvMode, + fxMesa->TexState.EnvMode[1]); + printf(" BaseFmt: GL=0x%x Gr:0x%x\n", base1, fxMesa->TexState.TexFormat[1]); +} + + +/* + * When we're only using a single texture unit, we always use the 0th + * Glide/hardware unit, regardless if it's GL_TEXTURE0_ARB or GL_TEXTURE1_ARB + * that's enalbed. + * Input: ctx - the context + * unit - the OpenGL texture unit to use. + */ +static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; + struct gl_texture_object *tObj; + int tmu; + GLenum envMode, baseFormat; + + tObj = ctx->Texture.Unit[unit].CurrentD[2]; + if (tObj->Image[tObj->BaseLevel]->Border > 0) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_BORDER; + return; + } + + setupSingleTMU(fxMesa, tObj); + + ti = TDFX_TEXTURE_DATA(tObj); + if (ti->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = ti->whichTMU; + + if (fxMesa->tmuSrc != tmu) { + selectSingleTMUSrc(fxMesa, tmu, ti->LODblend); + } + + if (ti->reloadImages) + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES; + + /* Some texture environments not supported */ + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE_ENV; + + /* Check if we really need to update the texenv state */ + envMode = ctx->Texture.Unit[unit].EnvMode; + baseFormat = tObj->Image[tObj->BaseLevel]->Format; + + if (TDFX_IS_NAPALM(fxMesa)) { + /* see if we really need to update the unit */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode != fxMesa->TexState.EnvMode[0] || + envMode == GL_COMBINE_EXT || + baseFormat != fxMesa->TexState.TexFormat[0]) { + struct tdfx_texcombine_ext *otherEnv; + if (!SetupTexEnvNapalm(ctx, GL_TRUE, + &ctx->Texture.Unit[unit], baseFormat, + &fxMesa->TexCombineExt[0])) { + /* software fallback */ + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + /* disable other unit */ + otherEnv = &fxMesa->TexCombineExt[1]; + otherEnv->Color.SourceA = GR_CMBX_ZERO; + otherEnv->Color.ModeA = GR_FUNC_MODE_ZERO; + otherEnv->Color.SourceB = GR_CMBX_ZERO; + otherEnv->Color.ModeB = GR_FUNC_MODE_ZERO; + otherEnv->Color.SourceC = GR_CMBX_ZERO; + otherEnv->Color.InvertC = FXFALSE; + otherEnv->Color.SourceD = GR_CMBX_ZERO; + otherEnv->Color.InvertD = FXFALSE; + otherEnv->Color.Shift = 0; + otherEnv->Color.Invert = FXFALSE; + otherEnv->Alpha.SourceA = GR_CMBX_ITALPHA; + otherEnv->Alpha.ModeA = GR_FUNC_MODE_ZERO; + otherEnv->Alpha.SourceB = GR_CMBX_ITALPHA; + otherEnv->Alpha.ModeB = GR_FUNC_MODE_ZERO; + otherEnv->Alpha.SourceC = GR_CMBX_ZERO; + otherEnv->Alpha.InvertC = FXFALSE; + otherEnv->Alpha.SourceD = GR_CMBX_ZERO; + otherEnv->Alpha.InvertD = FXFALSE; + otherEnv->Alpha.Shift = 0; + otherEnv->Alpha.Invert = FXFALSE; + + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + fxMesa->TexState.EnvMode[0] = envMode; + fxMesa->TexState.TexFormat[0] = baseFormat; + fxMesa->TexState.EnvMode[1] = 0; + fxMesa->TexState.TexFormat[1] = 0; + } + } + else { + /* Voodoo3 */ + + /* see if we really need to update the unit */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode != fxMesa->TexState.EnvMode[0] || + envMode == GL_COMBINE_EXT || + baseFormat != fxMesa->TexState.TexFormat[0]) { + if (!SetupSingleTexEnvVoodoo3(ctx, tmu, envMode, baseFormat)) { + /* software fallback */ + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + fxMesa->TexState.EnvMode[0] = envMode; + fxMesa->TexState.TexFormat[0] = baseFormat; + fxMesa->TexState.EnvMode[1] = 0; + fxMesa->TexState.TexFormat[1] = 0; + } + } +} + + +static void +setupDoubleTMU(tdfxContextPtr fxMesa, + struct gl_texture_object *tObj0, + struct gl_texture_object *tObj1) +{ +#define T0_NOT_IN_TMU 0x01 +#define T1_NOT_IN_TMU 0x02 +#define T0_IN_TMU0 0x04 +#define T1_IN_TMU0 0x08 +#define T0_IN_TMU1 0x10 +#define T1_IN_TMU1 0x20 + + const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + const GLcontext *ctx = fxMesa->glCtx; + tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); + GLuint tstate = 0; + int tmu0 = 0, tmu1 = 1; + + if (shared->umaTexMemory) { + if (!ti0->isInTM) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0); + assert(ti0->isInTM); + } + if (!ti1->isInTM) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0); + assert(ti1->isInTM); + } + } + else { + /* We shouldn't need to do this. There is something wrong with + multitexturing when the TMUs are swapped. So, we're forcing + them to always be loaded correctly. !!! */ + if (ti0->whichTMU == TDFX_TMU1) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj0); + if (ti1->whichTMU == TDFX_TMU0) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj1); + + if (ti0->isInTM) { + switch (ti0->whichTMU) { + case TDFX_TMU0: + tstate |= T0_IN_TMU0; + break; + case TDFX_TMU1: + tstate |= T0_IN_TMU1; + break; + case TDFX_TMU_BOTH: + tstate |= T0_IN_TMU0 | T0_IN_TMU1; + break; + case TDFX_TMU_SPLIT: + tstate |= T0_NOT_IN_TMU; + break; + } + } + else + tstate |= T0_NOT_IN_TMU; + + if (ti1->isInTM) { + switch (ti1->whichTMU) { + case TDFX_TMU0: + tstate |= T1_IN_TMU0; + break; + case TDFX_TMU1: + tstate |= T1_IN_TMU1; + break; + case TDFX_TMU_BOTH: + tstate |= T1_IN_TMU0 | T1_IN_TMU1; + break; + case TDFX_TMU_SPLIT: + tstate |= T1_NOT_IN_TMU; + break; + } + } + else + tstate |= T1_NOT_IN_TMU; + + /* Move texture maps into TMUs */ + + if (!(((tstate & T0_IN_TMU0) && (tstate & T1_IN_TMU1)) || + ((tstate & T0_IN_TMU1) && (tstate & T1_IN_TMU0)))) { + if (tObj0 == tObj1) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU_BOTH); + } + else { + /* Find the minimal way to correct the situation */ + if ((tstate & T0_IN_TMU0) || (tstate & T1_IN_TMU1)) { + /* We have one in the standard order, setup the other */ + if (tstate & T0_IN_TMU0) { + /* T0 is in TMU0, put T1 in TMU1 */ + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1); + } + else { + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0); + } + /* tmu0 and tmu1 are setup */ + } + else if ((tstate & T0_IN_TMU1) || (tstate & T1_IN_TMU0)) { + /* we have one in the reverse order, setup the other */ + if (tstate & T1_IN_TMU0) { + /* T1 is in TMU0, put T0 in TMU1 */ + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU1); + } + else { + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0); + } + tmu0 = 1; + tmu1 = 0; + } + else { /* Nothing is loaded */ + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0); + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1); + /* tmu0 and tmu1 are setup */ + } + } + } + } + + ti0->lastTimeUsed = fxMesa->texBindNumber; + ti1->lastTimeUsed = fxMesa->texBindNumber; + + + if (!ctx->Texture.SharedPalette) { + if (ti0->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti0->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else if (ti1->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti1->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else { + fxMesa->TexPalette.Data = NULL; + } + } + + /* + * Setup Unit 0 + */ + assert(ti0->isInTM); + assert(ti0->tm[tmu0]); + fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &(ti0->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + + if (fxMesa->TexParams[tmu0].sClamp != ti0->sClamp || + fxMesa->TexParams[tmu0].tClamp != ti0->tClamp || + fxMesa->TexParams[tmu0].minFilt != ti0->minFilt || + fxMesa->TexParams[tmu0].magFilt != ti0->magFilt || + fxMesa->TexParams[tmu0].mmMode != ti0->mmMode || + fxMesa->TexParams[tmu0].LODblend != FXFALSE || + fxMesa->TexParams[tmu0].LodBias != ctx->Texture.Unit[tmu0].LodBias) { + fxMesa->TexParams[tmu0].sClamp = ti0->sClamp; + fxMesa->TexParams[tmu0].tClamp = ti0->tClamp; + fxMesa->TexParams[tmu0].minFilt = ti0->minFilt; + fxMesa->TexParams[tmu0].magFilt = ti0->magFilt; + fxMesa->TexParams[tmu0].mmMode = ti0->mmMode; + fxMesa->TexParams[tmu0].LODblend = FXFALSE; + fxMesa->TexParams[tmu0].LodBias = ctx->Texture.Unit[tmu0].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + /* + * Setup Unit 1 + */ + if (shared->umaTexMemory) { + ASSERT(ti1->isInTM); + ASSERT(ti1->tm[0]); + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + else { + ASSERT(ti1->isInTM); + ASSERT(ti1->tm[tmu1]); + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + + if (fxMesa->TexParams[tmu1].sClamp != ti1->sClamp || + fxMesa->TexParams[tmu1].tClamp != ti1->tClamp || + fxMesa->TexParams[tmu1].minFilt != ti1->minFilt || + fxMesa->TexParams[tmu1].magFilt != ti1->magFilt || + fxMesa->TexParams[tmu1].mmMode != ti1->mmMode || + fxMesa->TexParams[tmu1].LODblend != FXFALSE || + fxMesa->TexParams[tmu1].LodBias != ctx->Texture.Unit[tmu1].LodBias) { + fxMesa->TexParams[tmu1].sClamp = ti1->sClamp; + fxMesa->TexParams[tmu1].tClamp = ti1->tClamp; + fxMesa->TexParams[tmu1].minFilt = ti1->minFilt; + fxMesa->TexParams[tmu1].magFilt = ti1->magFilt; + fxMesa->TexParams[tmu1].mmMode = ti1->mmMode; + fxMesa->TexParams[tmu1].LODblend = FXFALSE; + fxMesa->TexParams[tmu1].LodBias = ctx->Texture.Unit[tmu1].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + fxMesa->sScale0 = ti0->sScale; + fxMesa->tScale0 = ti0->tScale; + fxMesa->sScale1 = ti1->sScale; + fxMesa->tScale1 = ti1->tScale; + +#undef T0_NOT_IN_TMU +#undef T1_NOT_IN_TMU +#undef T0_IN_TMU0 +#undef T1_IN_TMU0 +#undef T0_IN_TMU1 +#undef T1_IN_TMU1 +} + +static void setupTextureDoubleTMU(GLcontext * ctx) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); + struct gl_texture_image *baseImage0 = tObj0->Image[tObj0->BaseLevel]; + struct gl_texture_image *baseImage1 = tObj1->Image[tObj1->BaseLevel]; + const GLenum envMode0 = ctx->Texture.Unit[0].EnvMode; + const GLenum envMode1 = ctx->Texture.Unit[1].EnvMode; + + if (baseImage0->Border > 0 || baseImage1->Border >0) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_BORDER; + return; + } + + setupDoubleTMU(fxMesa, tObj0, tObj1); + + if (ti0->reloadImages || ti1->reloadImages) + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES; + + fxMesa->tmuSrc = TDFX_TMU_BOTH; + + /* Some texture environments not supported */ + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE_ENV; + + if (TDFX_IS_NAPALM(fxMesa)) { + /* Remember, Glide has its texture units numbered in backward + * order compared to OpenGL. + */ + GLboolean hw1 = GL_TRUE, hw2 = GL_TRUE; + + /* check if we really need to update glide unit 1 */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode0 != fxMesa->TexState.EnvMode[1] || + envMode0 == GL_COMBINE_EXT || + baseImage0->Format != fxMesa->TexState.TexFormat[1] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + hw1 = SetupTexEnvNapalm(ctx, GL_TRUE, &ctx->Texture.Unit[0], + baseImage0->Format, &fxMesa->TexCombineExt[1]); + fxMesa->TexState.EnvMode[1] = envMode0; + fxMesa->TexState.TexFormat[1] = baseImage0->Format; + } + + /* check if we really need to update glide unit 0 */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode1 != fxMesa->TexState.EnvMode[0] || + envMode1 == GL_COMBINE_EXT || + baseImage1->Format != fxMesa->TexState.TexFormat[0] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + hw2 = SetupTexEnvNapalm(ctx, GL_FALSE, &ctx->Texture.Unit[1], + baseImage1->Format, &fxMesa->TexCombineExt[0]); + fxMesa->TexState.EnvMode[0] = envMode1; + fxMesa->TexState.TexFormat[0] = baseImage1->Format; + } + + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + + if (!hw1 || !hw2) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + } + else { + int unit0, unit1; + if ((ti0->whichTMU == TDFX_TMU1) || (ti1->whichTMU == TDFX_TMU0)) + unit0 = 1; + else + unit0 = 0; + unit1 = 1 - unit0; + + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode0 != fxMesa->TexState.EnvMode[unit0] || + envMode0 == GL_COMBINE_EXT || + envMode1 != fxMesa->TexState.EnvMode[unit1] || + envMode1 == GL_COMBINE_EXT || + baseImage0->Format != fxMesa->TexState.TexFormat[unit0] || + baseImage1->Format != fxMesa->TexState.TexFormat[unit1] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + + if (!SetupDoubleTexEnvVoodoo3(ctx, unit0, + ctx->Texture.Unit[0].EnvMode, baseImage0->Format, + ctx->Texture.Unit[1].EnvMode, baseImage1->Format)) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + + fxMesa->TexState.EnvMode[unit0] = envMode0; + fxMesa->TexState.TexFormat[unit0] = baseImage0->Format; + fxMesa->TexState.EnvMode[unit1] = envMode1; + fxMesa->TexState.TexFormat[unit1] = baseImage1->Format; + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + } + } +} + + +void +tdfxUpdateTextureState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLuint tex2Denabled = ctx->Texture.ReallyEnabled; + + if (!fxMesa->haveTwoTMUs) + tex2Denabled &= TEXTURE0_2D; + + switch (tex2Denabled) { + case TEXTURE0_2D: + LOCK_HARDWARE( fxMesa ); /* XXX remove locking eventually */ + setupTextureSingleTMU(ctx, 0); + UNLOCK_HARDWARE( fxMesa ); + break; + case TEXTURE1_2D: + LOCK_HARDWARE( fxMesa ); + setupTextureSingleTMU(ctx, 1); + UNLOCK_HARDWARE( fxMesa ); + break; + case (TEXTURE0_2D | TEXTURE1_2D): + LOCK_HARDWARE( fxMesa ); + setupTextureDoubleTMU(ctx); + UNLOCK_HARDWARE( fxMesa ); + break; + default: + /* disable hardware texturing */ + if (TDFX_IS_NAPALM(fxMesa)) { + fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + } + else { + /* Voodoo 3*/ + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + + fxMesa->TexState.Enabled = 0; + fxMesa->TexState.EnvMode[0] = 0; + fxMesa->TexState.EnvMode[1] = 0; + + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + } +} + + + +/* + * This is a special case of texture state update. + * It's used when we've simply bound a new texture to a texture + * unit and the new texture has the exact same attributes as the + * previously bound texture. + * This is very common in Quake3. + */ +void +tdfxUpdateTextureBinding( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); + + const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + + if (ti0) { + fxMesa->sScale0 = ti0->sScale; + fxMesa->tScale0 = ti0->tScale; + if (ti0->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti0->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else if (ti1 && ti1->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti1->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + } + if (ti1) { + fxMesa->sScale1 = ti1->sScale; + fxMesa->tScale1 = ti1->tScale; + } + + if (ctx->Texture.ReallyEnabled == TEXTURE0_2D) { + if (shared->umaTexMemory) { + fxMesa->TexSource[0].StartAddress = ti0->tm[0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[0].Info = &(ti0->info); + } + else { + if (ti0->LODblend && ti0->whichTMU == TDFX_TMU_SPLIT) { + fxMesa->TexSource[0].StartAddress = ti0->tm[TDFX_TMU0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD; + fxMesa->TexSource[0].Info = &(ti0->info); + fxMesa->TexSource[1].StartAddress = ti0->tm[TDFX_TMU1]->startAddr; + fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[1].Info = &(ti0->info); + } + else { + FxU32 tmu; + if (ti0->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = ti0->whichTMU; + fxMesa->TexSource[0].Info = NULL; + fxMesa->TexSource[1].Info = NULL; + if (ti0->tm[tmu]) { + fxMesa->TexSource[tmu].StartAddress = ti0->tm[tmu]->startAddr; + fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu].Info = &(ti0->info); + } + } + } + } + else if (ctx->Texture.ReallyEnabled == TEXTURE1_2D) { + if (shared->umaTexMemory) { + fxMesa->TexSource[0].StartAddress = ti1->tm[0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[0].Info = &(ti1->info); + } + } + else if (ctx->Texture.ReallyEnabled == (TEXTURE0_2D | TEXTURE1_2D)) { + if (shared->umaTexMemory) { + const FxU32 tmu0 = 0, tmu1 = 1; + fxMesa->TexSource[tmu0].StartAddress = ti0->tm[0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &(ti0->info); + + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + else { + const FxU32 tmu0 = 0, tmu1 = 1; + fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &(ti0->info); + + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + } + + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h new file mode 100644 index 000000000..0c0d4adcb --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h @@ -0,0 +1,44 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_TEXSTATE_H__ +#define __TDFX_TEXSTATE_H__ + +extern void tdfxUpdateTextureState( GLcontext *ctx ); +extern void tdfxUpdateTextureBinding( GLcontext *ctx ); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c new file mode 100644 index 000000000..21f7cdad3 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c @@ -0,0 +1,508 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_tris.h" + +#include "pipeline.h" +#include "vbindirect.h" + +static struct { + points_func points; + line_func line; + triangle_func triangle; + quad_func quad; + render_func *render_tab; +} rast_tab[TDFX_MAX_TRIFUNC]; + +#define TDFX_COLOR( to, from ) \ + do { \ + (to)[0] = (from)[2]; \ + (to)[1] = (from)[1]; \ + (to)[2] = (from)[0]; \ + (to)[3] = (from)[3]; \ + } while (0) + + +static void tdfxPrintRenderState( const char *msg, GLuint state ) +{ + fprintf( stderr, "%s: (0x%x) %s%s%s%s\n", + msg, state, + (state & TDFX_FLAT_BIT) ? "flat, " : "", + (state & TDFX_OFFSET_BIT) ? "offset, " : "", + (state & TDFX_TWOSIDE_BIT) ? "twoside, " : "", + (state & TDFX_CLIPRECT_BIT) ? "cliprects, " : ""); +} + + +#define IND (0) +#define TAG(x) x +#include "tdfx_tritmp.h" + +#define IND (TDFX_FLAT_BIT) +#define TAG(x) x##_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT) +#define TAG(x) x##_offset +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_offset_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT) +#define TAG(x) x##_twoside +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_twoside_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT) +#define TAG(x) x##_twoside_offset +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_twoside_offset_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_CLIPRECT_BIT) +#define TAG(x) x##_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_offset_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_offset_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_offset_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_offset_flat_cliprect +#include "tdfx_tritmp.h" + +static void tdfx_render_vb_points( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* Adjust point coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += PNT_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_POINTS, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore point coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= PNT_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_line_strip( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* adjust line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_lines( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* adjust line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_LINES, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_triangles( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLES, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +static void tdfx_render_vb_tri_strip( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +static void tdfx_render_vb_tri_fan( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start, fxVB+start, + sizeof(*fxVB) ); + (void) parity; +} + + +static void tdfx_render_vb_poly( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_POLYGON, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +#define RENDER_POINTS( start, count ) \ +do { \ + int i; \ + for (i = start ; i < count ; i++) { \ + v[elt[i]].v.x += PNT_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i]].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; \ + grDrawPoint(&v[elt[i]]); \ + v[elt[i]].v.x -= PNT_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i]].v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; \ + } \ +} while (0) + +#define RENDER_LINE( i0, i1 ) \ +do { \ + v[elt[i0]].v.x += LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i0]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \ + v[elt[i1]].v.x += LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i1]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \ + grDrawLine( &v[elt[i0]], &v[elt[i1]] ); \ + v[elt[i0]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i0]].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \ + v[elt[i1]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i1]].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + if (parity) grDrawTriangle( &v[elt[i1]], &v[elt[i2]], &v[elt[i]] ); \ + else grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + grDrawTriangle( &v[elt[i3]], &v[elt[i2]], &v[elt[i]] ); \ + grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \ +} while (0) + + +#define LOCAL_VARS \ + GLcontext *ctx = VB->ctx; \ + const GLuint *elt = VB->EltPtr->data; \ + tdfxVertexPtr v = TDFX_DRIVER_DATA(VB)->verts; \ + (void) v; (void) ctx; + +#define TAG(x) tdfx_##x##_elts +#include "render_tmp.h" + + +static void tdfxDDRenderEltsRaw( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + struct vertex_buffer *OldVB = ctx->VB; + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_elts[prim]; + GLuint p = 0; + + ctx->VB = VB; + ctx->Driver.RenderStart( ctx ); + + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + END_CLIP_LOOP_LOCKED( fxMesa ); + + ctx->Driver.RenderFinish( ctx ); + ctx->VB = OldVB; +} + + +void tdfxDDTriangleFuncsInit( void ) +{ + init(); + init_flat(); + init_offset(); + init_offset_flat(); + init_twoside(); + init_twoside_flat(); + init_twoside_offset(); + init_twoside_offset_flat(); + + init_cliprect(); + init_flat_cliprect(); + init_offset_cliprect(); + init_offset_flat_cliprect(); + init_twoside_cliprect(); + init_twoside_flat_cliprect(); + init_twoside_offset_cliprect(); + init_twoside_offset_flat_cliprect(); + + rast_tab[0].render_tab[GL_POINTS] = tdfx_render_vb_points; + rast_tab[0].render_tab[GL_LINE_STRIP] = tdfx_render_vb_line_strip; + rast_tab[0].render_tab[GL_LINES] = tdfx_render_vb_lines; + rast_tab[0].render_tab[GL_TRIANGLES] = tdfx_render_vb_triangles; + rast_tab[0].render_tab[GL_TRIANGLE_STRIP] = tdfx_render_vb_tri_strip; + rast_tab[0].render_tab[GL_TRIANGLE_FAN] = tdfx_render_vb_tri_fan; + rast_tab[0].render_tab[GL_POLYGON] = tdfx_render_vb_poly; + + tdfx_render_init_elts(); +} + + +#define ALL_FALLBACK (DD_SELECT | DD_FEEDBACK) +#define POINT_FALLBACK (ALL_FALLBACK | DD_POINT_SMOOTH | DD_POINT_ATTEN) +#define LINE_FALLBACK (ALL_FALLBACK | DD_LINE_STIPPLE) +#define TRI_FALLBACK (ALL_FALLBACK | DD_TRI_SMOOTH | DD_TRI_UNFILLED) +#define ANY_FALLBACK (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK | DD_TRI_STIPPLE | DD_LINE_SMOOTH | DD_LINE_WIDTH | DD_POINT_SIZE ) +#define ANY_RENDER_FLAGS (DD_FLATSHADE | DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET) + +/* Setup the Point, Line, Triangle and Quad functions based on the + * current rendering state. Wherever possible, use the hardware to + * render the primitive. Otherwise, fallback to software rendering. + */ +void tdfxDDChooseRenderState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GLuint flags = ctx->TriangleCaps; + CARD32 index = 0; + fxMesa->RenderElementsRaw = tdfxDDRenderEltsRaw; + + if ( fxMesa->Fallback ) { + fxMesa->RenderElementsRaw = gl_render_elts; + fxMesa->RenderIndex = TDFX_FALLBACK_BIT; + return; + } + + if ( flags & ANY_RENDER_FLAGS ) { + if ( flags & DD_FLATSHADE ) index |= TDFX_FLAT_BIT; + if ( flags & DD_TRI_LIGHT_TWOSIDE ) index |= TDFX_TWOSIDE_BIT; + if ( flags & DD_TRI_OFFSET ) index |= TDFX_OFFSET_BIT; + fxMesa->RenderElementsRaw = gl_render_elts; + } + + if ( fxMesa->numClipRects > 1 ) + index |= TDFX_CLIPRECT_BIT; + + fxMesa->PointsFunc = rast_tab[index].points; + fxMesa->LineFunc = rast_tab[index].line; + fxMesa->TriangleFunc = rast_tab[index].triangle; + fxMesa->QuadFunc = rast_tab[index].quad; + fxMesa->RenderVBRawTab = rast_tab[index].render_tab; + fxMesa->RenderIndex = index; + fxMesa->IndirectTriangles = 0; + + if ( flags & ANY_FALLBACK ) { + if ( flags & POINT_FALLBACK ) { + fxMesa->PointsFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= DD_POINT_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if ( flags & LINE_FALLBACK ) { + fxMesa->LineFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= DD_LINE_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if ( flags & TRI_FALLBACK ) { + fxMesa->TriangleFunc = 0; + fxMesa->QuadFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | + DD_QUAD_SW_RASTERIZE); + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + /* Special case: wide, AA lines must be done in software */ + if (flags & DD_LINE_SMOOTH) { + if (ctx->Line.Width != 1.0) { + fxMesa->RenderVBRawTab = 0; + fxMesa->LineFunc = 0; + fxMesa->IndirectTriangles |= DD_LINE_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + } + + /* Special case: we can do polygon stipples, but otherwise */ + if ((flags & DD_TRI_STIPPLE) && + (ctx->IndirectTriangles & DD_TRI_STIPPLE)) { + fxMesa->TriangleFunc = 0; + fxMesa->QuadFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | + DD_QUAD_SW_RASTERIZE); + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if (flags & (DD_LINE_WIDTH | DD_POINT_SIZE)) + fxMesa->RenderVBRawTab = 0; + + fxMesa->RenderElementsRaw = gl_render_elts; + } + + + if ( 0 ) { + gl_print_tri_caps( "tricaps", ctx->TriangleCaps ); + tdfxPrintRenderState( "tdfx render state", fxMesa->RenderIndex ); + } +} + + +void tdfxDDToggleTriCliprects( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + int oldidx = fxMesa->RenderIndex; + int newidx; + + if (fxMesa->Fallback) + return; + + if (fxMesa->numClipRects > 1) + newidx = (fxMesa->RenderIndex |= TDFX_CLIPRECT_BIT); + else + newidx = (fxMesa->RenderIndex &= ~TDFX_CLIPRECT_BIT); + + if (ctx->Driver.TriangleFunc == rast_tab[oldidx].triangle) + ctx->Driver.TriangleFunc = rast_tab[newidx].triangle; + + if (ctx->Driver.QuadFunc == rast_tab[oldidx].quad) + ctx->Driver.QuadFunc = rast_tab[newidx].quad; + + if (ctx->Driver.LineFunc == rast_tab[oldidx].line) + ctx->Driver.LineFunc = rast_tab[newidx].line; + + if (ctx->Driver.PointsFunc == rast_tab[oldidx].points) + ctx->Driver.PointsFunc = rast_tab[newidx].points; + + if (ctx->Driver.RenderVBRawTab == rast_tab[oldidx].render_tab) + ctx->Driver.RenderVBRawTab = rast_tab[newidx].render_tab; + + if (ctx->TriangleFunc == rast_tab[oldidx].triangle) + ctx->TriangleFunc = rast_tab[newidx].triangle; + + if (ctx->QuadFunc == rast_tab[oldidx].quad) + ctx->QuadFunc = rast_tab[newidx].quad; + + fxMesa->PointsFunc = rast_tab[newidx].points; + fxMesa->LineFunc = rast_tab[newidx].line; + fxMesa->TriangleFunc = rast_tab[newidx].triangle; + fxMesa->QuadFunc = rast_tab[newidx].quad; + fxMesa->RenderVBRawTab = rast_tab[newidx].render_tab; + + if (newidx == 0 && + (ctx->IndirectTriangles & (DD_LINE_WIDTH|DD_POINT_SIZE)) == 0) + fxMesa->RenderElementsRaw = tdfxDDRenderEltsRaw; + else + fxMesa->RenderElementsRaw = gl_render_elts; + + if (0) + tdfxPrintRenderState( "toggle tdfx render state", fxMesa->RenderIndex ); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h new file mode 100644 index 000000000..1de26cefa --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h @@ -0,0 +1,176 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_TRIS_H__ +#define __TDFX_TRIS_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "tdfx_vb.h" +#include "tdfx_render.h" + +extern void tdfxDDChooseRenderState( GLcontext *ctx ); +extern void tdfxDDTriangleFuncsInit( void ); + + +#define TDFX_FLAT_BIT 0x01 +#define TDFX_OFFSET_BIT 0x02 +#define TDFX_TWOSIDE_BIT 0x04 +#define TDFX_CLIPRECT_BIT 0x10 +#define TDFX_FALLBACK_BIT 0x20 +#define TDFX_MAX_TRIFUNC 0x40 + + +static __inline void tdfx_draw_triangle( tdfxContextPtr fxMesa, + tdfxVertex *v0, + tdfxVertex *v1, + tdfxVertex *v2 ) +{ + grDrawTriangle( v0, v1, v2 ); +} + + +static __inline void tdfx_draw_point( tdfxContextPtr fxMesa, + tdfxVertex *tmp, float sz ) +{ + if ( sz <= 1.0 ) { + /* Save and restore original x,y rather than copying whole + * vertex. + */ + GLfloat x = tmp->v.x, y = tmp->v.y; + tmp->v.x += PNT_X_OFFSET - TRI_X_OFFSET; + tmp->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; + grDrawPoint( tmp ); + tmp->v.x = x; + tmp->v.y = y; + } + else { + const GLfloat xLeft = tmp->v.x - 0.5 * sz - TRI_X_OFFSET + PNT_X_OFFSET; + const GLfloat xRight = tmp->v.x + 0.5 * sz - TRI_X_OFFSET + PNT_X_OFFSET; + const GLfloat yBot = tmp->v.y - 0.5 * sz - TRI_Y_OFFSET + PNT_Y_OFFSET; + const GLfloat yTop = tmp->v.y + 0.5 * sz - TRI_Y_OFFSET + PNT_Y_OFFSET; + tdfxVertex verts[4]; + + verts[0] = *tmp; + verts[1] = *tmp; + verts[2] = *tmp; + verts[3] = *tmp; + + verts[0].v.x = xLeft; + verts[0].v.y = yBot; + + verts[1].v.x = xRight; + verts[1].v.y = yBot; + + verts[2].v.x = xRight; + verts[2].v.y = yTop; + + verts[3].v.x = xLeft; + verts[3].v.y = yTop; + + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts, + sizeof(tdfxVertex) ); + } +} + + +static __inline void tdfx_draw_line( tdfxContextPtr fxMesa, + tdfxVertex *tmp0, + tdfxVertex *tmp1, + float width ) +{ + if ( width <= 1.0 ) + { + /* Faster to save and restore 4 dwords than to copy 32 dwords. + */ + GLfloat x0 = tmp0->v.x, y0 = tmp0->v.y; + GLfloat x1 = tmp1->v.x, y1 = tmp1->v.y; + tmp0->v.x += LINE_X_OFFSET - TRI_X_OFFSET; + tmp0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + tmp1->v.x += LINE_X_OFFSET - TRI_X_OFFSET; + tmp1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + grDrawLine(tmp0, tmp1); + tmp0->v.x = x0; + tmp0->v.y = y0; + tmp1->v.x = x1; + tmp1->v.y = y1; + } + else + { + tdfxVertex verts[4]; + float dx, dy, ix, iy; + + dx = tmp0->v.x - tmp1->v.x; + dy = tmp0->v.y - tmp1->v.y; + + if (dx * dx > dy * dy) { + iy = width * .5; + ix = 0; + } else { + iy = 0; + ix = width * .5; + } + + verts[0] = *tmp0; + verts[1] = *tmp0; + verts[2] = *tmp1; + verts[3] = *tmp1; + + verts[0].v.x = tmp0->v.x - ix; + verts[0].v.y = tmp0->v.y - iy; + + verts[1].v.x = tmp0->v.x + ix; + verts[1].v.y = tmp0->v.y + iy; + + verts[2].v.x = tmp1->v.x + ix; + verts[2].v.y = tmp1->v.y + iy; + + verts[3].v.x = tmp1->v.x - ix; + verts[3].v.y = tmp1->v.y - iy; + + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts, + sizeof(tdfxVertex) ); + } +} + +void tdfxDDToggleTriCliprects( GLcontext *ctx ); + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_TRIS_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h new file mode 100644 index 000000000..a1039c99c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h @@ -0,0 +1,422 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +static __inline void TAG(triangle)( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts; + tdfxVertex *v[3]; + +#if (IND & TDFX_OFFSET_BIT) + GLfloat offset; + GLfloat z[3]; +#endif + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + GLuint c[3]; +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); +#endif + + v[0] = &fxverts[e0]; + v[1] = &fxverts[e1]; + v[2] = &fxverts[e2]; + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; +#endif + + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT)) + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & TDFX_TWOSIDE_BIT) + { + GLuint facing = ( cc < 0.0 ) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & TDFX_FLAT_BIT) { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + TDFX_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + TDFX_COLOR( (char *)&v[2]->ui[4], vbcolor[e2] ); + } + } +#endif + +#if (IND & TDFX_OFFSET_BIT) + { + offset = ctx->Polygon.OffsetUnits; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + } +#endif + } +#elif (IND & TDFX_FLAT_BIT) + { + GLuint color = fxverts[pv].ui[4]; + v[0]->ui[4] = color; + v[1]->ui[4] = color; + v[2]->ui[4] = color; + } +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + grDrawTriangle( v[0], v[1], v[2] ); + END_CLIP_LOOP_LOCKED( fxMesa ); +#else + grDrawTriangle( v[0], v[1], v[2] ); +#endif + +#if (IND & TDFX_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; +#endif + +#if (IND & (TDFX_FLAT_BIT | TDFX_TWOSIDE_BIT)) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; +#endif + +} + + + +static __inline void TAG(quad)( GLcontext *ctx, GLuint e0, + GLuint e1, GLuint e2, GLuint e3, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts; + tdfxVertex *v[4]; + +#if (IND & TDFX_OFFSET_BIT) + GLfloat offset; + GLfloat z[4]; +#endif + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + GLuint c[4]; +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); +#endif + + + v[0] = &fxverts[e0]; + v[1] = &fxverts[e1]; + v[2] = &fxverts[e2]; + v[3] = &fxverts[e3]; + + +/* fprintf(stderr, "%s\n", __FUNCTION__); */ + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; + c[3] = v[3]->ui[4]; +#endif + + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT)) + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & TDFX_TWOSIDE_BIT) + { + GLuint facing = ( cc < 0.0 ) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & TDFX_FLAT_BIT) { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[3]->ui[4] = v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + TDFX_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + TDFX_COLOR( (char *)&v[2]->ui[4], vbcolor[e2] ); + TDFX_COLOR( (char *)&v[3]->ui[4], vbcolor[e3] ); + } + } +#endif + +#if (IND & TDFX_OFFSET_BIT) + { + offset = ctx->Polygon.OffsetUnits; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + z[3] = v[3]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + v[3]->v.z += offset; + } +#endif + } +#elif (IND & TDFX_FLAT_BIT) + { + GLuint color = fxverts[pv].ui[4]; + v[0]->ui[4] = color; + v[1]->ui[4] = color; + v[2]->ui[4] = color; + v[3]->ui[4] = color; + } +#endif + +/* Marginally faster to call grDrawTriangle twice + * than calling grDrawVertexArray. + */ +#if (IND & TDFX_CLIPRECT_BIT) + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); +/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */ + grDrawTriangle( v[0], v[1], v[3] ); + grDrawTriangle( v[1], v[2], v[3] ); + END_CLIP_LOOP_LOCKED( fxMesa ); +#else +/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */ + grDrawTriangle( v[0], v[1], v[3] ); + grDrawTriangle( v[1], v[2], v[3] ); +#endif + +#if (IND & TDFX_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; + v[3]->v.z = z[3]; +#endif + +#if (IND & (TDFX_FLAT_BIT | TDFX_TWOSIDE_BIT)) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; + v[3]->ui[4] = c[3]; +#endif +} + + + + + +static __inline void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint pv ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(ctx->VB)->verts; + float width = ctx->Line.Width; + GLfloat z0, z1; + GLuint c0, c1; + tdfxVertex *vert0 = &fxVB[v0]; + tdfxVertex *vert1 = &fxVB[v1]; + + if ( IND & TDFX_TWOSIDE_BIT ) { + GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; + + if ( IND & TDFX_FLAT_BIT ) { + TDFX_COLOR( (char *)&vert0->v.color,vbcolor[pv] ); + *(int *)&vert1->v.color = *(int *)&vert0->v.color; + } else { + TDFX_COLOR( (char *)&vert0->v.color,vbcolor[v0] ); + TDFX_COLOR( (char *)&vert1->v.color,vbcolor[v1] ); + } + } else if ( IND & TDFX_FLAT_BIT ) { + c0 = *(GLuint *) &(vert0->v.color); + c1 = *(GLuint *) &(vert1->v.color); + *(int *)&vert0->v.color = + *(int *)&vert1->v.color = *(int *)&fxVB[pv].v.color; + } + + if ( IND & TDFX_OFFSET_BIT ) { + GLfloat offset = ctx->LineZoffset; + z0 = vert0->v.z; + z1 = vert1->v.z; + vert0->v.z += offset; + vert1->v.z += offset; + } + + if (IND & TDFX_CLIPRECT_BIT) { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_line( fxMesa, &fxVB[v0], &fxVB[v1], width ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } else + tdfx_draw_line( fxMesa, &fxVB[v0], &fxVB[v1], width ); + + if ( IND & TDFX_OFFSET_BIT ) { + vert0->v.z = z0; + vert1->v.z = z1; + } + + if ( (IND & TDFX_FLAT_BIT) && !(IND & TDFX_TWOSIDE_BIT) ) { + *(GLuint *) &(vert0->v.color) = c0; + *(GLuint *) &(vert1->v.color) = c1; + } +} + + +static __inline void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLfloat sz = ctx->Point.Size; + int i; + + for ( i = first ; i < last ; i++ ) { + if ( VB->ClipMask[i] == 0 ) { + if ( IND & (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT) ) + { + tdfxVertex tmp0 = fxVB[i]; + + if ( IND & TDFX_TWOSIDE_BIT ) { + GLubyte (*vbcolor)[4] = VB->ColorPtr->data; + TDFX_COLOR( (char *)&tmp0.v.color, vbcolor[i] ); + } + + if ( IND & TDFX_OFFSET_BIT ) { + GLfloat offset = ctx->PointZoffset; + tmp0.v.z += offset; + } + + if (IND & TDFX_CLIPRECT_BIT) { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_point( fxMesa, &tmp0, sz ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } else + tdfx_draw_point( fxMesa, &tmp0, sz ); + } + else if (IND & TDFX_CLIPRECT_BIT) + { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_point( fxMesa, &fxVB[i], sz ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } + else + tdfx_draw_point( fxMesa, &fxVB[i], sz ); + } + } +} + + + + +/* Accelerate unclipped VB rendering when fxMesa->renderIndex != 0 + * + * The versions for renderIndex == 0 are further optimized and appear + * in tdfx_tris.c + */ +#if (TYPE == 0) +#define RENDER_POINTS( start, count ) TAG(points)( ctx, start, count ) +#define RENDER_LINE( i1, i ) TAG(line)( ctx, i1, i, i ) +#define RENDER_TRI( i2, i1, i, pv, parity ) \ + do { \ + if (parity) TAG(triangle)( ctx, i1, i2, i, pv ); \ + else TAG(triangle)( ctx, i2, i1, i, pv ); \ + } while (0) +#define RENDER_QUAD( i3, i2, i1, i, pv ) TAG(quad)( ctx, i3, i2, i1, i, pv ) +#define LOCAL_VARS GLcontext *ctx = VB->ctx; +#define PRESERVE_TAG +#include "render_tmp.h" +#endif + + + +static void TAG(init)( void ) +{ + rast_tab[IND].triangle = TAG(triangle); + rast_tab[IND].quad = TAG(quad); + rast_tab[IND].line = TAG(line); + rast_tab[IND].points = TAG(points); +#if (TYPE == 0) + rast_tab[IND].render_tab = TAG(render_tab); +#else + rast_tab[IND].render_tab = 0; +#endif + TAG(render_init)(); +} + + +#undef IND +#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c new file mode 100644 index 000000000..a5cb9b6bc --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c @@ -0,0 +1,498 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_vb.h" + +#include "stages.h" +#include "mem.h" + + +#define COORD \ +do { \ + v->v.x = winCoord[0] + xoffset; \ + v->v.y = winCoord[1] + yoffset; \ + v->v.z = winCoord[2]; \ + v->v.rhw = w; \ +} while (0) + + +/* The assembly is slower... + */ +#if 0 && defined(USE_X86_ASM) +#define COL \ +do { \ + __asm__ ( \ + "movl (%%edx),%%eax \n" \ + "bswap %%eax \n" \ + "rorl $8,%%eax \n" \ + "movl %%eax,16(%%edi) \n" \ + : \ + : "d" (color), "D" (v) \ + : "%eax" ); \ +} while (0) +#else +#define COL \ +do { \ + v->v.color.blue = color[2]; \ + v->v.color.green = color[1]; \ + v->v.color.red = color[0]; \ + v->v.color.alpha = color[3]; \ +} while (0) +#endif + + +#define TEX0 \ +do { \ + v->v.tu0 = tc0[i][0] * sScale0 * w; \ + v->v.tv0 = tc0[i][1] * tScale0 * w; \ +} while (0) + +#define TEX1 \ +do { \ + v->v.tu1 = tc1[i][0] * sScale1 * w; \ + v->v.tv1 = tc1[i][1] * tScale1 * w; \ +} while (0) + + +#define TEX0_4 \ + if ( VB->TexCoordPtr[0]->size == 4 ) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[0]->data; \ + winCoord = VB->Win.data[start]; \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + for ( i = start ; i < end ; i++, v++, winCoord+=4 ) { \ + v->v.tq0 = tc[i][3] * winCoord[3]; \ + } \ + } + +#define TEX1_4 \ + if ( VB->TexCoordPtr[1]->size == 4 ) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[1]->data; \ + winCoord = VB->Win.data[start]; \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + for ( i = start ; i < end ; i++, v++, winCoord+=4 ) { \ + v->v.tq1 = tc[i][3] * winCoord[3]; \ + } \ + } + + +#define FOG + + +#define NOP + + + +#define SETUPFUNC(name,win,col,tex0,tex1,tex0_4,tex1_4,fog) \ +static void name( struct vertex_buffer *VB, GLuint start, GLuint end ) \ +{ \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx); \ + tdfxVertexPtr v; \ + const GLfloat *winCoord; \ + GLfloat (*tc0)[4]; \ + GLfloat (*tc1)[4]; \ + const GLfloat xoffset = fxMesa->x_offset + TRI_X_OFFSET; \ + const GLfloat yoffset = fxMesa->y_delta + TRI_Y_OFFSET; \ + const GLfloat sScale0 = fxMesa->sScale0; \ + const GLfloat tScale0 = fxMesa->tScale0; \ + const GLfloat sScale1 = fxMesa->sScale1; \ + const GLfloat tScale1 = fxMesa->tScale1; \ + const GLubyte *color; \ + int i; \ + \ + (void) xoffset; (void) yoffset; \ + (void) sScale0; (void) tScale0; \ + (void) sScale1; (void) tScale1; \ + \ + if (0) fprintf(stderr, "%s\n", __FUNCTION__); \ + gl_import_client_data( VB, VB->ctx->RenderFlags, \ + (VB->ClipOrMask \ + ? VEC_WRITABLE|VEC_GOOD_STRIDE \ + : VEC_GOOD_STRIDE)); \ + \ + tc0 = VB->TexCoordPtr[fxMesa->tmu_source[0]]->data; \ + tc1 = VB->TexCoordPtr[fxMesa->tmu_source[1]]->data; \ + color = VB->Color[0]->data[start]; \ + winCoord = VB->Win.data[start]; \ + \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + \ + if ( VB->ClipOrMask == 0 ) { \ + for ( i = start ; i < end ; i++, v++, color+=4, winCoord+=4 ) { \ + const GLfloat w = winCoord[3]; \ + (void) w; \ + win; \ + col; \ + fog; \ + tex0; \ + tex1; \ + } \ + } else { \ + for ( i = start ; i < end ; i++, v++, color+=4, winCoord+=4 ) { \ + if ( VB->ClipMask[i] == 0 ) { \ + const GLfloat w = winCoord[3]; \ + (void) w; \ + win; \ + fog; \ + tex0; \ + tex1; \ + } \ + col; \ + } \ + } \ + tex0_4; \ + tex1_4; \ +} + + +SETUPFUNC(rs_wt0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_wt0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_wft0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_wft0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, FOG) +SETUPFUNC(rs_wg, COORD, COL, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_wgt0, COORD, COL, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_wgt0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_wgf, COORD, COL, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_wgft0, COORD, COL, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_wgft0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, FOG) + +SETUPFUNC(rs_t0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_t0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_f, NOP, NOP, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_ft0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_ft0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, FOG) +SETUPFUNC(rs_g, NOP, COL, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_gt0, NOP, COL, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_gt0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_gf, NOP, COL, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_gft0, NOP, COL, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_gft0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, FOG) + + + +static void rs_invalid( struct vertex_buffer *VB, GLuint start, GLuint end ) +{ + fprintf( stderr, "tdfxRasterSetup(): invalid setup function\n" ); +} + +typedef void (*setupFunc)( struct vertex_buffer *, GLuint, GLuint ); + +static setupFunc setup_func[0x40]; + + +void tdfxDDSetupInit( void ) +{ + int i; + + for (i = 0; i < Elements(setup_func); i++) + setup_func[i] = rs_invalid; + + /* Functions to build vertices from scratch */ + setup_func[TDFX_WIN_BIT|TDFX_TEX0_BIT] = rs_wt0; + setup_func[TDFX_WIN_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wt0t1; + setup_func[TDFX_WIN_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_wft0; + setup_func[TDFX_WIN_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wft0t1; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT] = rs_wg; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_TEX0_BIT] = rs_wgt0; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wgt0t1; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT] = rs_wgf; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_wgft0; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wgft0t1; + + /* Repair functions */ + setup_func[TDFX_TEX0_BIT] = rs_t0; + setup_func[TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_t0t1; + setup_func[TDFX_FOG_BIT] = rs_f; + setup_func[TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_ft0; + setup_func[TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_ft0t1; + setup_func[TDFX_RGBA_BIT] = rs_g; + setup_func[TDFX_RGBA_BIT|TDFX_TEX0_BIT] = rs_gt0; + setup_func[TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_gt0t1; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT] = rs_gf; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_gft0; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_gft0t1; +} + + +void tdfxPrintSetupFlags( char *msg, GLuint flags ) +{ + fprintf( stderr, "%s: 0x%x %s%s%s%s%s\n", + msg, + (int)flags, + (flags & TDFX_WIN_BIT) ? " xyzw," : "", + (flags & TDFX_RGBA_BIT) ? " rgba," : "", + (flags & TDFX_FOG_BIT) ? " fog," : "", + (flags & TDFX_TEX0_BIT) ? " tex-0," : "", + (flags & TDFX_TEX1_BIT) ? " tex-1," : "" ); +} + + +/* ================================================================ + * Raster Setup + */ + +void tdfxDDChooseRasterSetupFunc( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + int index = TDFX_WIN_BIT | TDFX_RGBA_BIT; + int vertexFormat = fxMesa->vertexFormat; + + fxMesa->vertsize = 8; + fxMesa->tmu_source[0] = 0; + fxMesa->tmu_source[1] = 1; + fxMesa->tex_dest[0] = TDFX_TEX0_BIT; + fxMesa->tex_dest[1] = TDFX_TEX1_BIT; + fxMesa->vertexFormat = TDFX_LAYOUT_SINGLE; + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + index |= TDFX_TEX0_BIT; + } + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX1 ) { + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + fxMesa->vertexFormat = TDFX_LAYOUT_MULTI; + fxMesa->vertsize = 10; + index |= TDFX_TEX1_BIT; + } else { + /* Just a funny way of doing single texturing. + */ + fxMesa->tmu_source[0] = 1; + fxMesa->tex_dest[1] = TDFX_TEX0_BIT; + index |= TDFX_TEX0_BIT; + } + } + + if (ctx->Texture.ReallyEnabled & (ENABLE_TEX0 | ENABLE_TEX1)) { + if ((ctx->VB->TexCoordPtr[0] && ctx->VB->TexCoordPtr[0]->size == 4) || + (ctx->VB->TexCoordPtr[1] && ctx->VB->TexCoordPtr[1]->size == 4)) { + fxMesa->vertexFormat = TDFX_LAYOUT_PROJECT; + } + } + + if ( ctx->Fog.Enabled ) + index |= TDFX_FOG_BIT; + + fxMesa->SetupIndex = index; + ctx->Driver.RasterSetup = setup_func[index]; + + if ( fxMesa->vertexFormat != vertexFormat ) { + fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT; + } + + if (0) { + tdfxPrintSetupFlags( "full setup function", index ); + fprintf(stderr, "full setup function %p\n", ctx->Driver.RasterSetup); + } +} + +/* Check to see if vertices need repairing. + */ +void tdfxDDCheckPartialRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *d ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + int tmp = fxMesa->SetupDone; + + d->type = 0; + fxMesa->SetupDone = 0; /* cleared if we return */ + + if ( (ctx->Array.Summary & VERT_OBJ_ANY) == 0 ) + return; + if ( ctx->IndirectTriangles ) + return; + + fxMesa->SetupDone = tmp; +} + +/* Repair existing precalculated vertices with new data. + */ +void tdfxDDPartialRasterSetup( struct vertex_buffer *VB ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( VB->ctx ); + GLuint new = VB->pipeline->new_outputs; + GLuint available = VB->pipeline->outputs; + GLuint index = 0; + + if ( new & VERT_WIN ) { + new = available; + index |= TDFX_WIN_BIT | TDFX_FOG_BIT; + } + + if ( new & VERT_RGBA ) + index |= TDFX_RGBA_BIT; + + if ( new & VERT_TEX0_ANY ) + index |= TDFX_TEX0_BIT; + + if ( new & VERT_TEX1_ANY ) + index |= fxMesa->tex_dest[1]; + + if ( new & VERT_FOG_COORD ) + index |= TDFX_FOG_BIT; + + fxMesa->SetupDone &= ~index; + index &= fxMesa->SetupIndex; + fxMesa->SetupDone |= index; + + if ( 0 ) + tdfxPrintSetupFlags( "partial setup function", index ); + + if ( index ) + setup_func[index]( VB, VB->Start, VB->Count ); +} + +void tdfxDDDoRasterSetup( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + + if ( VB->Type == VB_CVA_PRECALC ) { + tdfxDDPartialRasterSetup( VB ); + } else if ( ctx->Driver.RasterSetup ) { + ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count ); + } +} + + +/* ================================================================ + * Device-specific Vertex Buffers + */ + +void tdfxDDResizeVB( struct vertex_buffer *VB, GLuint size ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + while ( fxVB->size < size ) + fxVB->size *= 2; + + ALIGN_FREE( fxVB->vert_store ); + fxVB->vert_store = ALIGN_MALLOC( sizeof(tdfxVertex) * fxVB->size, 32 ); + if ( !fxVB->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + fxVB->verts = (tdfxVertexPtr)fxVB->vert_store; + + gl_vector1ui_free( &fxVB->clipped_elements ); + gl_vector1ui_alloc( &fxVB->clipped_elements, + VEC_WRITABLE, fxVB->size, 32 ); + if ( !fxVB->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * fxVB->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } +} + +void tdfxDDResizeElts( struct vertex_buffer *VB, GLuint size ) +{ +#if 0 + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + FREE(fxVB->elts); + + while (fxVB->elt_size < size) + fxVB->elt_size *= 2; + + FREE(fxVB->elts); + fxVB->elts = MALLOC( sizeof(tdfxVertex *) * fxVB->elt_size ); + if ( !fxVB->elts ) { + fprintf( stderr, "Cannot allocate vertex indirection! Exiting...\n" ); + exit( 1 ); + } +#endif +} + +void tdfxDDRegisterVB( struct vertex_buffer *VB ) +{ + tdfxVertexBufferPtr fxVB; + + fxVB = (tdfxVertexBufferPtr) CALLOC( sizeof(*fxVB) ); + + fxVB->elt_size = fxVB->size = VB->Size * 2; + fxVB->vert_store = ALIGN_MALLOC( sizeof(tdfxVertex) * fxVB->size, 32 ); + if ( !fxVB->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + fxVB->verts = (tdfxVertexPtr)fxVB->vert_store; + +#if 0 + fxVB->elts = MALLOC( sizeof(tdfxVertex *) * fxVB->elt_size ); + if ( !fxVB->elts ) { + fprintf( stderr, "Cannot allocate vertex indirection! Exiting...\n" ); + exit( 1 ); + } +#endif + + gl_vector1ui_alloc( &fxVB->clipped_elements, + VEC_WRITABLE, fxVB->size, 32 ); + if ( !fxVB->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * fxVB->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } + + VB->driver_data = fxVB; +} + +void tdfxDDUnregisterVB( struct vertex_buffer *VB ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + if ( fxVB ) { + if ( fxVB->vert_store ) ALIGN_FREE( fxVB->vert_store ); + if ( fxVB->elts ) ALIGN_FREE( fxVB->elts ); + gl_vector1ui_free( &fxVB->clipped_elements ); + FREE( fxVB ); + VB->driver_data = NULL; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h new file mode 100644 index 000000000..1f928ea2d --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h @@ -0,0 +1,127 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_VB_H__ +#define __TDFX_VB_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "types.h" +#include "vb.h" + +/* + * Color type for the vertex data + */ +typedef struct { + GLubyte blue; + GLubyte green; + GLubyte red; + GLubyte alpha; +} tdfx_color_t; + + +/* The vertex structure. The final tu1/tv1 values only used in + * multitexture modes, and tq0/tq1 in projected texture modes. + */ +typedef struct { + GLfloat x, y, z; /* Coordinates in screen space */ + GLfloat rhw; /* Reciprocal homogeneous w */ + tdfx_color_t color; /* Diffuse color */ + GLuint padding; /* ... */ + GLfloat tu0, tv0; /* Texture 0 coordinates */ + GLfloat tu1, tv1; /* Texture 1 coordinates */ + GLfloat tq0, tq1; /* Projected texture coordinates */ +} tdfx_vertex; + + +/* The fastpath code still expects a 16-float stride vertex. + */ +union tdfx_vertex_t { + tdfx_vertex v; + GLfloat f[16]; + GLuint ui[16]; +}; + +typedef union tdfx_vertex_t tdfxVertex; +typedef union tdfx_vertex_t *tdfxVertexPtr; + +/* Vertex buffer for use when on the fast path */ +struct tdfx_vertex_buffer { + tdfxVertexPtr verts; + GLvector1ui clipped_elements; + GLuint size; + int last_vert; + void *vert_store; + + tdfxVertexPtr *elts; + GLuint elt_size; + GLuint last_elt; +}; + +typedef struct tdfx_vertex_buffer *tdfxVertexBufferPtr; + +#define TDFX_DRIVER_DATA(vb) ((tdfxVertexBufferPtr)((vb)->driver_data)) + + +#define TDFX_WIN_BIT 0x01 +#define TDFX_RGBA_BIT 0x02 +#define TDFX_FOG_BIT 0x04 +#define TDFX_SPEC_BIT 0x08 +#define TDFX_TEX0_BIT 0x10 +#define TDFX_TEX1_BIT 0x20 + + +extern void tdfxDDSetupInit( void ); + +extern void tdfxDDChooseRasterSetupFunc( GLcontext *ctx ); +extern void tdfxPrintSetupFlags( char *msg, GLuint flags ); + +extern void tdfxDDCheckPartialRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *s ); +extern void tdfxDDPartialRasterSetup( struct vertex_buffer *VB ); +extern void tdfxDDDoRasterSetup( struct vertex_buffer *VB ); + +extern void tdfxDDResizeVB( struct vertex_buffer *VB, GLuint size ); +extern void tdfxDDResizeElts( struct vertex_buffer *VB, GLuint size ); +extern void tdfxDDRegisterVB( struct vertex_buffer *VB ); +extern void tdfxDDUnregisterVB( struct vertex_buffer *VB ); + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_VB_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c new file mode 100644 index 000000000..e2abe0800 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c @@ -0,0 +1,382 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include <stdlib.h> +#include <string.h> + +#include "tdfx_context.h" + + +FxI32 +FX_grGetInteger_NoLock(FxU32 pname) +{ + switch (pname) { + case FX_FOG_TABLE_ENTRIES: + case FX_GLIDE_STATE_SIZE: + case FX_LFB_PIXEL_PIPE: + case FX_PENDING_BUFFERSWAPS: + case FX_TEXTURE_ALIGN: + case GR_STATS_PIXELS_DEPTHFUNC_FAIL: + case GR_STATS_PIXELS_IN: + case GR_STATS_PIXELS_OUT: + { + FxI32 result; + FxU32 grname = pname; + grGet(grname, 4, &result); + return result; + } + case FX_ZDEPTH_MAX: + { + FxI32 zvals[2]; + grGet(GR_ZDEPTH_MIN_MAX, 8, zvals); + return zvals[0]; + } + default: + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n"); + } + } + + return 0; +} + + +FxI32 +FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname) +{ + int result; + LOCK_HARDWARE(fxMesa); + result = FX_grGetInteger_NoLock(pname); + UNLOCK_HARDWARE(fxMesa); + return result; +} + + +const char * +FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname) +{ + const char *s; + LOCK_HARDWARE(fxMesa); + s = grGetString(pname); + UNLOCK_HARDWARE(fxMesa); + return s; +} + + + +/* Wrapper for grColorMask() and grColorMaskExt(). + */ +void +FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + LOCK_HARDWARE(fxMesa); + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(r, g, b, a); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(r || g || b, GL_FALSE); + } + UNLOCK_HARDWARE(fxMesa); +} + + +void +FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a) +{ + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(r, g, b, a); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(r || g || b, GL_FALSE); + } +} + + +/* As above, but pass the mask as an array + */ +void +FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + LOCK_HARDWARE(fxMesa); + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP], + rgba[BCOMP], rgba[ACOMP]); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); + } + UNLOCK_HARDWARE(fxMesa); +} + +void +FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]) +{ + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP], + rgba[BCOMP], rgba[ACOMP]); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); + } +} + + + +FxBool +FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer, + GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, + FxBool pixelPipeline, GrLfbInfo_t * info) +{ + FxBool result; + + LOCK_HARDWARE(fxMesa); + result = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +FxU32 +FX_grTexTextureMemRequired(tdfxContextPtr fxMesa, FxU32 evenOdd, GrTexInfo * info) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexTextureMemRequired(evenOdd, info); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +FxU32 +FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexMinAddress(tmu); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +extern FxU32 +FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexMaxAddress(tmu); + UNLOCK_HARDWARE(fxMesa); + return result; +} + + +int +FX_getFogTableSize(tdfxContextPtr fxMesa) +{ + int result; + LOCK_HARDWARE(fxMesa); + grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +int +FX_getGrStateSize(tdfxContextPtr fxMesa) +{ + int result; + LOCK_HARDWARE(fxMesa); + grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +void +FX_grAADrawLine(tdfxContextPtr fxMesa, GrVertex * a, GrVertex * b) +{ + /* ToDo */ + BEGIN_CLIP_LOOP(fxMesa); + grDrawLine(a, b); + END_CLIP_LOOP(fxMesa); +} + +void +FX_grAADrawPoint(tdfxContextPtr fxMesa, GrVertex * a) +{ + BEGIN_CLIP_LOOP(fxMesa); + grDrawPoint(a); + END_CLIP_LOOP(fxMesa); +} + +void +FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa, int n, GrVertex * verts) +{ + BEGIN_CLIP_LOOP(fxMesa); + grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); + END_CLIP_LOOP(fxMesa); +} + +#if TDFX_USE_PARGB +void +FX_setupGrVertexLayout(tdfxContextPtr fxMesa) +{ + LOCK_HARDWARE(fxMesa); + grReset(GR_VERTEX_PARAMETER); + + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + UNLOCK_HARDWARE(fxMesa); +} +#else /* TDFX_USE_PARGB */ +void +FX_setupGrVertexLayout(tdfxContextPtr fxMesa) +{ + LOCK_HARDWARE(fxMesa); + grReset(GR_VERTEX_PARAMETER); + + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + UNLOCK_HARDWARE(fxMesa); +} +#endif /* TDFX_USE_PARGB */ + +void +FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask) +{ + switch (hintType) { + case GR_HINT_STWHINT: + { + if (hintMask & GR_STWHINT_W_DIFF_TMU0) + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_ST_DIFF_TMU1) + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_W_DIFF_TMU1) + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + } + } +} + +void +FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask) +{ + LOCK_HARDWARE(fxMesa); + FX_grHints_NoLock(hintType, hintMask); + UNLOCK_HARDWARE(fxMesa); +} + +/* It appears to me that this function is needed either way. */ +FX_GrContext_t +FX_grSstWinOpen(tdfxContextPtr fxMesa, + FxU32 hWnd, + GrScreenResolution_t screen_resolution, + GrScreenRefresh_t refresh_rate, + GrColorFormat_t color_format, + GrOriginLocation_t origin_location, + int nColBuffers, int nAuxBuffers) +{ + FX_GrContext_t i; + LOCK_HARDWARE(fxMesa); + i = grSstWinOpen(hWnd, + screen_resolution, + refresh_rate, + color_format, origin_location, nColBuffers, nAuxBuffers); + + /* + fprintf(stderr, + "grSstWinOpen( win %d res %d ref %d fmt %d\n" + " org %d ncol %d naux %d )\n" + " ==> %d\n", + hWnd, + screen_resolution, + refresh_rate, + color_format, + origin_location, + nColBuffers, + nAuxBuffers, + i); + */ + UNLOCK_HARDWARE(fxMesa); + return i; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h index 15c4f3408..20e5530c5 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h,v 1.3 2000/12/08 19:36:23 alanh Exp $ */ /* * Mesa 3-D graphics library * Version: 3.3 @@ -48,116 +47,11 @@ #include <glide.h> #include <g3ext.h> -typedef struct tfxMesaContext *fxMesaContext; +typedef struct tdfx_context tdfxContextRec; +typedef struct tdfx_context *tdfxContextPtr; - -/* - * These are glide extension definitions. These are not - * defined in glide.h. They should really be defined in - * g3ext.h, but they are not. - */ -#if 0 -FX_ENTRY void FX_CALL -grStencilFunc(GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); - -FX_ENTRY void FX_CALL grStencilMask(GrStencil_t write_mask); - -FX_ENTRY void FX_CALL -grStencilOp(GrStencilOp_t stencil_fail, - GrStencilOp_t depth_fail, GrStencilOp_t depth_pass); - -FX_ENTRY void FX_CALL -grBufferClearExt(GrColor_t color, - GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil); - -FX_ENTRY void FX_CALL -grColorMaskExt(FxBool r, FxBool g, FxBool b, FxBool a); -#endif - - -typedef void (*grStencilFunc_t) (GrCmpFnc_t fnc, GrStencil_t ref, - GrStencil_t mask); -typedef void (*grStencilMask_t) (GrStencil_t write_mask); -typedef void (*grStencilOp_t) (GrStencilOp_t stencil_fail, - GrStencilOp_t depth_fail, - GrStencilOp_t depth_pass); -typedef void (*grBufferClearExt_t) (GrColor_t color, GrAlpha_t alpha, - FxU32 depth, GrStencil_t stencil); -typedef void (*grColorMaskExt_t) (FxBool r, FxBool g, FxBool b, FxBool a); - -/* - * "COMBINE" extension for Napalm - */ -typedef void (*grColorCombineExt_t)(GrCCUColor_t a, GrCombineMode_t a_mode, - GrCCUColor_t b, GrCombineMode_t b_mode, - GrCCUColor_t c, FxBool c_invert, - GrCCUColor_t d, FxBool d_invert, - FxU32 shift, FxBool invert); -typedef void (*grTexColorCombineExt_t)(FxU32 tmu, - GrTCCUColor_t a, GrCombineMode_t a_mode, - GrCCUColor_t b, GrCombineMode_t b_mode, - GrCCUColor_t c, FxBool c_invert, - GrCCUColor_t d, FxBool d_invert, - FxU32 shift, FxBool invert); -typedef void (*grAlphaCombineExt_t)(GrCCUColor_t a, GrCombineMode_t a_mode, - GrCCUColor_t b, GrCombineMode_t b_mode, - GrCCUColor_t c, FxBool c_invert, - GrCCUColor_t d, FxBool d_invert, - FxU32 shift, FxBool invert); -typedef void (*grTexAlphaCombineExt_t)(FxU32 tmu, - GrTACUColor_t a, GrCombineMode_t a_mode, - GrTACUColor_t b, GrCombineMode_t b_mode, - GrTACUColor_t c, FxBool c_invert, - GrTACUColor_t d, FxBool d_invert, - FxU32 shift, FxBool invert); -typedef void (*grAlphaBlendFunctionExt_t)(GrAlphaBlendFnc_t rgb_sf, - GrAlphaBlendFnc_t rgb_df, - GrAlphaBlendOp_t rgb_op, - GrAlphaBlendFnc_t alpha_sf, - GrAlphaBlendFnc_t alpha_df, - GrAlphaBlendOp_t alpha_op); -typedef void (*grConstantColorValueExt_t)(FxU32 tmu, GrColor_t value); - - - -/* - * These are functions to compress and decompress images. - * The types of the first and second parameters are not exactly - * right. The texus library declares them to be "char *", not - * "void *". However, "void *" is more correct, and more convenient. - */ -typedef void (*txImgQuantize_t) (void *dst, void *src, - int w, int h, - FxU32 format, FxU32 dither); -typedef void (*txImgDeQuantize_t)(void *dst, void *src, - int w, int h); /* - * These next three declarations should probably be taken from - * texus.h. However, there are duplicate declarations in g3ext.h - * and texus.h which make it hard to include them both. - */ -typedef void (*TxErrorCallbackFnc_t)( const char *string, FxBool fatal ); -typedef void (*txErrorSetCallback_t)(TxErrorCallbackFnc_t fnc, - TxErrorCallbackFnc_t *old_fnc); - -extern grStencilFunc_t grStencilFuncPtr; -extern grStencilMask_t grStencilMaskPtr; -extern grStencilOp_t grStencilOpPtr; -extern grBufferClearExt_t grBufferClearExtPtr; -extern grColorMaskExt_t grColorMaskExtPtr; -extern txImgQuantize_t txImgQuantizePtr; -extern txImgDeQuantize_t txImgDequantizeFXT1Ptr; -extern txErrorSetCallback_t txErrorSetCallbackPtr; -extern grColorCombineExt_t grColorCombineExtPtr; -extern grTexColorCombineExt_t grTexColorCombineExtPtr; -extern grAlphaCombineExt_t grAlphaCombineExtPtr; -extern grTexAlphaCombineExt_t grTexAlphaCombineExtPtr; -extern grAlphaBlendFunctionExt_t grAlphaBlendFunctionExtPtr; -extern grConstantColorValueExt_t grConstantColorValueExtPtr; - - -/* - * General context: + * General context: */ typedef GrContext_t FX_GrContext_t; @@ -233,7 +127,7 @@ typedef struct GrTmuVertex tmuvtx[GLIDE_NUM_TMU]; GLfloat z; /* Z is ignored */ } -GrVertex_12; +GrVertex; /* optimised vertex, packed argb, single texture, 8 dwords = 1 cacheline */ typedef struct @@ -244,20 +138,7 @@ typedef struct FxU32 argb; /* R, G, B, A [0..255.0] */ GrTmuVertex tmuvtx; /* only 1 TMU used to keep vertex size down */ } -GrVertex_8; - -/* vertex structure, padded to 16 dwords */ -typedef union -{ - GrVertex_8 v_8; - GrVertex_12 v_12; - GLfloat f[16]; - GLuint u[16]; -} -GrVertex_t; - -/* keep the compiler happy for now */ -typedef GrVertex_12 GrVertex; +GrVertex_Fast; /* following offsets work for both vertex layouts */ #define GR_VERTEX_X_OFFSET 0 @@ -286,13 +167,13 @@ typedef GrVertex_12 GrVertex; #endif #define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET] -#define PACK_4F_ARGB(dest, a, r, g, b) { \ - const GLuint cr = (int)r; \ - const GLuint cg = (int)g; \ - const GLuint ca = (int)a; \ - const GLuint cb = (int)b; \ - dest = ca << 24 | cr << 16 | cg << 8 | cb; \ - } +#define PACK_4F_ARGB(dest, a, r, g, b) { \ + const GLuint cr = (int)r; \ + const GLuint cg = (int)g; \ + const GLuint ca = (int)a; \ + const GLuint cb = (int)b; \ + dest = ca << 24 | cr << 16 | cg << 8 | cb; \ +} #else /* FX_USE_PARGB */ @@ -328,50 +209,50 @@ GrVertex; extern FxI32 FX_grGetInteger_NoLock(FxU32 pname); -extern FxI32 FX_grGetInteger(fxMesaContext fxMesa, FxU32 pname); +extern FxI32 FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname); -extern const char *FX_grGetString(fxMesaContext fxMesa, FxU32 pname); +extern const char *FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname); -#define FX_grTexDownloadTable(fxMesa, TMU, type, data) \ +#define FX_grTexDownloadTable(fxMesa, type, data) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexDownloadTable(type,data); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0); -#define FX_grTexDownloadTable_NoLock(TMU, type, data) \ +#define FX_grTexDownloadTable_NoLock(type, data) \ grTexDownloadTable(type, data) #define FX_grFlush(fxMesa) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grFlush(); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grFinish(fxMesa) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grFinish(); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while(0) #define FX_grLfbReadRegion(fxMesa,src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0); @@ -383,40 +264,21 @@ extern const char *FX_grGetString(fxMesaContext fxMesa, FxU32 pname); END_CLIP_LOOP(fxMesa); \ } while (0) -/* - * For Lod/LodLog2 conversion. - */ -#define FX_largeLodLog2(info) (info).largeLodLog2 - -#define FX_smallLodLog2(info) (info).smallLodLog2 - -#define FX_aspectRatioLog2(info) (info).aspectRatioLog2 - -#define FX_lodToValue(val) ((int)(GR_LOD_256-val)) - -#define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2)) -#define FX_largeLodValue_NoLock FX_largeLodValue - -#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2)) -#define FX_smallLodValue_NoLock FX_smallLodValue - -#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val)) - extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask); -extern void FX_grHints(fxMesaContext fxMesa, GrHint_t hintType, FxU32 hintMask); +extern void FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask); -extern void FX_grAADrawLine(fxMesaContext fxMesa, GrVertex * a, GrVertex * b); +extern void FX_grAADrawLine(tdfxContextPtr fxMesa, GrVertex * a, GrVertex * b); -extern void FX_grAADrawPoint(fxMesaContext fxMesa, GrVertex * a); +extern void FX_grAADrawPoint(tdfxContextPtr fxMesa, GrVertex * a); -extern void FX_setupGrVertexLayout(fxMesaContext fxMesa); +extern void FX_setupGrVertexLayout(tdfxContextPtr fxMesa); -extern FX_GrContext_t FX_grSstWinOpen(fxMesaContext fxMesa, +extern FX_GrContext_t FX_grSstWinOpen(tdfxContextPtr fxMesa, FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, @@ -441,21 +303,21 @@ extern FX_GrContext_t FX_grSstWinOpen(fxMesaContext fxMesa, END_CLIP_LOOP(fxMesa); \ } while (0) -extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa, +extern void FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa, int n, GrVertex * v); #define FX_grDitherMode(fxMesa, m) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grDitherMode(m); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grRenderBuffer(fxMesa, b) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grRenderBuffer(b); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grRenderBuffer_NoLock(b) grRenderBuffer(b) @@ -467,32 +329,32 @@ extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa, END_CLIP_LOOP(fxMesa); \ } while (0) -#define FX_grBufferClearExt_NoLock(c, a, d, s) (*grBufferClearExtPtr)(c, a, d, s) +#define FX_grBufferClear_NoLock(c, a, d) grBufferClear(c, a, d) + + +#define FX_grBufferClearExt_NoLock(c, a, d, s) grBufferClearExtProc(c, a, d, s) #define FX_grBufferClearExt(fxMesa, c, a, d, s) \ do { \ BEGIN_CLIP_LOOP(fxMesa); \ - (*grBufferClearExtPtr)(c, a, d, s); \ + grBufferClearExtProc(c, a, d, s); \ END_CLIP_LOOP(fxMesa); \ } while (0) -#define FX_grBufferClear_NoLock(c, a, d) grBufferClear(c, a, d) - - #define FX_grEnable(fxMesa, m) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grEnable(m); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grEnable_NoLock(m) grEnable(m) #define FX_grDisable(fxMesa, m) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grDisable(m); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grDisable_NoLock(m) grDisable(m) @@ -500,36 +362,36 @@ extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa, #define FX_grStencilFunc(fxMesa, fnc, ref, mask) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ - (*grStencilFuncPtr)((fnc), (ref), (mask)); \ - END_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + grStencilFuncProc((fnc), (ref), (mask)); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) -#define FX_grStencilFunc_NoLock(f, r, m) (*grStencilFuncPtr)(f, r, m) +#define FX_grStencilFunc_NoLock(f, r, m) grStencilFuncProc(f, r, m) #define FX_grStencilMask(fxMesa, write_mask) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ - (*grStencilMaskPtr)(write_mask); \ - END_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + grStencilMaskProc(write_mask); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) -#define FX_grStencilMask_NoLock(m) (*grStencilMaskPtr)(m) +#define FX_grStencilMask_NoLock(m) grStencilMaskProc(m) #define FX_grStencilOp(fxMesa, stencil_fail, depth_fail, depth_pass) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ - (*grStencilOpPtr)((stencil_fail), (depth_fail), (depth_pass)); \ - END_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + grStencilOpProc((stencil_fail), (depth_fail), (depth_pass)); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) -#define FX_grStencilOp_NoLock(sf, df, dp) (*grStencilOpPtr)(sf, df, dp) +#define FX_grStencilOp_NoLock(sf, df, dp) grStencilOpProc(sf, df, dp) #define FX_grDepthMask(fxMesa, m) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grDepthMask(m); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grDepthMask_NoLock(m) grDepthMask(m) @@ -546,7 +408,7 @@ extern void FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]); extern void FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]); -extern FxBool FX_grLfbLock(fxMesaContext fxMesa, +extern FxBool FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, FxBool pixelPipeline, @@ -554,16 +416,16 @@ extern FxBool FX_grLfbLock(fxMesaContext fxMesa, #define FX_grLfbUnlock(fxMesa, t, b) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grLfbUnlock(t, b); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grConstantColorValue(fxMesa, v) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grConstantColorValue(v); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grConstantColorValue_NoLock grConstantColorValue @@ -577,207 +439,207 @@ extern FxBool FX_grLfbLock(fxMesaContext fxMesa, #define FX_grAlphaBlendFunction(rs, rd, as, ad) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grAlphaBlendFunction(rs, rd, as, ad); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grAlphaCombine(func, fact, loc, oth, inv) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grAlphaCombine(func, fact, loc, oth, inv); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grAlphaCombine_NoLock grAlphaCombine #define FX_grAlphaTestFunction(fxMesa, f) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grAlphaTestFunction(f); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grAlphaTestReferenceValue(fxMesa, v) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grAlphaTestReferenceValue(v); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grClipWindow(fxMesa, minx, miny, maxx, maxy) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grClipWindow(minx, miny, maxx, maxy); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grClipWindow_NoLock grClipWindow #define FX_grColorCombine(fxMesa, func, fact, loc, oth, inv) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grColorCombine(func, fact, loc, oth, inv); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grColorCombine_NoLock grColorCombine #define FX_grCullMode(fxMesa, m) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grCullMode(m); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grDepthBiasLevel(fxMesa, lev) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grDepthBiasLevel(lev); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grDepthBufferFunction(fxMesa, func) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grDepthBufferFunction(func); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grFogColorValue(fxMesa, c) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grFogColorValue(c); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grFogMode(fxMesa, m) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grFogMode(m); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grFogTable(fxMesa, t)\ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grFogTable(t); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexClampMode(fxMesa, t, sc, tc) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexClampMode(t, sc, tc); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexClampMode_NoLock grTexClampMode #define FX_grTexCombine(fxMesa, t, rfunc, rfact, afunc, afact, rinv, ainv) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexCombine_NoLock grTexCombine #define FX_grTexDownloadMipMapLevel(fxMesa, t, sa, tlod, llod, ar, f, eo, d) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexDownloadMipMapLevel_NoLock grTexDownloadMipMapLevel #define FX_grTexDownloadMipMapLevelPartial(fxMesa, t, sa, tlod, llod, ar, f, eo, d, s, e); \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexFilterMode(fxMesa, t, minf, magf) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexFilterMode(t, minf, magf); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexFilterMode_NoLock grTexFilterMode -extern FxU32 FX_grTexMinAddress(fxMesaContext fxMesa, GrChipID_t tmu); -extern FxU32 FX_grTexMaxAddress(fxMesaContext fxMesa, GrChipID_t tmu); +extern FxU32 FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu); +extern FxU32 FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu); #define FX_grTexMipMapMode(t, m, lod) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexMipMapMode(t, m, lod); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexMipMapMode_NoLock grTexMipMapMode #define FX_grTexSource(t, sa, eo, i) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexSource(t, sa, eo, i); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexSource_NoLock grTexSource -extern FxU32 FX_grTexTextureMemRequired(fxMesaContext fxMesa, +extern FxU32 FX_grTexTextureMemRequired(tdfxContextPtr fxMesa, FxU32 evenOdd, GrTexInfo * info); #define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired #define FX_grGlideGetState(fxMesa, s) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grGlideGetState(s); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grGlideGetState_NoLock(s) grGlideGetState(s); #define FX_grDRIBufferSwap(fxMesa, i) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grDRIBufferSwap(i); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grSstSelect(fxMesa, b) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grSstSelect(b); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grSstSelect_NoLock grSstSelect #define FX_grGlideSetState(fxMesa, s) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grGlideSetState(s); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grGlideSetState_NoLock(s) grGlideSetState(s); #define FX_grDepthBufferMode(fxMesa, m) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grDepthBufferMode(m); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grLfbWriteColorFormat(fxMesa, f) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grLfbWriteColorFormat(f); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grDrawVertexArray(fxMesa, m, c, p) \ @@ -789,25 +651,25 @@ extern FxU32 FX_grTexTextureMemRequired(fxMesaContext fxMesa, #define FX_grGlideShutdown(fxMesa) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grGlideShutdown(); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grTexLodBiasValue_NoLock(t, v) grTexLodBiasValue(t, v) #define FX_grTexLodBiasValue(t, v) \ do { \ - BEGIN_BOARD_LOCK(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ grTexLodBiasValue(t, v); \ - END_BOARD_LOCK(fxMesa); \ + UNLOCK_HARDWARE(fxMesa); \ } while (0) #define FX_grGlideInit_NoLock grGlideInit #define FX_grSstWinOpen_NoLock grSstWinOpen -extern int FX_getFogTableSize(fxMesaContext fxMesa); +extern int FX_getFogTableSize(tdfxContextPtr fxMesa); -extern int FX_getGrStateSize(fxMesaContext fxMesa); +extern int FX_getGrStateSize(tdfxContextPtr fxMesa); #endif /* __FX_GLIDE_WARPER__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c index 206953dec..06930691d 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -1,139 +1,153 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c,v 1.10 2000/12/08 19:36:24 alanh Exp $ */ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* $XFree86$ */ /* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * * Authors: - * Daryll Strauss <daryll@valinux.com> - * Brian E. Paul <brianp@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * */ #ifdef GLX_DIRECT_RENDERING #include <X11/Xlibint.h> -#include <glide.h> -#include "fxdrv.h" + #include "context.h" #include "matrix.h" #include "mmath.h" #include "vbxform.h" -#include "fxtexman.h" +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_render.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" -/* including xf86PciInfo.h causes a bunch of errors */ -#ifndef PCI_CHIP_VOODOO5 -#define PCI_CHIP_VOODOO5 0x0009 + +#ifndef TDFX_DEBUG +int TDFX_DEBUG = (0 +/* | DEBUG_ALWAYS_SYNC */ +/* | DEBUG_VERBOSE_API */ +/* | DEBUG_VERBOSE_MSG */ +/* | DEBUG_VERBOSE_LRU */ +/* | DEBUG_VERBOSE_DRI */ +/* | DEBUG_VERBOSE_IOCTL */ +/* | DEBUG_VERBOSE_2D */ + ); #endif GLboolean -XMesaInitDriver(__DRIscreenPrivate * sPriv) +XMesaInitDriver( __DRIscreenPrivate *sPriv ) { - tdfxScreenPrivate *gsp; - - /* Check the DRI version */ - { - int major, minor, patch; - if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 0 || patch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DRI version 3.0.x but got version %d.%d.%d", - major, minor, patch); - __driMesaMessage(msg); - return GL_FALSE; - } - } - } - - /* Check that the DDX driver version is compatible */ - if (sPriv->ddxMajor != 1 || sPriv->ddxMinor != 0 || sPriv->ddxPatch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", - sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); - __driMesaMessage(msg); - return GL_FALSE; - } - - /* Check that the DRM driver version is compatible */ - if (sPriv->drmMajor != 1 || sPriv->drmMinor != 0 || sPriv->drmPatch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", - sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); - __driMesaMessage(msg); - return GL_FALSE; - } - - /* Allocate the private area */ - gsp = (tdfxScreenPrivate *) Xmalloc(sizeof(tdfxScreenPrivate)); - if (!gsp) - return GL_FALSE; - - gsp->driScrnPriv = sPriv; - - sPriv->private = (void *) gsp; - - if (!tdfxMapAllRegions(sPriv)) { - Xfree(gsp); - sPriv->private = NULL; - return GL_FALSE; - } - - return GL_TRUE; + int major, minor, patch; + char msg[1024]; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv ); + } + + /* Check the DRI version */ + if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { + if ( major != 3 || + minor != 0 || + patch < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DRI version 3.0.x " + "but got version %d.%d.%d", + major, minor, patch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + } + + /* Check that the DDX driver version is compatible */ + if ( sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DDX driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if ( sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DRM driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + + if ( !tdfxCreateScreen( sPriv ) ) { + tdfxDestroyScreen( sPriv ); + return GL_FALSE; + } + + return GL_TRUE; } void -XMesaResetDriver(__DRIscreenPrivate * sPriv) +XMesaResetDriver( __DRIscreenPrivate *sPriv ) { - tdfxUnmapAllRegions(sPriv); - Xfree(sPriv->private); - sPriv->private = NULL; + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv ); + } + + tdfxDestroyScreen( sPriv ); } GLvisual * -XMesaCreateVisual(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - const XVisualInfo * visinfo, - const __GLXvisualConfig * config) +XMesaCreateVisual( Display * dpy, + __DRIscreenPrivate *driScrnPriv, + const XVisualInfo *visinfo, + const __GLXvisualConfig *config ) { - /* Drivers may change the args to _mesa_create_visual() in order to - * setup special visuals. - */ - return _mesa_create_visual(config->rgba, + /* Drivers may change the args to _mesa_create_visual() in order to + * setup special visuals. + */ + return _mesa_create_visual( config->rgba, config->doubleBuffer, config->stereo, - _mesa_bitcount(visinfo->red_mask), - _mesa_bitcount(visinfo->green_mask), - _mesa_bitcount(visinfo->blue_mask), + _mesa_bitcount( visinfo->red_mask ), + _mesa_bitcount( visinfo->green_mask ), + _mesa_bitcount( visinfo->blue_mask ), config->alphaSize, 0, /* index bits */ config->depthSize, @@ -142,216 +156,247 @@ XMesaCreateVisual(Display * dpy, config->accumGreenSize, config->accumBlueSize, config->accumAlphaSize, - 0 /* num samples */ - ); + 0 /* num samples */ ); } GLboolean -XMesaCreateContext(Display * dpy, GLvisual * mesaVis, - __DRIcontextPrivate * driContextPriv) +XMesaCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ) { - fxMesaContext fxMesa; - __DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv; - tdfxScreenPrivate *sPriv = (tdfxScreenPrivate *) driScrnPriv->private; - TDFXSAREAPriv *saPriv; - - fxMesa = (fxMesaContext) Xmalloc(sizeof(struct tfxMesaContext)); - if (!fxMesa) { - return GL_FALSE; - } - - fxMesa->hHWContext = driContextPriv->hHWContext; - fxMesa->tdfxScrnPriv = sPriv; - /* deviceID = 0x05 = Voodoo3 */ - /* deviceID = 0x09 = Voodoo5 (and Voodoo4?) */ - fxMesa->isNapalm = sPriv->deviceID == PCI_CHIP_VOODOO5; - fxMesa->haveHwStencil = fxMesa->isNapalm && sPriv->cpp == 4; - - - fxMesa->glVis = mesaVis; - fxMesa->screen_width = sPriv->width; - fxMesa->screen_height = sPriv->height; - fxMesa->new_state = ~0; - fxMesa->driContextPriv = driContextPriv; - fxMesa->glCtx = driContextPriv->mesaContext; - fxMesa->initDone = GL_FALSE; - - saPriv = - (TDFXSAREAPriv *) ((char *) driScrnPriv->pSAREA + - sizeof(XF86DRISAREARec)); - grDRIOpen(driScrnPriv->pFB, sPriv->regs.map, sPriv->deviceID, - sPriv->width, sPriv->height, sPriv->mem, sPriv->cpp, - sPriv->stride, sPriv->fifoOffset, sPriv->fifoSize, - sPriv->fbOffset, sPriv->backOffset, sPriv->depthOffset, - sPriv->textureOffset, sPriv->textureSize, &saPriv->fifoPtr, - &saPriv->fifoRead); - - driContextPriv->driverPrivate = (void *) fxMesa; + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } - return GL_TRUE; + return tdfxCreateContext( dpy, mesaVis, driContextPriv ); } void -XMesaDestroyContext(__DRIcontextPrivate * driContextPriv) +XMesaDestroyContext( __DRIcontextPrivate *driContextPriv ) { - fxMesaContext fxMesa = (fxMesaContext) driContextPriv->driverPrivate; - if (fxMesa) { - if (fxMesa->glCtx->Shared->RefCount == 1) { - /* This share group is about to go away, free our private - * texture object data. - */ - struct gl_texture_object *tObj; - tObj = fxMesa->glCtx->Shared->TexObjectList; - while (tObj) { - fxTMFreeTexture(fxMesa, tObj); - tObj = tObj->Next; - } - } - XFree(fxMesa); - driContextPriv->driverPrivate = NULL; - } + tdfxContextPtr fxMesa; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate; + tdfxDestroyContext( fxMesa ); + driContextPriv->driverPrivate = NULL; } GLframebuffer * -XMesaCreateWindowBuffer(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - __DRIdrawablePrivate * driDrawPriv, - GLvisual * mesaVis) +XMesaCreateWindowBuffer( Display *dpy, + __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + GLvisual *mesaVis ) { - return gl_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, - mesaVis->AccumRedBits > 0, - GL_FALSE /* software alpha channel? */ - ); + return gl_create_framebuffer( mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->StencilBits > 0, + mesaVis->AccumRedBits > 0, + GL_FALSE /* software alpha channel? */ ); } GLframebuffer * -XMesaCreatePixmapBuffer(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - __DRIdrawablePrivate * driDrawPriv, - GLvisual * mesaVis) +XMesaCreatePixmapBuffer( Display *dpy, + __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + GLvisual *mesaVis ) { #if 0 - /* Different drivers may have different combinations of hardware and - * software ancillary buffers. - */ - return gl_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, - mesaVis->AccumRedBits > 0, - mesaVis->AlphaBits > 0); + /* Different drivers may have different combinations of hardware and + * software ancillary buffers. + */ + return gl_create_framebuffer( mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->StencilBits > 0, + mesaVis->AccumRedBits > 0, + mesaVis->AlphaBits > 0 ); #else - return NULL; /* not implemented yet */ + return NULL; /* not implemented yet */ #endif } - void -XMesaSwapBuffers(__DRIdrawablePrivate * driDrawPriv) +XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv ) { - GET_CURRENT_CONTEXT(ctx); - fxMesaContext fxMesa = 0; - - if (!driDrawPriv->mesaBuffer->Visual->DBflag) - return; /* can't swap a single-buffered window */ - - /* If the current context's drawable matches the given drawable - * we have to do a glFinish (per the GLX spec). - */ - if (ctx) { - __DRIdrawablePrivate *curDrawPriv; - fxMesa = FX_CONTEXT(ctx); - curDrawPriv = fxMesa->driContextPriv->driDrawablePriv; - if (curDrawPriv == driDrawPriv) { - /* swapping window bound to current context, flush first */ - FLUSH_VB(ctx, "swap buffers"); - BEGIN_BOARD_LOCK(fxMesa); - } - else { - /* make fxMesa context current */ - grGlideGetState((GrState *) fxMesa->state); - fxMesa = (fxMesaContext) driDrawPriv->driContextPriv->driverPrivate; - BEGIN_BOARD_LOCK(fxMesa); - grSstSelect(fxMesa->board); - grGlideSetState((GrState *) fxMesa->state); - } - } - + GET_CURRENT_CONTEXT(ctx); + tdfxContextPtr fxMesa = 0; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driDrawPriv ); + } + + if ( !driDrawPriv->mesaBuffer->Visual->DBflag ) + return; /* can't swap a single-buffered window */ + + /* If the current context's drawable matches the given drawable + * we have to do a glFinish (per the GLX spec). + */ + if ( ctx ) { + __DRIdrawablePrivate *curDrawPriv; + fxMesa = TDFX_CONTEXT(ctx); + curDrawPriv = fxMesa->driContext->driDrawablePriv; + + if ( curDrawPriv == driDrawPriv ) { + /* swapping window bound to current context, flush first */ + FLUSH_VB( ctx, "swap buffers" ); + LOCK_HARDWARE( fxMesa ); + } + else { + /* find the fxMesa context previously bound to the window */ + fxMesa = (tdfxContextPtr) driDrawPriv->driContextPriv->driverPrivate; + if (!fxMesa) + return; + LOCK_HARDWARE( fxMesa ); + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( (GrState *) fxMesa->Glide.State ); + } + } #ifdef STATS - { - int stalls; - static int prevStalls = 0; - stalls = grFifoGetStalls(); - if (stalls != prevStalls) { - fprintf(stderr, "%d stalls occurred\n", stalls - prevStalls); - prevStalls = stalls; - } - if (fxMesa && fxMesa->texSwaps) { - fprintf(stderr, "%d texture swaps occurred\n", fxMesa->texSwaps); - fxMesa->texSwaps = 0; - } - } + { + int stalls; + static int prevStalls = 0; + + stalls = grFifoGetStalls(); + + fprintf( stderr, "%s:\n", __FUNCTION__ ); + if ( stalls != prevStalls ) { + fprintf( stderr, " %d stalls occurred\n", + stalls - prevStalls ); + prevStalls = stalls; + } + if ( fxMesa && fxMesa->texSwaps ) { + fprintf( stderr, " %d texture swaps occurred\n", + fxMesa->texSwaps ); + fxMesa->texSwaps = 0; + } + } #endif + if (fxMesa->scissoredClipRects) { + /* restore clip rects without scissor box */ + grDRIPosition( driDrawPriv->x, driDrawPriv->y, + driDrawPriv->w, driDrawPriv->h, + driDrawPriv->numClipRects, driDrawPriv->pClipRects ); + } - /* XXX prototype grDRISwapClipRects() function may not be - * needed after all - */ -#if 0 - FX_grDRIBufferSwap(fxMesa, fxMesa->swapInterval); -#elif 1 - grDRIBufferSwap(fxMesa->swapInterval); -#else - grDRISwapClipRects(fxMesa->swapInterval, - driDrawPriv->numClipRects, - driDrawPriv->pClipRects); -#endif + grDRIBufferSwap( fxMesa->Glide.SwapInterval ); + + if (fxMesa->scissoredClipRects) { + /* restore clip rects WITH scissor box */ + grDRIPosition( driDrawPriv->x, driDrawPriv->y, + driDrawPriv->w, driDrawPriv->h, + fxMesa->numClipRects, fxMesa->pClipRects ); + } #if 0 - { - FxI32 result; - do { - result = FX_grGetInteger(FX_PENDING_BUFFERSWAPS); - } while (result > fxMesa->maxPendingSwapBuffers); - } + { + FxI32 result; + do { + result = FX_grGetInteger( FX_PENDING_BUFFERSWAPS ); + } while ( result > fxMesa->maxPendingSwapBuffers ); + } #endif - fxMesa->stats.swapBuffer++; - - - if (ctx) { - if (ctx->DriverCtx != fxMesa) { - /* restore original context */ - fxMesa = FX_CONTEXT(ctx); - grSstSelect(fxMesa->board); - grGlideSetState((GrState *) fxMesa->state); - } - END_BOARD_LOCK(fxMesa); - } + + fxMesa->stats.swapBuffer++; + + if (ctx) { + if (ctx->DriverCtx != fxMesa) { + fxMesa = TDFX_CONTEXT(ctx); + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( (GrState *) fxMesa->Glide.State ); + } + UNLOCK_HARDWARE( fxMesa ); + } } GLboolean -XMesaUnbindContext(__DRIcontextPrivate * driContextPriv) +XMesaUnbindContext( __DRIcontextPrivate *driContextPriv ) { - GET_CURRENT_CONTEXT(ctx); - if (driContextPriv && driContextPriv->mesaContext == ctx) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - FX_grGlideGetState(fxMesa, (GrState *) fxMesa->state); - } - return GL_TRUE; + GET_CURRENT_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + if ( driContextPriv && driContextPriv->mesaContext == ctx ) { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FX_grGlideGetState( fxMesa, (GrState *) fxMesa->Glide.State ); + } + return GL_TRUE; } + +GLboolean +XMesaMakeCurrent( __DRIcontextPrivate *driContextPriv, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv ) +{ + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + if ( driContextPriv ) { + tdfxContextPtr fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate; + GLcontext *ctx = fxMesa->glCtx; + + if ( fxMesa->driDrawable != driDrawPriv ) { + fxMesa->driDrawable = driDrawPriv; + fxMesa->dirty = ~0; + } + + if ( !fxMesa->Glide.Initialized ) { + if ( !tdfxInitContext( driDrawPriv, fxMesa ) ) + return GL_FALSE; + + LOCK_HARDWARE( fxMesa ); + + /* FIXME: Force loading of window information */ + fxMesa->width = 0; + tdfxUpdateClipping(ctx); + tdfxUploadClipping(fxMesa); + + UNLOCK_HARDWARE( fxMesa ); + } else { + LOCK_HARDWARE( fxMesa ); + + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( fxMesa->Glide.State ); + + tdfxUpdateClipping(ctx); + tdfxUploadClipping(fxMesa); + + UNLOCK_HARDWARE( fxMesa ); + } + + assert( ctx == driContextPriv->mesaContext ); + + gl_make_current2( ctx, driDrawPriv->mesaBuffer, + driReadPriv->mesaBuffer ); + + if ( !ctx->Viewport.Width ) { + gl_Viewport( ctx, 0, 0, driDrawPriv->w, driDrawPriv->h ); + } + } else { + gl_make_current( 0, 0 ); + } + + return GL_TRUE; +} + + GLboolean XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) { - fprintf(stderr,"XMesaOpenFullScreen\n"); + fprintf(stderr,"***** XMesaOpenFullScreen *****\n"); #if 0 /* When new glide3 calls exist */ return((GLboolean)grDRISetupFullScreen(GL_TRUE)); #else @@ -359,6 +404,7 @@ XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) #endif } + GLboolean XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) { @@ -371,182 +417,24 @@ XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) } -/* - * This function sends the window position and cliprect list to - * Glide for the given context. - */ -static void -XMesaWindowMoved(fxMesaContext fxMesa) -{ - __DRIdrawablePrivate *dPriv = fxMesa->driContextPriv->driDrawablePriv; - GLcontext *ctx = fxMesa->glCtx; - - grDRIPosition(dPriv->x, dPriv->y, dPriv->w, dPriv->h, - dPriv->numClipRects, dPriv->pClipRects); - fxMesa->numClipRects = dPriv->numClipRects; - fxMesa->pClipRects = dPriv->pClipRects; - if (dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset || - dPriv->w != fxMesa->width || dPriv->h != fxMesa->height) { - fxMesa->x_offset = dPriv->x; - fxMesa->y_offset = dPriv->y; - fxMesa->width = dPriv->w; - fxMesa->height = dPriv->h; - fxMesa->y_delta = - fxMesa->screen_height - fxMesa->y_offset - fxMesa->height; - } - switch (dPriv->numClipRects) { - case 0: - fxMesa->clipMinX = dPriv->x; - fxMesa->clipMaxX = dPriv->x + dPriv->w; - fxMesa->clipMinY = dPriv->y; - fxMesa->clipMaxY = dPriv->y + dPriv->h; - fxSetScissorValues(ctx); - fxMesa->needClip = 0; - break; - case 1: - fxMesa->clipMinX = dPriv->pClipRects[0].x1; - fxMesa->clipMaxX = dPriv->pClipRects[0].x2; - fxMesa->clipMinY = dPriv->pClipRects[0].y1; - fxMesa->clipMaxY = dPriv->pClipRects[0].y2; - fxSetScissorValues(ctx); - fxMesa->needClip = 0; - break; - default: - fxMesa->needClip = 1; - } -} - - -GLboolean -XMesaMakeCurrent(__DRIcontextPrivate * driContextPriv, - __DRIdrawablePrivate * driDrawPriv, - __DRIdrawablePrivate * driReadPriv) -{ - if (driContextPriv) { - fxMesaContext fxMesa; - - fxMesa = (fxMesaContext) driContextPriv->driverPrivate; - - if (!fxMesa->initDone) { - if (!tdfxInitHW(driDrawPriv, fxMesa)) - return GL_FALSE; - fxMesa->width = 0; - XMesaWindowMoved(fxMesa); - FX_grGlideGetState(fxMesa, (GrState *) fxMesa->state); - } - else { - FX_grSstSelect(fxMesa, fxMesa->board); - FX_grGlideSetState(fxMesa, (GrState *) fxMesa->state); - XMesaWindowMoved(fxMesa); - } - - assert(fxMesa->glCtx == driContextPriv->mesaContext); - - gl_make_current2(fxMesa->glCtx, driDrawPriv->mesaBuffer, - driReadPriv->mesaBuffer); - - if (!fxMesa->glCtx->Viewport.Width) - gl_Viewport(fxMesa->glCtx, 0, 0, driDrawPriv->w, driDrawPriv->h); - } - else { - gl_make_current(0, 0); - } - return GL_TRUE; -} - - -/* This is called from within the LOCK_HARDWARE routine */ -void -XMesaUpdateState(fxMesaContext fxMesa) -{ - __DRIcontextPrivate *cPriv = fxMesa->driContextPriv; - __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; - __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; - TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + - sizeof(XF86DRISAREARec)); - int stamp; - char ret; - - DEBUG_CHECK_LOCK(); - DRM_CAS(&sPriv->pSAREA->lock, dPriv->driContextPriv->hHWContext, - DRM_LOCK_HELD | dPriv->driContextPriv->hHWContext, ret); - if (!ret) { - DEBUG_LOCK(); - return; - } - drmGetLock(sPriv->fd, dPriv->driContextPriv->hHWContext, 0); - stamp = dPriv->lastStamp; - /* This macro will update dPriv's cliprects if needed */ - XMESA_VALIDATE_DRAWABLE_INFO(cPriv->display, sPriv, dPriv); - /* fprintf(stderr, "In FifoPtr=%d FifoRead=%d\n", saPriv->fifoPtr, saPriv->fifoRead); */ - if (saPriv->fifoOwner != dPriv->driContextPriv->hHWContext) { - grDRIImportFifo(saPriv->fifoPtr, saPriv->fifoRead); - } - if (saPriv->ctxOwner != dPriv->driContextPriv->hHWContext) { - /* This sequence looks a little odd. Glide mirrors the state, and - when you get the state you are forcing the mirror to be up to - date, and then getting a copy from the mirror. You can then force - that state onto the hardware when you set the state. */ - void *state; - state = malloc(FX_grGetInteger_NoLock(FX_GLIDE_STATE_SIZE)); - FX_grGlideGetState_NoLock(state); - FX_grGlideSetState_NoLock(state); - free(state); - } - if (saPriv->texOwner != dPriv->driContextPriv->hHWContext) { - fxTMRestoreTextures_NoLock(fxMesa); - } -#if 0 - if (*dPriv->pStamp != stamp) -#else - if (*dPriv->pStamp != stamp || - saPriv->ctxOwner != dPriv->driContextPriv->hHWContext) -#endif - XMesaWindowMoved(fxMesa); - DEBUG_LOCK(); -} - - -/* - * XXX is this used by anyone? +/* Silence compiler warnings. */ -#if 000 -static void -XMesaSetSAREA(void) -{ - __DRIdrawablePrivate *dPriv = gCC->driDrawablePriv; - __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; - TDFXSAREAPriv *saPriv = - (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + - sizeof(XF86DRISAREARec)); - - saPriv->fifoOwner = dPriv->driContextPriv->hHWContext; - saPriv->ctxOwner = dPriv->driContextPriv->hHWContext; - saPriv->texOwner = dPriv->driContextPriv->hHWContext; - grDRIResetSAREA(); - /* fprintf(stderr, "Out FifoPtr=%d FifoRead=%d\n", saPriv->fifoPtr, saPriv->fifoRead); */ -} -#endif - - - -extern void __driRegisterExtensions(void); /* silence compiler warning */ +extern void __driRegisterExtensions( void ); /* This function is called by libGL.so as soon as libGL.so is loaded. * This is where we'd register new extension functions with the dispatcher. */ -void -__driRegisterExtensions(void) +void __driRegisterExtensions( void ) { #if 0 - /* Example. Also look in fxdd.c for more details. */ - { - const int _gloffset_FooBarEXT = 555; /* just an example number! */ - if (_glapi_add_entrypoint("glFooBarEXT", _gloffset_FooBarEXT)) { - void *f = glXGetProcAddressARB("glFooBarEXT"); - assert(f); - } - } + /* Example. Also look in tdfx_dd.c for more details. */ + { + const int _gloffset_FooBarEXT = 555; /* just an example number! */ + if ( _glapi_add_entrypoint( "glFooBarEXT", _gloffset_FooBarEXT ) ) { + void *f = glXGetProcAddressARB( "glFooBarEXT" ); + assert( f ); + } + } #endif } diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 03f86330c..7d20603bb 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -246,6 +246,11 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->pSAREA->drawableTable[i].flags = 0; } +#if 0 + /* Grab the hardware lock */ + DRILock(pScreen, 0); +#endif + return TRUE; } diff --git a/xc/programs/Xserver/GL/glx/g_disptab.c b/xc/programs/Xserver/GL/glx/g_disptab.c index f05e213f3..52b378bd6 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab.c +++ b/xc/programs/Xserver/GL/glx/g_disptab.c @@ -1,22 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "glxserver.h" @@ -166,6 +175,23 @@ __GLXdispatchSingleProcPtr __glXSingleTable[] = { __glXDisp_IsEnabled, __glXDisp_IsList, __glXDisp_Flush, + __glXDisp_AreTexturesResident, + __glXDisp_DeleteTextures, + __glXDisp_GenTextures, + __glXDisp_IsTexture, + __glXDisp_GetColorTable, + __glXDisp_GetColorTableParameterfv, + __glXDisp_GetColorTableParameteriv, + __glXDisp_GetConvolutionFilter, + __glXDisp_GetConvolutionParameterfv, + __glXDisp_GetConvolutionParameteriv, + __glXDisp_GetSeparableFilter, + __glXDisp_GetHistogram, + __glXDisp_GetHistogramParameterfv, + __glXDisp_GetHistogramParameteriv, + __glXDisp_GetMinmax, + __glXDisp_GetMinmaxParameterfv, + __glXDisp_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXRenderTable[] = { @@ -361,9 +387,28 @@ __GLXdispatchRenderProcPtr __glXRenderTable[] = { __glXDisp_Translated, __glXDisp_Translatef, __glXDisp_Viewport, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDisp_PolygonOffset, + __glXDisp_DrawArrays, __glXDisp_Indexubv, + __glXDisp_ColorSubTable, + __glXDisp_CopyColorSubTable, + __glXDisp_ActiveTextureARB, + __glXDisp_MultiTexCoord1dvARB, + __glXDisp_MultiTexCoord1fvARB, + __glXDisp_MultiTexCoord1ivARB, + __glXDisp_MultiTexCoord1svARB, + __glXDisp_MultiTexCoord2dvARB, + __glXDisp_MultiTexCoord2fvARB, + __glXDisp_MultiTexCoord2ivARB, + __glXDisp_MultiTexCoord2svARB, + __glXDisp_MultiTexCoord3dvARB, + __glXDisp_MultiTexCoord3fvARB, + __glXDisp_MultiTexCoord3ivARB, + __glXDisp_MultiTexCoord3svARB, + __glXDisp_MultiTexCoord4dvARB, + __glXDisp_MultiTexCoord4fvARB, + __glXDisp_MultiTexCoord4ivARB, + __glXDisp_MultiTexCoord4svARB, }; __GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { @@ -510,6 +555,23 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { __glXDispSwap_IsEnabled, __glXDispSwap_IsList, __glXDispSwap_Flush, + __glXDispSwap_AreTexturesResident, + __glXDispSwap_DeleteTextures, + __glXDispSwap_GenTextures, + __glXDispSwap_IsTexture, + __glXDispSwap_GetColorTable, + __glXDispSwap_GetColorTableParameterfv, + __glXDispSwap_GetColorTableParameteriv, + __glXDispSwap_GetConvolutionFilter, + __glXDispSwap_GetConvolutionParameterfv, + __glXDispSwap_GetConvolutionParameteriv, + __glXDispSwap_GetSeparableFilter, + __glXDispSwap_GetHistogram, + __glXDispSwap_GetHistogramParameterfv, + __glXDispSwap_GetHistogramParameteriv, + __glXDispSwap_GetMinmax, + __glXDispSwap_GetMinmaxParameterfv, + __glXDispSwap_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { @@ -705,7 +767,26 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { __glXDispSwap_Translated, __glXDispSwap_Translatef, __glXDispSwap_Viewport, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDispSwap_PolygonOffset, + __glXDispSwap_DrawArrays, __glXDispSwap_Indexubv, + __glXDispSwap_ColorSubTable, + __glXDispSwap_CopyColorSubTable, + __glXDispSwap_ActiveTextureARB, + __glXDispSwap_MultiTexCoord1dvARB, + __glXDispSwap_MultiTexCoord1fvARB, + __glXDispSwap_MultiTexCoord1ivARB, + __glXDispSwap_MultiTexCoord1svARB, + __glXDispSwap_MultiTexCoord2dvARB, + __glXDispSwap_MultiTexCoord2fvARB, + __glXDispSwap_MultiTexCoord2ivARB, + __glXDispSwap_MultiTexCoord2svARB, + __glXDispSwap_MultiTexCoord3dvARB, + __glXDispSwap_MultiTexCoord3fvARB, + __glXDispSwap_MultiTexCoord3ivARB, + __glXDispSwap_MultiTexCoord3svARB, + __glXDispSwap_MultiTexCoord4dvARB, + __glXDispSwap_MultiTexCoord4fvARB, + __glXDispSwap_MultiTexCoord4ivARB, + __glXDispSwap_MultiTexCoord4svARB, }; diff --git a/xc/programs/Xserver/GL/glx/g_disptab.h b/xc/programs/Xserver/GL/glx/g_disptab.h index 247b27ea9..56d26a1f7 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab.h +++ b/xc/programs/Xserver/GL/glx/g_disptab.h @@ -1,24 +1,33 @@ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifndef _GLX_g_disptab_h_ #define _GLX_g_disptab_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ extern int __glXRender(__GLXclientState*, GLbyte*); @@ -83,6 +92,23 @@ extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDisp_IsList(__GLXclientState*, GLbyte*); extern int __glXDisp_Flush(__GLXclientState*, GLbyte*); +extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDisp_CallList(GLbyte*); extern void __glXDisp_CallLists(GLbyte*); @@ -274,7 +300,28 @@ extern void __glXDisp_Scalef(GLbyte*); extern void __glXDisp_Translated(GLbyte*); extern void __glXDisp_Translatef(GLbyte*); extern void __glXDisp_Viewport(GLbyte*); +extern void __glXDisp_PolygonOffset(GLbyte*); +extern void __glXDisp_DrawArrays(GLbyte*); extern void __glXDisp_Indexubv(GLbyte*); +extern void __glXDisp_ColorSubTable(GLbyte*); +extern void __glXDisp_CopyColorSubTable(GLbyte*); +extern void __glXDisp_ActiveTextureARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4svARB(GLbyte*); extern int __glXSwapRender(__GLXclientState*, GLbyte*); extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*); @@ -338,6 +385,23 @@ extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDispSwap_CallList(GLbyte*); extern void __glXDispSwap_CallLists(GLbyte*); @@ -529,16 +593,37 @@ extern void __glXDispSwap_Scalef(GLbyte*); extern void __glXDispSwap_Translated(GLbyte*); extern void __glXDispSwap_Translatef(GLbyte*); extern void __glXDispSwap_Viewport(GLbyte*); +extern void __glXDispSwap_PolygonOffset(GLbyte*); +extern void __glXDispSwap_DrawArrays(GLbyte*); extern void __glXDispSwap_Indexubv(GLbyte*); +extern void __glXDispSwap_ColorSubTable(GLbyte*); +extern void __glXDispSwap_CopyColorSubTable(GLbyte*); +extern void __glXDispSwap_ActiveTextureARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*); #define __GLX_MIN_GLXCMD_OPCODE 1 #define __GLX_MAX_GLXCMD_OPCODE 20 #define __GLX_MIN_RENDER_OPCODE 1 -#define __GLX_MAX_RENDER_OPCODE 194 +#define __GLX_MAX_RENDER_OPCODE 213 #define __GLX_MIN_SINGLE_OPCODE 1 -#define __GLX_MAX_SINGLE_OPCODE 142 -#define __GLX_SINGLE_TABLE_SIZE 143 -#define __GLX_RENDER_TABLE_SIZE 195 +#define __GLX_MAX_SINGLE_OPCODE 159 +#define __GLX_SINGLE_TABLE_SIZE 160 +#define __GLX_RENDER_TABLE_SIZE 214 extern __GLXdispatchRenderProcPtr __glXRenderTable[__GLX_RENDER_TABLE_SIZE]; extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE]; diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.c b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c index 1ac56e678..5923aa225 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab_EXT.c +++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c @@ -1,31 +1,1052 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "glxserver.h" #include "glxext.h" #include "g_disptab_EXT.h" __GLXdispatchRenderProcPtr __glXRenderTable_EXT[] = { - __glXDisp_PolygonOffset, - __glXDisp_TexSubImage1D, - __glXDisp_TexSubImage2D, + __glXDisp_ColorTable, + __glXDisp_ColorTableParameterfv, + __glXDisp_ColorTableParameteriv, + __glXDisp_CopyColorTable, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -41,26 +1062,2073 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXDisp_DrawArrays, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXDisp_BlendColor, + __glXDisp_BlendEquation, + __glXNoSuchRenderOpcode, + __glXDisp_TexSubImage1D, + __glXDisp_TexSubImage2D, + __glXDisp_ConvolutionFilter1D, + __glXDisp_ConvolutionFilter2D, + __glXDisp_ConvolutionParameterf, + __glXDisp_ConvolutionParameterfv, + __glXDisp_ConvolutionParameteri, + __glXDisp_ConvolutionParameteriv, + __glXDisp_CopyConvolutionFilter1D, + __glXDisp_CopyConvolutionFilter2D, + __glXDisp_SeparableFilter2D, + __glXDisp_Histogram, + __glXDisp_Minmax, + __glXDisp_ResetHistogram, + __glXDisp_ResetMinmax, + __glXDisp_TexImage3D, + __glXDisp_TexSubImage3D, + __glXDisp_DrawArraysEXT, __glXDisp_BindTexture, __glXDisp_PrioritizeTextures, __glXDisp_CopyTexImage1D, __glXDisp_CopyTexImage2D, __glXDisp_CopyTexSubImage1D, __glXDisp_CopyTexSubImage2D, + __glXDisp_CopyTexSubImage3D, }; __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[] = { - __glXDisp_AreTexturesResident, - __glXDisp_DeleteTextures, - __glXDisp_GenTextures, - __glXDisp_IsTexture, + __glXDisp_AreTexturesResidentEXT, + __glXDisp_DeleteTexturesEXT, + __glXDisp_GenTexturesEXT, + __glXDisp_IsTextureEXT, }; __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[] = { - __glXDispSwap_PolygonOffset, - __glXDispSwap_TexSubImage1D, - __glXDispSwap_TexSubImage2D, + __glXDispSwap_ColorTable, + __glXDispSwap_ColorTableParameterfv, + __glXDispSwap_ColorTableParameteriv, + __glXDispSwap_CopyColorTable, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -76,18 +3144,1051 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXDispSwap_DrawArrays, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXDispSwap_BlendColor, + __glXDispSwap_BlendEquation, + __glXNoSuchRenderOpcode, + __glXDispSwap_TexSubImage1D, + __glXDispSwap_TexSubImage2D, + __glXDispSwap_ConvolutionFilter1D, + __glXDispSwap_ConvolutionFilter2D, + __glXDispSwap_ConvolutionParameterf, + __glXDispSwap_ConvolutionParameterfv, + __glXDispSwap_ConvolutionParameteri, + __glXDispSwap_ConvolutionParameteriv, + __glXDispSwap_CopyConvolutionFilter1D, + __glXDispSwap_CopyConvolutionFilter2D, + __glXDispSwap_SeparableFilter2D, + __glXDispSwap_Histogram, + __glXDispSwap_Minmax, + __glXDispSwap_ResetHistogram, + __glXDispSwap_ResetMinmax, + __glXDispSwap_TexImage3D, + __glXDispSwap_TexSubImage3D, + __glXDispSwap_DrawArraysEXT, __glXDispSwap_BindTexture, __glXDispSwap_PrioritizeTextures, __glXDispSwap_CopyTexImage1D, __glXDispSwap_CopyTexImage2D, __glXDispSwap_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage2D, + __glXDispSwap_CopyTexSubImage3D, }; __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[] = { - __glXDispSwap_AreTexturesResident, - __glXDispSwap_DeleteTextures, - __glXDispSwap_GenTextures, - __glXDispSwap_IsTexture, + __glXDispSwap_AreTexturesResidentEXT, + __glXDispSwap_DeleteTexturesEXT, + __glXDispSwap_GenTexturesEXT, + __glXDispSwap_IsTextureEXT, }; diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.h b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h index 59c7e3024..f28d3b9ff 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab_EXT.h +++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h @@ -1,64 +1,115 @@ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifndef _GLX_g_disptab_EXT_h_ #define _GLX_g_disptab_EXT_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.2 1999/06/14 07:31:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ -extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); -extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); -extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); -extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDisp_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsTextureEXT(__GLXclientState*, GLbyte*); -extern void __glXDisp_PolygonOffset(GLbyte*); +extern void __glXDisp_ColorTable(GLbyte*); +extern void __glXDisp_ColorTableParameterfv(GLbyte*); +extern void __glXDisp_ColorTableParameteriv(GLbyte*); +extern void __glXDisp_CopyColorTable(GLbyte*); +extern void __glXDisp_BlendColor(GLbyte*); +extern void __glXDisp_BlendEquation(GLbyte*); extern void __glXDisp_TexSubImage1D(GLbyte*); extern void __glXDisp_TexSubImage2D(GLbyte*); -extern void __glXDisp_DrawArrays(GLbyte*); +extern void __glXDisp_ConvolutionFilter1D(GLbyte*); +extern void __glXDisp_ConvolutionFilter2D(GLbyte*); +extern void __glXDisp_ConvolutionParameterf(GLbyte*); +extern void __glXDisp_ConvolutionParameterfv(GLbyte*); +extern void __glXDisp_ConvolutionParameteri(GLbyte*); +extern void __glXDisp_ConvolutionParameteriv(GLbyte*); +extern void __glXDisp_CopyConvolutionFilter1D(GLbyte*); +extern void __glXDisp_CopyConvolutionFilter2D(GLbyte*); +extern void __glXDisp_SeparableFilter2D(GLbyte*); +extern void __glXDisp_Histogram(GLbyte*); +extern void __glXDisp_Minmax(GLbyte*); +extern void __glXDisp_ResetHistogram(GLbyte*); +extern void __glXDisp_ResetMinmax(GLbyte*); +extern void __glXDisp_TexImage3D(GLbyte*); +extern void __glXDisp_TexSubImage3D(GLbyte*); +extern void __glXDisp_DrawArraysEXT(GLbyte*); extern void __glXDisp_BindTexture(GLbyte*); extern void __glXDisp_PrioritizeTextures(GLbyte*); extern void __glXDisp_CopyTexImage1D(GLbyte*); extern void __glXDisp_CopyTexImage2D(GLbyte*); extern void __glXDisp_CopyTexSubImage1D(GLbyte*); extern void __glXDisp_CopyTexSubImage2D(GLbyte*); +extern void __glXDisp_CopyTexSubImage3D(GLbyte*); -extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsTextureEXT(__GLXclientState*, GLbyte*); -extern void __glXDispSwap_PolygonOffset(GLbyte*); +extern void __glXDispSwap_ColorTable(GLbyte*); +extern void __glXDispSwap_ColorTableParameterfv(GLbyte*); +extern void __glXDispSwap_ColorTableParameteriv(GLbyte*); +extern void __glXDispSwap_CopyColorTable(GLbyte*); +extern void __glXDispSwap_BlendColor(GLbyte*); +extern void __glXDispSwap_BlendEquation(GLbyte*); extern void __glXDispSwap_TexSubImage1D(GLbyte*); extern void __glXDispSwap_TexSubImage2D(GLbyte*); -extern void __glXDispSwap_DrawArrays(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_ConvolutionParameterf(GLbyte*); +extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*); +extern void __glXDispSwap_ConvolutionParameteri(GLbyte*); +extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_SeparableFilter2D(GLbyte*); +extern void __glXDispSwap_Histogram(GLbyte*); +extern void __glXDispSwap_Minmax(GLbyte*); +extern void __glXDispSwap_ResetHistogram(GLbyte*); +extern void __glXDispSwap_ResetMinmax(GLbyte*); +extern void __glXDispSwap_TexImage3D(GLbyte*); +extern void __glXDispSwap_TexSubImage3D(GLbyte*); +extern void __glXDispSwap_DrawArraysEXT(GLbyte*); extern void __glXDispSwap_BindTexture(GLbyte*); extern void __glXDispSwap_PrioritizeTextures(GLbyte*); extern void __glXDispSwap_CopyTexImage1D(GLbyte*); extern void __glXDispSwap_CopyTexImage2D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*); +extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*); -#define __GLX_MIN_RENDER_OPCODE_EXT 4098 -#define __GLX_MAX_RENDER_OPCODE_EXT 4122 +#define __GLX_MIN_RENDER_OPCODE_EXT 2053 +#define __GLX_MAX_RENDER_OPCODE_EXT 4123 #define __GLX_MIN_VENDPRIV_OPCODE_EXT 11 #define __GLX_MAX_VENDPRIV_OPCODE_EXT 14 #define __GLX_VENDPRIV_TABLE_SIZE_EXT 4 -#define __GLX_RENDER_TABLE_SIZE_EXT 25 +#define __GLX_RENDER_TABLE_SIZE_EXT 2071 extern __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_VENDPRIV_TABLE_SIZE_EXT]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; diff --git a/xc/programs/Xserver/GL/glx/g_render.c b/xc/programs/Xserver/GL/glx/g_render.c index d8214d02a..7948fab82 100644 --- a/xc/programs/Xserver/GL/glx/g_render.c +++ b/xc/programs/Xserver/GL/glx/g_render.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -1739,3 +1747,330 @@ void __glXDisp_Indexubv(GLbyte *pc) ); } +void __glXDisp_BlendColor(GLbyte *pc) +{ + glBlendColor( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ); +} + +void __glXDisp_BlendEquation(GLbyte *pc) +{ + glBlendEquation( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_ColorTableParameterfv(GLbyte *pc) +{ + glColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ColorTableParameteriv(GLbyte *pc) +{ + glColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDisp_CopyColorTable(GLbyte *pc) +{ + glCopyColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_CopyColorSubTable(GLbyte *pc) +{ + glCopyColorSubTable( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_ConvolutionParameterf(GLbyte *pc) +{ + glConvolutionParameterf( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameterfv(GLbyte *pc) +{ + glConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameteri(GLbyte *pc) +{ + glConvolutionParameteri( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameteriv(GLbyte *pc) +{ + glConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDisp_CopyConvolutionFilter1D(GLbyte *pc) +{ + glCopyConvolutionFilter1D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_CopyConvolutionFilter2D(GLbyte *pc) +{ + glCopyConvolutionFilter2D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20) + ); +} + +void __glXDisp_Histogram(GLbyte *pc) +{ + glHistogram( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLboolean *)(pc + 12) + ); +} + +void __glXDisp_Minmax(GLbyte *pc) +{ + glMinmax( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLboolean *)(pc + 8) + ); +} + +void __glXDisp_ResetHistogram(GLbyte *pc) +{ + glResetHistogram( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_ResetMinmax(GLbyte *pc) +{ + glResetMinmax( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_CopyTexSubImage3D(GLbyte *pc) +{ + glCopyTexSubImage3D( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLint *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32) + ); +} + +void __glXDisp_ActiveTextureARB(GLbyte *pc) +{ + glActiveTextureARB( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord1dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 12); + pc -= 4; + } +#endif + glMultiTexCoord1dvARB( + *(GLenum *)(pc + 8), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord1fvARB(GLbyte *pc) +{ + glMultiTexCoord1fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord1ivARB(GLbyte *pc) +{ + glMultiTexCoord1ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord1svARB(GLbyte *pc) +{ + glMultiTexCoord1svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + glMultiTexCoord2dvARB( + *(GLenum *)(pc + 16), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord2fvARB(GLbyte *pc) +{ + glMultiTexCoord2fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2ivARB(GLbyte *pc) +{ + glMultiTexCoord2ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2svARB(GLbyte *pc) +{ + glMultiTexCoord2svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 28); + pc -= 4; + } +#endif + glMultiTexCoord3dvARB( + *(GLenum *)(pc + 24), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord3fvARB(GLbyte *pc) +{ + glMultiTexCoord3fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3ivARB(GLbyte *pc) +{ + glMultiTexCoord3ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3svARB(GLbyte *pc) +{ + glMultiTexCoord3svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + glMultiTexCoord4dvARB( + *(GLenum *)(pc + 32), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord4fvARB(GLbyte *pc) +{ + glMultiTexCoord4fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4ivARB(GLbyte *pc) +{ + glMultiTexCoord4ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4svARB(GLbyte *pc) +{ + glMultiTexCoord4svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + diff --git a/xc/programs/Xserver/GL/glx/g_renderswap.c b/xc/programs/Xserver/GL/glx/g_renderswap.c index 5b57a07a3..5673420a3 100644 --- a/xc/programs/Xserver/GL/glx/g_renderswap.c +++ b/xc/programs/Xserver/GL/glx/g_renderswap.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -2715,3 +2723,545 @@ void __glXDispSwap_Indexubv(GLbyte *pc) ); } +void __glXDispSwap_BlendColor(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_FLOAT(pc + 12); + + glBlendColor( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ); +} + +void __glXDispSwap_BlendEquation(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glBlendEquation( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_ColorTableParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + + glColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ColorTableParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + + glColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDispSwap_CopyColorTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_CopyColorSubTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyColorSubTable( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_ConvolutionParameterf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + + glConvolutionParameterf( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + + glConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameteri(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + + glConvolutionParameteri( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + + glConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyConvolutionFilter1D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + + glCopyConvolutionFilter2D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20) + ); +} + +void __glXDispSwap_Histogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + + glHistogram( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLboolean *)(pc + 12) + ); +} + +void __glXDispSwap_Minmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + + glMinmax( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLboolean *)(pc + 8) + ); +} + +void __glXDispSwap_ResetHistogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glResetHistogram( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_ResetMinmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glResetMinmax( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_INT(pc + 28); + __GLX_SWAP_INT(pc + 32); + + glCopyTexSubImage3D( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLint *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32) + ); +} + +void __glXDispSwap_ActiveTextureARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glActiveTextureARB( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 12); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); + + glMultiTexCoord1dvARB( + *(GLenum *)(pc + 8), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1); + + glMultiTexCoord1fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 1); + + glMultiTexCoord1ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 1); + + glMultiTexCoord1svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + + glMultiTexCoord2dvARB( + *(GLenum *)(pc + 16), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2); + + glMultiTexCoord2fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 2); + + glMultiTexCoord2ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); + + glMultiTexCoord2svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 28); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + + glMultiTexCoord3dvARB( + *(GLenum *)(pc + 24), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3); + + glMultiTexCoord3fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 3); + + glMultiTexCoord3ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 3); + + glMultiTexCoord3svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 32); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + + glMultiTexCoord4dvARB( + *(GLenum *)(pc + 32), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4); + + glMultiTexCoord4fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 4); + + glMultiTexCoord4ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 4); + + glMultiTexCoord4svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + diff --git a/xc/programs/Xserver/GL/glx/g_single.c b/xc/programs/Xserver/GL/glx/g_single.c index e86d68f86..cb9f4eb33 100644 --- a/xc/programs/Xserver/GL/glx/g_single.c +++ b/xc/programs/Xserver/GL/glx/g_single.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -431,8 +439,8 @@ int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -445,8 +453,8 @@ int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; @@ -477,8 +485,8 @@ int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -491,8 +499,8 @@ int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; @@ -523,8 +531,8 @@ int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -537,8 +545,8 @@ int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; @@ -1238,11 +1246,11 @@ int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) GLboolean answerBuffer[200]; char *answer; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); @@ -1266,11 +1274,11 @@ int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); glDeleteTextures( @@ -1289,11 +1297,11 @@ int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc) GLuint answerBuffer[200]; char *answer; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); @@ -1314,14 +1322,468 @@ int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + + retval = + glIsTexture( + *(GLuint *)(pc + 0) + ); + __GLX_PUT_RETVAL(retval); + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + return Success; +} + +int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLboolean answerBuffer[200]; + char *answer; + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = - glIsTexture( + glAreTexturesResidentEXT( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4), + (GLboolean *) answer + ); + __GLX_PUT_RETVAL(retval); + __GLX_BEGIN_REPLY(n); + __GLX_SEND_HEADER(); + __GLX_SEND_BYTE_ARRAY(n); + return Success; +} + +int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + + glDeleteTexturesEXT( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4) + ); + return Success; +} + +int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLuint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); + glGenTexturesEXT( + *(GLsizei *)(pc + 0), + (GLuint *) answer + ); + __GLX_BEGIN_REPLY(n*4); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(n); + return Success; +} + +int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + + retval = + glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); diff --git a/xc/programs/Xserver/GL/glx/g_singleswap.c b/xc/programs/Xserver/GL/glx/g_singleswap.c index 98f8631a6..4b88c4ee9 100644 --- a/xc/programs/Xserver/GL/glx/g_singleswap.c +++ b/xc/programs/Xserver/GL/glx/g_singleswap.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.3 1999/06/14 07:31:24 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -513,8 +521,8 @@ int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -529,10 +537,10 @@ int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; @@ -569,8 +577,8 @@ int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -585,10 +593,10 @@ int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; @@ -625,8 +633,8 @@ int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -641,10 +649,10 @@ int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; @@ -1500,6 +1508,560 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) char *answer; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, n); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); + retval = + glAreTexturesResident( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4), + (GLboolean *) answer + ); + __GLX_PUT_RETVAL(retval); + __GLX_SWAP_REPLY_RETVAL(); + __GLX_BEGIN_REPLY(n); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + __GLX_SEND_BYTE_ARRAY(n); + return Success; +} + +int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, n); + + glDeleteTextures( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4) + ); + return Success; +} + +int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLuint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); + glGenTextures( + *(GLsizei *)(pc + 0), + (GLuint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, n); + __GLX_BEGIN_REPLY(n*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(n); + return Success; +} + +int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) +{ + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + + retval = + glIsTexture( + *(GLuint *)(pc + 0) + ); + __GLX_PUT_RETVAL(retval); + __GLX_SWAP_REPLY_RETVAL(); + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + return Success; +} + +int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLboolean answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { @@ -1512,7 +2074,7 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = - glAreTexturesResident( + glAreTexturesResidentEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLboolean *) answer @@ -1526,7 +2088,7 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; @@ -1544,14 +2106,14 @@ int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); - glDeleteTextures( + glDeleteTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4) ); return Success; } -int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; @@ -1571,7 +2133,7 @@ int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); - glGenTextures( + glGenTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *) answer ); @@ -1583,7 +2145,7 @@ int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; @@ -1600,7 +2162,7 @@ int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(pc + 0); retval = - glIsTexture( + glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); diff --git a/xc/programs/Xserver/GL/glx/global.c b/xc/programs/Xserver/GL/glx/global.c index 5a7ae7ff9..5f0b104e1 100644 --- a/xc/programs/Xserver/GL/glx/global.c +++ b/xc/programs/Xserver/GL/glx/global.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/global.c,v 1.2 1999/06/14 07:31:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:40 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/global.c,v 1.2 2001/01/08 16:21:40 nathanh Exp $ */ #define NEED_REPLIES diff --git a/xc/programs/Xserver/GL/glx/glxbuf.c b/xc/programs/Xserver/GL/glx/glxbuf.c index 6c42e588a..0ee66ddd4 100644 --- a/xc/programs/Xserver/GL/glx/glxbuf.c +++ b/xc/programs/Xserver/GL/glx/glxbuf.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:40 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxbuf.c,v 1.2 2001/01/08 16:21:40 nathanh Exp $ */ #include "glxserver.h" @@ -65,7 +80,7 @@ __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes) } } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; @@ -134,7 +149,7 @@ __glXPixInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes) } } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; @@ -189,7 +204,7 @@ __glXResizeBuffers(__GLdrawablePrivate *glPriv, __GLX_SET_ACCEL_BUFFER_MASK(__GL_BACK_BUFFER_MASK); } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; @@ -250,7 +265,7 @@ __glXFreeBuffers(__GLXdrawablePrivate *glxPriv) (*glPriv->backBuffer.free)(&glPriv->backBuffer, glPriv); } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; diff --git a/xc/programs/Xserver/GL/glx/glxbuf.h b/xc/programs/Xserver/GL/glx/glxbuf.h index 05cea4a44..2eae08771 100644 --- a/xc/programs/Xserver/GL/glx/glxbuf.h +++ b/xc/programs/Xserver/GL/glx/glxbuf.h @@ -1,26 +1,41 @@ #ifndef _glxbuf_h_ #define _glxbuf_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.h,v 1.2 1999/06/14 07:31:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxbuf.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ extern void __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, diff --git a/xc/programs/Xserver/GL/glx/glxcmds.c b/xc/programs/Xserver/GL/glx/glxcmds.c index 64b28a206..3cc7ba39e 100644 --- a/xc/programs/Xserver/GL/glx/glxcmds.c +++ b/xc/programs/Xserver/GL/glx/glxcmds.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.5 2000/06/17 00:03:12 martin Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.4 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxcmds.c,v 1.4 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -32,6 +47,7 @@ #include "glximports.h" #include "glxutil.h" #include "glxext.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -43,12 +59,14 @@ static __GLimports imports = { __glXImpWarning, __glXImpFatal, __glXImpGetenv, + __glXImpAtoi, __glXImpSprintf, __glXImpFopen, __glXImpFclose, __glXImpFprintf, __glXImpGetDrawablePrivate, NULL, + NULL }; /************************************************************************/ diff --git a/xc/programs/Xserver/GL/glx/glxcmdsswap.c b/xc/programs/Xserver/GL/glx/glxcmdsswap.c index 6437c2938..d48597940 100644 --- a/xc/programs/Xserver/GL/glx/glxcmdsswap.c +++ b/xc/programs/Xserver/GL/glx/glxcmdsswap.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -31,6 +46,7 @@ #include <pixmapstr.h> #include <windowstr.h> #include "glxext.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -763,7 +779,7 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { - (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req); + (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); return Success; } cl->client->errorValue = req->vendorCode; @@ -785,7 +801,7 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { - return (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req); + return (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); } cl->client->errorValue = req->vendorCode; return __glXUnsupportedPrivateRequest; diff --git a/xc/programs/Xserver/GL/glx/glxcontext.h b/xc/programs/Xserver/GL/glx/glxcontext.h index c3e353fc7..7e055e42a 100644 --- a/xc/programs/Xserver/GL/glx/glxcontext.h +++ b/xc/programs/Xserver/GL/glx/glxcontext.h @@ -1,26 +1,41 @@ #ifndef _GLX_context_h_ #define _GLX_context_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxcontext.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ typedef struct __GLXcontextRec __GLXcontext; diff --git a/xc/programs/Xserver/GL/glx/glxdrawable.h b/xc/programs/Xserver/GL/glx/glxdrawable.h index 89fe4dbcb..826cc0b5b 100644 --- a/xc/programs/Xserver/GL/glx/glxdrawable.h +++ b/xc/programs/Xserver/GL/glx/glxdrawable.h @@ -1,26 +1,41 @@ #ifndef _GLX_drawable_h_ #define _GLX_drawable_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ typedef struct { @@ -76,7 +91,7 @@ struct __GLXdrawablePrivateRec { GLboolean (*swapBuffers)(struct __GLXdrawablePrivateRec *); /* - ** The GL drawable (information shared between GLX and the GL core + ** The GL drawable (information shared between GLX and the GL core) */ __GLdrawablePrivate glPriv; diff --git a/xc/programs/Xserver/GL/glx/glxerror.h b/xc/programs/Xserver/GL/glx/glxerror.h index d6adf95a6..bbfd95f12 100644 --- a/xc/programs/Xserver/GL/glx/glxerror.h +++ b/xc/programs/Xserver/GL/glx/glxerror.h @@ -1,26 +1,41 @@ #ifndef _GLX_error_h_ #define _GLX_error_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxerror.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxerror.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxext.c b/xc/programs/Xserver/GL/glx/glxext.c index bc09e1c53..b46c8c4d0 100644 --- a/xc/programs/Xserver/GL/glx/glxext.c +++ b/xc/programs/Xserver/GL/glx/glxext.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.4 1999/06/14 07:31:26 dawes Exp $ +/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.5 2000/09/26 15:57:02 tsi Exp $ ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., @@ -16,7 +16,8 @@ ** Those portions of the Subject Software created by Silicon Graphics, Inc. ** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. ** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxext.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -216,7 +217,7 @@ GLboolean __glXErrorOccured(void) */ void GlxExtensionInit(void) { - ExtensionEntry *extEntry, *AddExtension(); + ExtensionEntry *extEntry; int i; #ifdef X11R5 @@ -402,7 +403,7 @@ static int __glXDispatch(ClientPtr client) ** with the client so we will be notified when the client dies. */ XID xid = FakeClientID(client->index); - if (!AddResource( xid, __glXClientRes, (pointer)client->index)) { + if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { return BadAlloc; } ResetClientState(client->index); @@ -457,7 +458,7 @@ static int __glXSwapDispatch(ClientPtr client) ** with the client so we will be notified when the client dies. */ XID xid = FakeClientID(client->index); - if (!AddResource( xid, __glXClientRes, (pointer)client->index)) { + if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { return BadAlloc; } ResetClientState(client->index); diff --git a/xc/programs/Xserver/GL/glx/glxext.h b/xc/programs/Xserver/GL/glx/glxext.h index 543eefcd6..c87cd3314 100644 --- a/xc/programs/Xserver/GL/glx/glxext.h +++ b/xc/programs/Xserver/GL/glx/glxext.h @@ -1,46 +1,64 @@ #ifndef _glxext_h_ #define _glxext_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.3 1999/06/14 07:31:27 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxext.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ +/* + * Added by VA Linux for XFree86 4.0.x + */ typedef struct { int type; void (*resetExtension)(void); Bool (*initVisuals)( - VisualPtr * visualp, - DepthPtr * depthp, - int * nvisualp, - int * ndepthp, - int * rootDepthp, - VisualID * defaultVisp, - unsigned long sizes, - int bitsPerRGB - ); + VisualPtr * visualp, + DepthPtr * depthp, + int * nvisualp, + int * ndepthp, + int * rootDepthp, + VisualID * defaultVisp, + unsigned long sizes, + int bitsPerRGB + ); void (*setVisualConfigs)( - int nconfigs, - __GLXvisualConfig *configs, - void **privates - ); + int nconfigs, + __GLXvisualConfig *configs, + void **privates + ); } __GLXextensionInfo; extern GLboolean __glXFreeContext(__GLXcontext *glxc); @@ -56,14 +74,12 @@ extern void __glXResetLargeCommandStatus(__GLXclientState*); extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); -extern Bool __glXCoreType(void); extern void GlxExtensionInit(void); -extern void GlxSetVisualConfigs( - int nconfigs, - __GLXvisualConfig *configs, - void **privates -); + +extern Bool __glXCoreType(void); + extern int GlxInitVisuals( +#if NeedFunctionPrototypes VisualPtr * visualp, DepthPtr * depthp, int * nvisualp, @@ -73,6 +89,7 @@ extern int GlxInitVisuals( unsigned long sizes, int bitsPerRGB, int preferredVis +#endif ); #endif /* _glxext_h_ */ diff --git a/xc/programs/Xserver/GL/glx/glxfb.c b/xc/programs/Xserver/GL/glx/glxfb.c index 67ea31434..6775623fd 100644 --- a/xc/programs/Xserver/GL/glx/glxfb.c +++ b/xc/programs/Xserver/GL/glx/glxfb.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.c,v 1.2 1999/06/14 07:31:27 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxfb.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ /* @@ -30,7 +45,7 @@ #include <gcstruct.h> -/* can't include glmath.h */ +/* so we don't include glmath.h */ extern GLuint __glFloorLog2(GLuint); typedef struct __GLFBbufferInfoRec { diff --git a/xc/programs/Xserver/GL/glx/glxfb.h b/xc/programs/Xserver/GL/glx/glxfb.h index 9b6022591..98d7821fc 100644 --- a/xc/programs/Xserver/GL/glx/glxfb.h +++ b/xc/programs/Xserver/GL/glx/glxfb.h @@ -1,26 +1,41 @@ #ifndef _glxfb_h_ #define _glxfb_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxfb.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ extern void __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glximports.c b/xc/programs/Xserver/GL/glx/glximports.c index 2dc836571..933557371 100644 --- a/xc/programs/Xserver/GL/glx/glximports.c +++ b/xc/programs/Xserver/GL/glx/glximports.c @@ -1,28 +1,44 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glximports.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #include "glxserver.h" #include "glxcontext.h" #include "glximports.h" +#include "GL/glx_ansic.h" void *__glXImpMalloc(__GLcontext *gc, size_t size) { @@ -105,6 +121,11 @@ char *__glXImpGetenv(__GLcontext *gc, const char *var) return __glXGetenv(var); } +int __glXImpAtoi(__GLcontext *gc, const char *str) +{ + return __glXAtoi(str); +} + int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) { va_list ap; diff --git a/xc/programs/Xserver/GL/glx/glximports.h b/xc/programs/Xserver/GL/glx/glximports.h index b6a1580c7..6744a8c9d 100644 --- a/xc/programs/Xserver/GL/glx/glximports.h +++ b/xc/programs/Xserver/GL/glx/glximports.h @@ -1,26 +1,41 @@ #ifndef _glximports_h_ #define _glximports_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glximports.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ extern void *__glXImpMalloc(__GLcontext *gc, size_t size); @@ -32,6 +47,7 @@ extern void __glXImpWarning(__GLcontext *gc, char *msg); extern void __glXImpFatal(__GLcontext *gc, char *msg); extern char *__glXImpGetenv(__GLcontext *gc, const char *var); +extern int __glXImpAtoi(__GLcontext *gc, const char *str); extern int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...); extern void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode); diff --git a/xc/programs/Xserver/GL/glx/glxmem.c b/xc/programs/Xserver/GL/glx/glxmem.c index 52a60f848..6c9323f61 100644 --- a/xc/programs/Xserver/GL/glx/glxmem.c +++ b/xc/programs/Xserver/GL/glx/glxmem.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxmem.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxmem.h b/xc/programs/Xserver/GL/glx/glxmem.h index 1c208a2f5..7fd6cd59e 100644 --- a/xc/programs/Xserver/GL/glx/glxmem.h +++ b/xc/programs/Xserver/GL/glx/glxmem.h @@ -1,26 +1,41 @@ #ifndef _glxmem_h_ #define _glxmem_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxmem.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ extern void __glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glxpix.c b/xc/programs/Xserver/GL/glx/glxpix.c index 1383263bd..77cd21213 100644 --- a/xc/programs/Xserver/GL/glx/glxpix.c +++ b/xc/programs/Xserver/GL/glx/glxpix.c @@ -1,23 +1,39 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.2 1999/06/14 07:31:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxpix.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ /* @@ -67,8 +83,8 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { __GLPixBufferInfo *bufferInfo; - if (LookupIDByType((XID)buf->handle, __glXPixmapRes)) { - FreeResource((XID)buf->handle, FALSE); + if (LookupIDByType((XID)(long)buf->handle, __glXPixmapRes)) { + FreeResource((XID)(long)buf->handle, FALSE); buf->handle = NULL; } @@ -96,7 +112,7 @@ __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, buf->elementSize = ((bits-1) / 8) + 1; buf->elementSizeLog2 = __glFloorLog2(buf->elementSize); - buf->handle = (void *) glxpixmapId; + buf->handle = (void *)(long) glxpixmapId; pGlxPixmap->refcnt++; buf->resize = Resize; diff --git a/xc/programs/Xserver/GL/glx/glxpix.h b/xc/programs/Xserver/GL/glx/glxpix.h index 09a33a80a..ca5e3e038 100644 --- a/xc/programs/Xserver/GL/glx/glxpix.h +++ b/xc/programs/Xserver/GL/glx/glxpix.h @@ -1,26 +1,41 @@ #ifndef _glxpix_h_ #define _glxpix_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxpix.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ extern void __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glxscreens.c b/xc/programs/Xserver/GL/glx/glxscreens.c index d68bca06e..25d8ce478 100644 --- a/xc/programs/Xserver/GL/glx/glxscreens.c +++ b/xc/programs/Xserver/GL/glx/glxscreens.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.4 2000/06/17 00:03:12 martin Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.4 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxscreens.c,v 1.4 2001/01/08 16:21:41 nathanh Exp $ */ #ifdef IN_MODULE @@ -32,6 +47,15 @@ #include "glxserver.h" #include "glxutil.h" +static char GLServerExtensions[] = + "GL_ARB_multitexture " + "GL_ARB_imaging " + "GL_EXT_abgr " + "GL_EXT_blend_color " + "GL_EXT_blend_minmax " + "GL_EXT_blend_subtract " + ; + /* ** We have made the simplifying assuption that the same extensions are ** supported across all screens in a multi-screen system. @@ -41,7 +65,8 @@ static char GLXServerVersion[] = "1.2"; static char GLXServerExtensions[] = "GLX_EXT_visual_info " "GLX_EXT_visual_rating " - "GLX_EXT_import_context "; + "GLX_EXT_import_context " + ; /* ** This comes from the GL library that the server will link with. Right @@ -259,6 +284,7 @@ void __glXScreenInit(GLint numscreens) #else __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; #endif + __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); diff --git a/xc/programs/Xserver/GL/glx/glxscreens.h b/xc/programs/Xserver/GL/glx/glxscreens.h index 771ecf866..624bbd98a 100644 --- a/xc/programs/Xserver/GL/glx/glxscreens.h +++ b/xc/programs/Xserver/GL/glx/glxscreens.h @@ -1,30 +1,47 @@ #ifndef _GLX_screens_h_ #define _GLX_screens_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.2 1999/06/14 07:31:32 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxscreens.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #include "GL/internal/glcore.h" + + /* ** Screen dependent data. These methods are the interface between the DIX ** and DDX layers of the GLX server extension. The methods provide an @@ -58,6 +75,8 @@ typedef struct { GLint numVisuals; GLint numUsableVisuals; + char *GLextensions; + char *GLXvendor; char *GLXversion; char *GLXextensions; diff --git a/xc/programs/Xserver/GL/glx/glxserver.h b/xc/programs/Xserver/GL/glx/glxserver.h index 80a23ce1a..a04318eb7 100644 --- a/xc/programs/Xserver/GL/glx/glxserver.h +++ b/xc/programs/Xserver/GL/glx/glxserver.h @@ -1,26 +1,41 @@ #ifndef _GLX_server_h_ #define _GLX_server_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.2 1999/06/14 07:31:32 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxserver.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #include <X11/X.h> @@ -42,6 +57,7 @@ #undef abs #undef fabs +#define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include <GL/gl.h> #include <GL/glxproto.h> #include <GL/glxint.h> @@ -110,7 +126,7 @@ struct __GLXclientStateRec { */ GLbyte *returnBuf; GLint returnBufSize; - + /* ** Keep track of large rendering commands, which span multiple requests. */ @@ -127,7 +143,7 @@ struct __GLXclientStateRec { */ __GLXcontext **currentContexts; GLint numCurrentContexts; - + /* Back pointer to X client record */ ClientPtr client; @@ -168,7 +184,7 @@ typedef struct { } __GLXrenderSizeData; extern __GLXrenderSizeData __glXRenderSizeTable[]; extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; - + /************************************************************************/ /* @@ -215,6 +231,15 @@ extern void glxSwapQueryServerStringReply(ClientPtr client, * Routines for computing the size of variably-sized rendering commands. */ +extern int __glXTypeSize(GLenum enm); +extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLint rowLength, GLint skipRows, GLint alignment); +extern int __glXImage3DSize(GLenum format, GLenum type, + GLsizei w, GLsizei h, GLsizei d, + GLint imageHeight, GLint rowLength, + GLint skipImages, GLint skipRows, + GLint alignment); + extern int __glXCallListsReqSize(GLbyte *pc, Bool swap); extern int __glXBitmapReqSize(GLbyte *pc, Bool swap); extern int __glXFogfvReqSize(GLbyte *pc, Bool swap); @@ -242,10 +267,28 @@ extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap); extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap); extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap); extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap); -extern int __glXTypeSize(GLenum enm); extern int __glXDrawArraysSize(GLbyte *pc, Bool swap); extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap); extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap); extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap); +extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ); +extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap); + +/* + * Routines for computing the size of returned data. + */ +extern int __glXConvolutionParameterivSize(GLenum pname); +extern int __glXConvolutionParameterfvSize(GLenum pname); +extern int __glXColorTableParameterfvSize(GLenum pname); +extern int __glXColorTableParameterivSize(GLenum pname); #endif /* !__GLX_server_h__ */ diff --git a/xc/programs/Xserver/GL/glx/glxutil.c b/xc/programs/Xserver/GL/glx/glxutil.c index c5d33d604..4544447ec 100644 --- a/xc/programs/Xserver/GL/glx/glxutil.c +++ b/xc/programs/Xserver/GL/glx/glxutil.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxutil.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -29,6 +44,7 @@ #include <windowstr.h> #include "glxutil.h" #include "glxbuf.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -200,8 +216,12 @@ __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config) modes->greenMask = config->greenMask; modes->blueMask = config->blueMask; modes->alphaMask = config->alphaMask; +#if 0 modes->rgbBits = modes->redBits + modes->greenBits + modes->blueBits + modes->alphaBits; +#endif + assert( !modes->rgbMode || ((config->bufferSize & 0x7) == 0) ); + modes->rgbBits = config->bufferSize; modes->indexBits = config->bufferSize; modes->accumRedBits = config->accumRedSize; @@ -234,8 +254,6 @@ LockDP(__GLdrawablePrivate *glPriv, __GLcontext *gc) /* some pending state. Deal with it */ if (glxc->pendingState & __GLX_PENDING_RESIZE) { - __GLXdrawablePrivate *glxPriv = glxc->glxPriv; - glxc->pendingState &= ~__GLX_PENDING_RESIZE; (*glci->exports.notifyResize)(gc); diff --git a/xc/programs/Xserver/GL/glx/glxutil.h b/xc/programs/Xserver/GL/glx/glxutil.h index d074d77ce..8bf757672 100644 --- a/xc/programs/Xserver/GL/glx/glxutil.h +++ b/xc/programs/Xserver/GL/glx/glxutil.h @@ -1,26 +1,41 @@ #ifndef _glxcmds_h_ #define _glxcmds_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxutil.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ extern void __glXNop(void); diff --git a/xc/programs/Xserver/GL/glx/impsize.h b/xc/programs/Xserver/GL/glx/impsize.h index 597da569e..c1ab790f6 100644 --- a/xc/programs/Xserver/GL/glx/impsize.h +++ b/xc/programs/Xserver/GL/glx/impsize.h @@ -1,26 +1,41 @@ #ifndef _impsize_h_ #define _impsize_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/impsize.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ /* @@ -31,6 +46,10 @@ ** replicate the code in here. */ extern int __glCallLists_size(GLsizei n, GLenum type); +extern int __glColorTableParameterfv_size(GLenum pname); +extern int __glColorTableParameteriv_size(GLenum pname); +extern int __glConvolutionParameterfv_size(GLenum pname); +extern int __glConvolutionParameteriv_size(GLenum pname); extern int __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h); extern int __glFogfv_size(GLenum pname); extern int __glFogiv_size(GLenum pname); @@ -47,7 +66,6 @@ extern int __glTexGenfv_size(GLenum e); extern int __glTexGeniv_size(GLenum pname); extern int __glTexParameterfv_size(GLenum e); extern int __glTexParameteriv_size(GLenum e); - extern int __glEvalComputeK(GLenum target); #endif /* _impsize_h_ */ diff --git a/xc/programs/Xserver/GL/glx/render2.c b/xc/programs/Xserver/GL/glx/render2.c index 01a57411d..06cfcca84 100644 --- a/xc/programs/Xserver/GL/glx/render2.c +++ b/xc/programs/Xserver/GL/glx/render2.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/render2.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ /* #define NEED_REPLIES */ -#include "glxserver.h" +#include <glxserver.h> #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" extern GLint __glEvalComputeK(GLenum target); @@ -33,7 +49,7 @@ void __glXDisp_Map1f(GLbyte *pc) GLfloat u1, u2, *points; GLenum target; - target = *(GLenum *)(pc + 0); + target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); u1 = *(GLfloat *)(pc + 4); u2 = *(GLfloat *)(pc + 8); @@ -48,8 +64,8 @@ void __glXDisp_Map2f(GLbyte *pc) GLint uorder, vorder, ustride, vstride, k; GLfloat u1, u2, v1, v2, *points; GLenum target; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); u1 = *(GLfloat *)(pc + 4); @@ -169,7 +185,7 @@ void __glXDisp_DrawArrays(GLbyte *pc) GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); + stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); } pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); @@ -180,36 +196,36 @@ void __glXDisp_DrawArrays(GLbyte *pc) GLint numVals = compHeader[i].numVals; GLenum component = compHeader[i].component; - switch (component) { - case GL_VERTEX_ARRAY: + switch (component) { + case GL_VERTEX_ARRAY: glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: + break; + case GL_NORMAL_ARRAY: glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: + break; + case GL_COLOR_ARRAY: glEnableClientState(GL_COLOR_ARRAY); glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: + break; + case GL_INDEX_ARRAY: glEnableClientState(GL_INDEX_ARRAY); glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: + break; + case GL_TEXTURE_COORD_ARRAY: glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: + break; + case GL_EDGE_FLAG_ARRAY: glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - default: - break; + break; + default: + break; } - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); + pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); } glDrawArrays(primType, 0, numVertexes); @@ -222,3 +238,9 @@ void __glXDisp_DrawArrays(GLbyte *pc) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); } + +void __glXDisp_DrawArraysEXT(GLbyte *pc) +{ +#ifdef XXX_STUB +#endif /*XXX_STUB*/ +} diff --git a/xc/programs/Xserver/GL/glx/render2swap.c b/xc/programs/Xserver/GL/glx/render2swap.c index 040a24594..8e8c115a8 100644 --- a/xc/programs/Xserver/GL/glx/render2swap.c +++ b/xc/programs/Xserver/GL/glx/render2swap.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/render2swap.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ /* #define NEED_REPLIES */ #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" extern GLint __glEvalComputeK(GLenum target); @@ -363,3 +379,9 @@ void __glXDispSwap_DrawArrays(GLbyte *pc) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); } + +void __glXDispSwap_DrawArraysEXT(GLbyte *pc) +{ +#ifdef XXX_STUB +#endif /*XXX_STUB*/ +} diff --git a/xc/programs/Xserver/GL/glx/renderpix.c b/xc/programs/Xserver/GL/glx/renderpix.c index bbaab81a9..5474f4172 100644 --- a/xc/programs/Xserver/GL/glx/renderpix.c +++ b/xc/programs/Xserver/GL/glx/renderpix.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/renderpix.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/renderpix.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" void __glXDisp_PolygonStipple(GLbyte *pc) { @@ -48,12 +64,12 @@ void __glXDisp_Bitmap(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glBitmap((GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLfloat) hdr->xorig, - (GLfloat) hdr->yorig, + glBitmap((GLsizei) hdr->width, + (GLsizei) hdr->height, + (GLfloat) hdr->xorig, + (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, - (GLfloat) hdr->ymove, + (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } @@ -68,13 +84,13 @@ void __glXDisp_TexImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLint) hdr->border, - hdr->format, - hdr->type, + (GLint) hdr->border, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -89,17 +105,35 @@ void __glXDisp_TexImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLint) hdr->border, - hdr->format, + (GLsizei) hdr->height, + (GLint) hdr->border, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } +void __glXDisp_TexImage3D(GLbyte *pc) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, + hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + void __glXDisp_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -111,9 +145,9 @@ void __glXDisp_DrawPixels(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glDrawPixels((GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + glDrawPixels((GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } @@ -129,12 +163,12 @@ void __glXDisp_TexSubImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLsizei) hdr->width, - hdr->format, - hdr->type, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -149,13 +183,126 @@ void __glXDisp_TexSubImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLint) hdr->yoffset, - (GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + (GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } + +void __glXDisp_TexSubImage3D(GLbyte *pc) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, + hdr->zoffset, hdr->width, hdr->height, hdr->depth, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDisp_ColorTable(GLbyte *pc) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorTable(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_ColorSubTable(GLbyte *pc) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, + hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDisp_ConvolutionFilter1D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter1D(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_ConvolutionFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_SeparableFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + GLint hdrlen, image1len; + + hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE); + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + /* XXX check this usage - internal code called + ** a version without the packing parameters + */ + image1len = __glXImageSize(hdr->format, hdr->type, hdr->width, 1, + hdr->rowLength, hdr->skipRows, hdr->alignment); + image1len = __GLX_PAD(image1len); + + glSeparableFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); +} diff --git a/xc/programs/Xserver/GL/glx/renderpixswap.c b/xc/programs/Xserver/GL/glx/renderpixswap.c index 51e96844e..1fa7b2fc3 100644 --- a/xc/programs/Xserver/GL/glx/renderpixswap.c +++ b/xc/programs/Xserver/GL/glx/renderpixswap.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" void __glXDispSwap_PolygonStipple(GLbyte *pc) { @@ -53,26 +69,26 @@ void __glXDispSwap_Bitmap(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove); __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove); - + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glBitmap((GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLfloat) hdr->xorig, - (GLfloat) hdr->yorig, + glBitmap((GLsizei) hdr->width, + (GLsizei) hdr->height, + (GLfloat) hdr->xorig, + (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, - (GLfloat) hdr->ymove, + (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } @@ -85,7 +101,7 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); @@ -94,7 +110,7 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -106,13 +122,13 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLint) hdr->border, - hdr->format, - hdr->type, + (GLint) hdr->border, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -125,7 +141,7 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); @@ -134,7 +150,7 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -146,17 +162,60 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLint) hdr->border, - hdr->format, + (GLsizei) hdr->height, + (GLint) hdr->border, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } +void __glXDispSwap_TexImage3D(GLbyte *pc) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->border); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, + hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + void __glXDispSwap_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -166,12 +225,12 @@ void __glXDispSwap_DrawPixels(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -183,9 +242,9 @@ void __glXDispSwap_DrawPixels(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glDrawPixels((GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + glDrawPixels((GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } @@ -199,14 +258,14 @@ void __glXDispSwap_TexSubImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -218,12 +277,12 @@ void __glXDispSwap_TexSubImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLsizei) hdr->width, - hdr->format, - hdr->type, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -236,7 +295,7 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); @@ -245,7 +304,7 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -257,13 +316,236 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLint) hdr->yoffset, - (GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + (GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } + +void __glXDispSwap_TexSubImage3D(GLbyte *pc) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->zoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, + hdr->zoffset, hdr->width, hdr->height, hdr->depth, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ColorTable(GLbyte *pc) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorTable(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ColorSubTable(GLbyte *pc) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->start); + __GLX_SWAP_INT((GLbyte *)&hdr->count); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, + hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, 1, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_SeparableFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + GLint hdrlen, image1len; + __GLX_DECLARE_SWAP_VARIABLES; + + hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + /* XXX check this usage - internal code called + ** a version without the packing parameters + */ + image1len = __glXImageSize(hdr->format, hdr->type, hdr->width, 1, + hdr->rowLength, hdr->skipRows, hdr->alignment); + image1len = __GLX_PAD(image1len); + + + glSeparableFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); +} diff --git a/xc/programs/Xserver/GL/glx/rensize.c b/xc/programs/Xserver/GL/glx/rensize.c index 484a16eab..f11d4a126 100644 --- a/xc/programs/Xserver/GL/glx/rensize.c +++ b/xc/programs/Xserver/GL/glx/rensize.c @@ -1,28 +1,43 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/rensize.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ -#include "glxserver.h" #include <GL/gl.h> -#include <GL/glxproto.h> +#include "glxserver.h" +#include "GL/glxproto.h" #include "unpack.h" #include "impsize.h" @@ -64,7 +79,7 @@ int __glXLightfvReqSize(GLbyte *pc, Bool swap ) } return 4 * __glLightfv_size( pname ); /* defined in samplegl lib */ } - + int __glXLightivReqSize(GLbyte *pc, Bool swap ) { return __glXLightfvReqSize( pc, swap ); @@ -159,7 +174,7 @@ int __glXMap1dReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint order, k; - + target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); if (swap) { @@ -174,8 +189,8 @@ int __glXMap1fReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint order, k; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); if (swap) { target = SWAPL( target ); @@ -195,7 +210,7 @@ int __glXMap2dReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint uorder, vorder, k; - + target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); vorder = *(GLint *)(pc + 40); @@ -212,8 +227,8 @@ int __glXMap2fReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint uorder, vorder, k; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); if (swap) { @@ -250,19 +265,19 @@ int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap ) return 2 * mapsize; } -static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, - GLint rowLength, GLint skipRows, GLint alignment ) +int __glXImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, + GLint rowLength, GLint skipRows, GLint alignment ) { GLint bytesPerElement, elementsPerGroup, groupsPerRow; GLint groupSize, rowSize, padding; - + if (w < 0 || h < 0 || (type == GL_BITMAP && (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { return -1; } if (w==0 || h==0) return 0; - + if (type == GL_BITMAP) { if (rowLength > 0) { groupsPerRow = rowLength; @@ -276,23 +291,117 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, } return ((h + skipRows) * rowSize); } else { + switch(format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + elementsPerGroup = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elementsPerGroup = 1; + break; + case GL_LUMINANCE_ALPHA: + elementsPerGroup = 2; + break; + case GL_RGB: + case GL_BGR: + elementsPerGroup = 3; + break; + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + elementsPerGroup = 4; + break; + default: + return -1; + } switch(type) { case GL_UNSIGNED_BYTE: case GL_BYTE: bytesPerElement = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + bytesPerElement = 1; + elementsPerGroup = 1; + break; case GL_UNSIGNED_SHORT: case GL_SHORT: bytesPerElement = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + bytesPerElement = 2; + elementsPerGroup = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: bytesPerElement = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + bytesPerElement = 4; + elementsPerGroup = 1; + break; default: return -1; } + groupSize = bytesPerElement * elementsPerGroup; + if (rowLength > 0) { + groupsPerRow = rowLength; + } else { + groupsPerRow = w; + } + rowSize = groupsPerRow * groupSize; + padding = (rowSize % alignment); + if (padding) { + rowSize += alignment - padding; + } + return ((h + skipRows) * rowSize); + } +} + +/* XXX + * This should be folded into __glXImageSize(). + */ +int __glXImage3DSize( GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d, GLint imageHeight, GLint rowLength, + GLint skipImages, GLint skipRows, GLint alignment ) +{ + GLint bytesPerElement, elementsPerGroup, groupsPerRow; + GLint groupSize, rowSize, padding, imageSize; + + if (w < 0 || h < 0 || d < 0 || + (type == GL_BITMAP && + (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { + return -1; + } + if (w==0 || h==0 || d == 0) return 0; + + if (type == GL_BITMAP) { + if (rowLength > 0) { + groupsPerRow = rowLength; + } else { + groupsPerRow = w; + } + rowSize = (groupsPerRow + 7) >> 3; + padding = (rowSize % alignment); + if (padding) { + rowSize += alignment - padding; + } + return ((h + skipRows) * rowSize); + } else { switch(format) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: @@ -310,15 +419,55 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, elementsPerGroup = 2; break; case GL_RGB: + case GL_BGR: elementsPerGroup = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elementsPerGroup = 4; break; default: return -1; } + switch(type) { + case GL_UNSIGNED_BYTE: + case GL_BYTE: + bytesPerElement = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + bytesPerElement = 1; + elementsPerGroup = 1; + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + bytesPerElement = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + bytesPerElement = 2; + elementsPerGroup = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + bytesPerElement = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + bytesPerElement = 4; + elementsPerGroup = 1; + break; + default: + return -1; + } groupSize = bytesPerElement * elementsPerGroup; if (rowLength > 0) { groupsPerRow = rowLength; @@ -330,10 +479,16 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, if (padding) { rowSize += alignment - padding; } - return ((h + skipRows) * rowSize); + if (imageHeight > 0) { + imageSize = (imageHeight + skipRows) * rowSize; + } else { + imageSize = (h + skipRows) * rowSize; + } + return ((d + skipImages) * imageSize); } } + int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -350,11 +505,11 @@ int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); - rowLength = SWAPL( rowLength ); + rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); } int __glXBitmapReqSize(GLbyte *pc, Bool swap ) @@ -369,11 +524,11 @@ int __glXBitmapReqSize(GLbyte *pc, Bool swap ) if (swap) { w = SWAPL( w ); h = SWAPL( h ); - rowLength = SWAPL( rowLength ); + rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( GL_COLOR_INDEX, GL_BITMAP, w, h, + return __glXImageSize( GL_COLOR_INDEX, GL_BITMAP, w, h, rowLength, skipRows, alignment ); } @@ -402,7 +557,7 @@ int __glXTexImage1DReqSize(GLbyte *pc, Bool swap ) } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } - return ImageSize( format, type, w, 1, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, 1, rowLength, skipRows, alignment ); } int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) @@ -432,20 +587,21 @@ int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); } +/* XXX this is used elsewhere - should it be exported from glxserver.h? */ int __glXTypeSize(GLenum enm) { switch(enm) { - case GL_BYTE: return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: return sizeof(GLubyte); - case GL_SHORT: return sizeof(GLshort); - case GL_UNSIGNED_SHORT: return sizeof(GLushort); - case GL_INT: return sizeof(GLint); - case GL_UNSIGNED_INT: return sizeof(GLint); - case GL_FLOAT: return sizeof(GLfloat); - case GL_DOUBLE: return sizeof(GLdouble); + case GL_BYTE: return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: return sizeof(GLubyte); + case GL_SHORT: return sizeof(GLshort); + case GL_UNSIGNED_SHORT: return sizeof(GLushort); + case GL_INT: return sizeof(GLint); + case GL_UNSIGNED_INT: return sizeof(GLint); + case GL_FLOAT: return sizeof(GLfloat); + case GL_DOUBLE: return sizeof(GLdouble); default: return -1; } } @@ -478,32 +634,32 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) component = SWAPL( component ); } - switch (component) { - case GL_VERTEX_ARRAY: - case GL_COLOR_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - break; - case GL_NORMAL_ARRAY: - if (numVals != 3) { + switch (component) { + case GL_VERTEX_ARRAY: + case GL_COLOR_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + break; + case GL_NORMAL_ARRAY: + if (numVals != 3) { /* bad size */ - return -1; - } + return -1; + } break; - case GL_INDEX_ARRAY: - if (numVals != 1) { + case GL_INDEX_ARRAY: + if (numVals != 1) { /* bad size */ - return -1; - } - break; - case GL_EDGE_FLAG_ARRAY: - if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) { + return -1; + } + break; + case GL_EDGE_FLAG_ARRAY: + if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) { /* bad size or bad type */ return -1; - } - break; - default: - /* unknown component type */ - return -1; + } + break; + default: + /* unknown component type */ + return -1; } arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype)); @@ -512,7 +668,7 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) } return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) + - (numVertexes * arrayElementSize)); + (numVertexes * arrayElementSize)); } int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap ) @@ -541,7 +697,7 @@ int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap ) skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, 1, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, 1, rowLength, skipRows, alignment ); } int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) @@ -565,5 +721,280 @@ int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); +} + +int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint d = hdr->depth; + GLint imageHeight = hdr->imageHeight; + GLint rowLength = hdr->rowLength; + GLint skipImages = hdr->skipImages; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + GLint nullImage = hdr->nullimage; + + if (swap) { + target = SWAPL( target ); + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + d = SWAPL( d ); + imageHeight = SWAPL( imageHeight ); + rowLength = SWAPL( rowLength ); + skipImages = SWAPL( skipImages ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + if (target == GL_PROXY_TEXTURE_3D || nullImage) { + return 0; + } else { + return __glXImage3DSize( format, type, w, h, d, imageHeight, + rowLength, skipImages, skipRows, + alignment); + } +} + +int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint d = hdr->depth; + GLint imageHeight = hdr->imageHeight; + GLint rowLength = hdr->rowLength; + GLint skipImages = hdr->skipImages; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + + if (swap) { + target = SWAPL( target ); + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + d = SWAPL( d ); + imageHeight = SWAPL( imageHeight ); + rowLength = SWAPL( rowLength ); + skipImages = SWAPL( skipImages ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + if (target == GL_PROXY_TEXTURE_3D) { + return 0; + } else { + return __glXImage3DSize( format, type, w, h, d, imageHeight, + rowLength, skipImages, skipRows, + alignment); + } +} + +int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); +} + +int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint rowLength = hdr->rowLength; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + rowLength = SWAPL( rowLength ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, h, rowLength, skipRows, alignment ); +} + +int __glXConvolutionParameterivSize(GLenum pname) +{ + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + case GL_CONVOLUTION_BORDER_MODE: + return 1; + default: + return -1; + } +} + +int __glXConvolutionParameterfvSize(GLenum pname) +{ + return __glXConvolutionParameterivSize(pname); +} + +int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap ) +{ + GLenum pname = *(GLenum *)(pc + 4); + if (swap) { + pname = SWAPL( pname ); + } + return 4 * __glXConvolutionParameterivSize( pname ); +} + +int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap ) +{ + return __glXConvolutionParameterivReqSize( pc, swap ); +} + +int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLint image1size, image2size; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + /* XXX Should rowLength be used for either or both image? */ + image1size = __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); + image1size = __GLX_PAD(image1size); + image2size = __glXImageSize ( format, type, h, 1, rowLength, 0, alignment ); + return image1size + image2size; + +} + +int __glXColorTableParameterfvSize(GLenum pname) +{ + /* currently, only scale and bias are supported; return RGBA */ + switch(pname) { + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return 0; + } +} + +int __glXColorTableParameterivSize(GLenum pname) +{ + /* fv and iv are the same in this context */ + return __glXColorTableParameterfvSize(pname); +} + +int __glXColorTableReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + switch (target) { + case GL_PROXY_TEXTURE_1D: + case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_3D: + case GL_PROXY_COLOR_TABLE: + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + return 0; + } + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); +} + +int __glXColorSubTableReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint count = hdr->count; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + count = SWAPL( count ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, count, 1, rowLength, 0, alignment ); +} + +int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap ) +{ + GLenum pname = *(GLenum *)(pc + 4); + if (swap) { + pname = SWAPL( pname ); + } + return 4 * __glXColorTableParameterfvSize(pname); +} + +int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap ) +{ + /* no difference between fv and iv versions */ + return __glXColorTableParameterfvReqSize(pc, swap); } diff --git a/xc/programs/Xserver/GL/glx/rensizetab.c b/xc/programs/Xserver/GL/glx/rensizetab.c index 229fa3c30..3fd014ae4 100644 --- a/xc/programs/Xserver/GL/glx/rensizetab.c +++ b/xc/programs/Xserver/GL/glx/rensizetab.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/rensizetab.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #include "glxserver.h" @@ -216,14 +231,2058 @@ __GLXrenderSizeData __glXRenderSizeTable[] = { /* Translatef */ { 16, 0 }, /* Viewport */ { 20, 0 }, /* PolygonOffset */ { 12, 0 }, - /* DrawArrays */ { 16, __glXDrawArraysSize }, + /* no such opcode */ { 0, 0 }, /* Indexubv */ { 8, 0 }, + /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, + /* CopyColorSubTable */ { 24, 0 }, + /* ActiveTextureARB */ { 8, 0 }, + /* MultiTexCoord1dvARB */ { 16, 0 }, + /* MultiTexCoord1fvARB */ { 12, 0 }, + /* MultiTexCoord1ivARB */ { 12, 0 }, + /* MultiTexCoord1svARB */ { 12, 0 }, + /* MultiTexCoord2dvARB */ { 24, 0 }, + /* MultiTexCoord2fvARB */ { 16, 0 }, + /* MultiTexCoord2ivARB */ { 16, 0 }, + /* MultiTexCoord2svARB */ { 12, 0 }, + /* MultiTexCoord3dvARB */ { 32, 0 }, + /* MultiTexCoord3fvARB */ { 20, 0 }, + /* MultiTexCoord3ivARB */ { 20, 0 }, + /* MultiTexCoord3svARB */ { 16, 0 }, + /* MultiTexCoord4dvARB */ { 40, 0 }, + /* MultiTexCoord4fvARB */ { 24, 0 }, + /* MultiTexCoord4ivARB */ { 24, 0 }, + /* MultiTexCoord4svARB */ { 16, 0 }, }; __GLXrenderSizeData __glXRenderSizeTable_EXT[] = { - /* PolygonOffset */ { 12, 0 }, - /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize }, - /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize }, - /* no such opcode */ { 0, 0 }, + /* ColorTable */ { 44, __glXColorTableReqSize }, + /* ColorTableParameterfv */ { 12, __glXColorTableParameterfvReqSize }, + /* ColorTableParameteriv */ { 12, __glXColorTableParameterivReqSize }, + /* CopyColorTable */ { 24, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, @@ -238,11 +2297,32 @@ __GLXrenderSizeData __glXRenderSizeTable_EXT[] = { /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, + /* BlendColor */ { 20, 0 }, + /* BlendEquation */ { 8, 0 }, /* no such opcode */ { 0, 0 }, + /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize }, + /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize }, + /* ConvolutionFilter1D */ { 48, __glXConvolutionFilter1DReqSize }, + /* ConvolutionFilter2D */ { 48, __glXConvolutionFilter2DReqSize }, + /* ConvolutionParameterf */ { 16, 0 }, + /* ConvolutionParameterfv */ { 12, __glXConvolutionParameterfvReqSize }, + /* ConvolutionParameteri */ { 16, 0 }, + /* ConvolutionParameteriv */ { 12, __glXConvolutionParameterivReqSize }, + /* CopyConvolutionFilter1D */ { 24, }, + /* CopyConvolutionFilter2D */ { 28, }, + /* SeparableFilter2D */ { 48, __glXSeparableFilter2DReqSize }, + /* Histogram */ { 20, }, + /* Minmax */ { 16, }, + /* ResetHistogram */ { 8, }, + /* ResetMinmax */ { 8, }, + /* TexImage3D */ { 84, __glXTexImage3DReqSize }, + /* TexSubImage3D */ { 92, __glXTexSubImage3DReqSize }, + /* DrawArrays */ { 16, __glXDrawArraysSize }, /* BindTexture */ { 12, 0 }, /* PrioritizeTextures */ { 8, __glXPrioritizeTexturesReqSize }, /* CopyTexImage1D */ { 32, 0 }, /* CopyTexImage2D */ { 36, 0 }, /* CopyTexSubImage1D */ { 28, 0 }, /* CopyTexSubImage2D */ { 36, 0 }, + /* CopyTexSubImage3D */ { 40, 0 }, }; diff --git a/xc/programs/Xserver/GL/glx/single2.c b/xc/programs/Xserver/GL/glx/single2.c index d62c22a1b..a748f89d0 100644 --- a/xc/programs/Xserver/GL/glx/single2.c +++ b/xc/programs/Xserver/GL/glx/single2.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/single2.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" +#include "GL/glx_ansic.h" int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { @@ -186,7 +202,6 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; - ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -282,10 +297,9 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) __GLXcontext *cx; GLenum name; const char *string; - GLint length; int error; - GLubyte *answer; - char *buf; + char *buf = NULL, *buf1 = NULL; + GLint length = 0; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -297,26 +311,32 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) string = (const char *)glGetString(name); client = cl->client; - if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) { - buf = __glXcombine_strings(string, + /* + ** Restrict extensions to those that are supported by both the + ** implementation and the connection. That is, return the + ** intersection of client, server, and core extension strings. + */ + if (name == GL_EXTENSIONS) { + buf1 = __glXcombine_strings(string, cl->GLClientextensions); - } else { - buf = __glXMalloc(__glXStrlen(string) + 2); - __glXStrcpy(buf, string); + buf = __glXcombine_strings(buf1, + cx->pGlxScreen->GLextensions); + if (buf1 != NULL) { + __glXFree(buf1); + } + string = buf; } - if (!buf) { - length = 0; - __GLX_BEGIN_REPLY(0); - __GLX_PUT_SIZE(0); - } else { - length = __glXStrlen((const char *) buf) + 1; - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); + if (string) { + length = __glXStrlen((const char *) string) + 1; } + __GLX_BEGIN_REPLY(length); + __GLX_PUT_SIZE(length); __GLX_SEND_HEADER(); - WriteToClient(client, length, buf); - __glXFree(buf); + WriteToClient(client, length, (char *) string); + if (buf != NULL) { + __glXFree(buf); + } return Success; } diff --git a/xc/programs/Xserver/GL/glx/single2swap.c b/xc/programs/Xserver/GL/glx/single2swap.c index 3aa1af0f7..41878b22e 100644 --- a/xc/programs/Xserver/GL/glx/single2swap.c +++ b/xc/programs/Xserver/GL/glx/single2swap.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/single2swap.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" +#include "GL/glx_ansic.h" int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { @@ -251,11 +267,11 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) __GLXcontext *cx; GLenum name; const char *string; - GLint length; __GLX_DECLARE_SWAP_VARIABLES; int error; GLubyte *answer; - char *buf; + char *buf = NULL, *buf1 = NULL; + GLint length = 0; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -269,28 +285,35 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) string = (const char *)glGetString(name); client = cl->client; - if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) { - buf = __glXcombine_strings(string, + /* + ** Restrict extensions to those that are supported by both the + ** implementation and the connection. That is, return the + ** intersection of client, server, and core extension strings. + */ + if (name == GL_EXTENSIONS) { + buf1 = __glXcombine_strings(string, cl->GLClientextensions); - } else { - buf = __glXMalloc(__glXStrlen(string) + 2); - __glXStrcpy(buf, string); + buf = __glXcombine_strings(buf1, + cx->pGlxScreen->GLextensions); + if (buf1 != NULL) { + __glXFree(buf1); + } + string = buf; } - if (!buf) { - length = 0; - __GLX_BEGIN_REPLY(0); - __GLX_PUT_SIZE(0); - } else { - length = __glXStrlen((const char *) buf) + 1; - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); + if (string) { + length = __glXStrlen((const char *) string) + 1; } - + + __GLX_BEGIN_REPLY(length); + __GLX_PUT_SIZE(length); + __GLX_SWAP_REPLY_SIZE(); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); - WriteToClient(client, length, buf); - __glXFree(buf); + WriteToClient(client, length, (char *) string); + if (buf != NULL) { + __glXFree(buf); + } return Success; } diff --git a/xc/programs/Xserver/GL/glx/singlepix.c b/xc/programs/Xserver/GL/glx/singlepix.c index 830bdd50c..0e609ddc4 100644 --- a/xc/programs/Xserver/GL/glx/singlepix.c +++ b/xc/programs/Xserver/GL/glx/singlepix.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepix.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlepix.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) { @@ -57,7 +73,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glReadPixels( + glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), @@ -87,7 +103,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; - GLint width=0, height=0; + GLint width=0, height=0, depth=1; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -100,20 +116,23 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) type = *(GLenum *)(pc + 12); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 16); - + glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); + if ( target == GL_TEXTURE_3D) { + glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); + } /* - * The two queries above might fail if we're in a state where queries - * are illegal, but then width and height would still be zero anyway. + * The three queries above might fail if we're in a state where queries + * are illegal, but then width, height, and depth would still be zero anyway. */ - compsize = __glGetTexImage_size(target,level,format,type,width,height); + compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) compsize = 0; - + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glGetTexImage( + glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), @@ -128,6 +147,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; + ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } @@ -147,17 +167,18 @@ int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) if (!cx) { return error; } + pc += __GLX_SINGLE_HDR_SIZE; lsbFirst = *(GLboolean *)(pc + 0); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); - + __glXClearErrorOccured(); - glGetPolygonStipple( + glGetPolygonStipple( (GLubyte *) answer ); - + if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); @@ -169,4 +190,270 @@ int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize, compsize2; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + /* target must be SEPARABLE_2D, however I guess we can let the GL + barf on this one.... */ + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); + + if (compsize < 0) compsize = 0; + if (compsize2 < 0) compsize2 = 0; + compsize = __GLX_PAD(compsize); + compsize2 = __GLX_PAD(compsize2); + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __glXClearErrorOccured(); + glGetSeparableFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer, + answer + compsize, + NULL + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize + compsize2); + ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; + ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize + compsize2); + } + + return Success; +} + +int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + if (target == GL_CONVOLUTION_1D) { + height = 1; + } else { + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + } + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,height,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetConvolutionFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; + ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetHistogram( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetHistogramReply *)&__glXReply)->width = width; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + compsize = __glGetTexImage_size(target,1,format,type,2,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetMinmax( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + target = *(GLenum *)(pc + 0); + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + swapBytes = *(GLboolean *)(pc + 12); + + glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetColorTableReply *)&__glXReply)->width = width; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} diff --git a/xc/programs/Xserver/GL/glx/singlepixswap.c b/xc/programs/Xserver/GL/glx/singlepixswap.c index 39ca57ef4..257e60e0f 100644 --- a/xc/programs/Xserver/GL/glx/singlepixswap.c +++ b/xc/programs/Xserver/GL/glx/singlepixswap.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) { @@ -66,7 +82,7 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glReadPixels( + glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), @@ -99,7 +115,7 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; - GLint width=0, height=0; + GLint width=0, height=0, depth=1; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -121,17 +137,20 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); + if ( target == GL_TEXTURE_3D) { + glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); + } /* - * The two queries above might fail if we're in a state where queries - * are illegal, but then width and height would still be zero anyway. + * The three queries above might fail if we're in a state where queries + * are illegal, but then width, height, and depth would still be zero anyway. */ - compsize = __glGetTexImage_size(target,level,format,type,width,height); + compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) compsize = 0; - + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glGetTexImage( + glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), @@ -148,8 +167,10 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); + __GLX_SWAP_INT(&depth); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; + ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } @@ -176,9 +197,9 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); - + __glXClearErrorOccured(); - glGetPolygonStipple( + glGetPolygonStipple( (GLubyte *) answer ); if (__glXErrorOccured()) { @@ -193,3 +214,302 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) } return Success; } + +int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize, compsize2; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + /* target must be SEPARABLE_2D, however I guess we can let the GL + barf on this one.... */ + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); + + if (compsize < 0) compsize = 0; + if (compsize2 < 0) compsize2 = 0; + compsize = __GLX_PAD(compsize); + compsize2 = __GLX_PAD(compsize2); + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __glXClearErrorOccured(); + glGetSeparableFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer, + answer + compsize, + NULL + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize + compsize2); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + __GLX_SWAP_INT(&height); + ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; + ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; + __GLX_SEND_VOID_ARRAY(compsize + compsize2); + } + + return Success; +} + +int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + if (target == GL_CONVOLUTION_2D) { + height = 1; + } else { + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + } + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,height,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetConvolutionFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + __GLX_SWAP_INT(&height); + ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; + ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetHistogram( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + ((xGLXGetHistogramReply *)&__glXReply)->width = width; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + compsize = __glGetTexImage_size(target,1,format,type,2,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetMinmax( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + ((xGLXGetColorTableReply *)&__glXReply)->width = width; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} diff --git a/xc/programs/Xserver/GL/glx/singlesize.c b/xc/programs/Xserver/GL/glx/singlesize.c index 1cff4c3a7..f530b64cb 100644 --- a/xc/programs/Xserver/GL/glx/singlesize.c +++ b/xc/programs/Xserver/GL/glx/singlesize.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.2 1999/06/14 07:31:35 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlesize.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #include <GL/gl.h> @@ -34,8 +49,8 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) { GLint elements, esize; GLint rowsize, padding; - - if (w < 0 || h < 0) { + + if (w < 0 || h < 0) { return -1; } switch (format) { @@ -55,9 +70,11 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) elements = 2; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; @@ -71,7 +88,7 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) */ switch (type) { case GL_BITMAP: - if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { + if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { rowsize = ((w * elements)+7)/8; padding = rowsize % 4; if (padding) { @@ -85,15 +102,36 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return -1; } @@ -151,11 +189,10 @@ GLint __glGetTexParameterfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_WRAP_S: - return 1; case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: return 1; case GL_TEXTURE_MIN_FILTER: - return 1; case GL_TEXTURE_MAG_FILTER: return 1; case GL_TEXTURE_BORDER_COLOR: @@ -163,7 +200,12 @@ GLint __glGetTexParameterfv_size(GLenum pname) case GL_TEXTURE_PRIORITY: return 1; case GL_TEXTURE_RESIDENT: - return 1; + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; default: return -1; @@ -184,7 +226,7 @@ GLint __glGetLightfv_size(GLenum pname) return 4; case GL_SPECULAR: return 4; - case GL_POSITION: + case GL_POSITION: return 4; case GL_SPOT_DIRECTION: return 3; @@ -236,7 +278,7 @@ static GLint EvalComputeK(GLenum target) } return 0; } - + GLint __glGetMap_size(GLenum target, GLenum query) { GLint k, order=0, majorMinor[2]; @@ -342,7 +384,7 @@ GLint __glGetPixelMap_size(GLenum map) { GLint size; GLenum query; - + switch (map) { case GL_PIXEL_MAP_I_TO_I: query = GL_PIXEL_MAP_I_TO_I_SIZE; @@ -454,9 +496,13 @@ GLint __glGet_size(GLenum sq) case GL_POINT_SIZE: return 1; case GL_POINT_SIZE_RANGE: + /* case GL_SMOOTH_POINT_SIZE_RANGE: */ /* alias */ return 2; case GL_POINT_SIZE_GRANULARITY: + /* case GL_SMOOTH_POINT_SIZE_GRANULARITY: */ /* alias */ return 1; + case GL_ALIASED_POINT_SIZE_RANGE: + return 2; case GL_POINT_SMOOTH: return 1; case GL_LINE_SMOOTH: @@ -464,9 +510,13 @@ GLint __glGet_size(GLenum sq) case GL_LINE_WIDTH: return 1; case GL_LINE_WIDTH_RANGE: + /* case GL_SMOOTH_LINE_WIDTH_RANGE: */ /* alias */ return 2; case GL_LINE_WIDTH_GRANULARITY: + /* case GL_SMOOTH_LINE_WIDTH_GRANULARITY: */ /* alias */ return 1; + case GL_ALIASED_LINE_WIDTH_RANGE: + return 2; case GL_LINE_STIPPLE_PATTERN: return 1; case GL_LINE_STIPPLE_REPEAT: @@ -495,6 +545,8 @@ GLint __glGet_size(GLenum sq) return 1; case GL_LIGHT_MODEL_AMBIENT: return 4; + case GL_LIGHT_MODEL_COLOR_CONTROL: + return 1; case GL_COLOR_MATERIAL: return 1; case GL_COLOR_MATERIAL_FACE: @@ -637,10 +689,14 @@ GLint __glGet_size(GLenum sq) return 1; case GL_PACK_ROW_LENGTH: return 1; + case GL_PACK_IMAGE_HEIGHT: + return 1; case GL_PACK_SKIP_ROWS: return 1; case GL_PACK_SKIP_PIXELS: return 1; + case GL_PACK_SKIP_IMAGES: + return 1; case GL_PACK_ALIGNMENT: return 1; case GL_UNPACK_SWAP_BYTES: @@ -649,10 +705,14 @@ GLint __glGet_size(GLenum sq) return 1; case GL_UNPACK_ROW_LENGTH: return 1; + case GL_UNPACK_IMAGE_HEIGHT: + return 1; case GL_UNPACK_SKIP_ROWS: return 1; case GL_UNPACK_SKIP_PIXELS: return 1; + case GL_UNPACK_SKIP_IMAGES: + return 1; case GL_UNPACK_ALIGNMENT: return 1; case GL_MAP_COLOR: @@ -678,11 +738,11 @@ GLint __glGet_size(GLenum sq) case GL_ZOOM_X: case GL_ZOOM_Y: return 1; - case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: - case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: - case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: - case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: - case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: + case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: + case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: + case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: + case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: + case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: return 1; case GL_MAX_EVAL_ORDER: return 1; @@ -731,17 +791,18 @@ GLint __glGet_size(GLenum sq) return 2; case GL_TEXTURE_1D: case GL_TEXTURE_2D: + case GL_TEXTURE_3D: return 1; case GL_NAME_STACK_DEPTH: return 1; case GL_MAX_VIEWPORT_DIMS: - return 2; + return 2; case GL_DOUBLEBUFFER: - return 1; + return 1; case GL_AUX_BUFFERS: - return 1; + return 1; case GL_STEREO: - return 1; + return 1; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: @@ -774,14 +835,56 @@ GLint __glGet_size(GLenum sq) return 1; case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: return 1; - case GL_BLEND_COLOR_EXT: + case GL_BLEND_COLOR: return 4; - case GL_BLEND_EQUATION_EXT: + case GL_BLEND_EQUATION: + return 1; + case GL_COLOR_MATRIX: + return 16; + case GL_COLOR_MATRIX_STACK_DEPTH: + return 1; + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + case GL_CONVOLUTION_1D: + case GL_CONVOLUTION_2D: + case GL_SEPARABLE_2D: + case GL_HISTOGRAM: + case GL_MINMAX: return 1; case GL_POLYGON_OFFSET_FACTOR: case GL_POLYGON_OFFSET_UNITS: return 1; + case GL_POST_CONVOLUTION_RED_SCALE: + case GL_POST_CONVOLUTION_GREEN_SCALE: + case GL_POST_CONVOLUTION_BLUE_SCALE: + case GL_POST_CONVOLUTION_ALPHA_SCALE: + case GL_POST_CONVOLUTION_RED_BIAS: + case GL_POST_CONVOLUTION_GREEN_BIAS: + case GL_POST_CONVOLUTION_BLUE_BIAS: + case GL_POST_CONVOLUTION_ALPHA_BIAS: + return 1; + case GL_POST_COLOR_MATRIX_RED_SCALE: + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + case GL_POST_COLOR_MATRIX_RED_BIAS: + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + return 1; + case GL_RESCALE_NORMAL: + return 1; + case GL_ACTIVE_TEXTURE_ARB: + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + case GL_MAX_TEXTURE_UNITS_ARB: + return 1; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH: + case GL_MAX_CONVOLUTION_WIDTH: + case GL_MAX_CONVOLUTION_HEIGHT: + return 1; default: return -1; } @@ -812,6 +915,7 @@ GLint __glGetTexLevelParameterfv_size(GLenum pname) switch (pname) { case GL_TEXTURE_WIDTH: case GL_TEXTURE_HEIGHT: + case GL_TEXTURE_DEPTH: case GL_TEXTURE_COMPONENTS: case GL_TEXTURE_BORDER: case GL_TEXTURE_RED_SIZE: @@ -832,17 +936,19 @@ GLint __glGetTexLevelParameteriv_size(GLenum pname) } GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, - GLenum type, GLint width, GLint height) + GLenum type, GLint width, GLint height, GLint depth) { GLint elements, esize; GLint padding, rowsize; switch (format) { case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RED: @@ -863,15 +969,36 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return -1; } @@ -885,5 +1012,95 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, if (padding) { rowsize += 4 - padding; } - return (rowsize * height); + return (rowsize * height * depth); } + +GLint __glGetConvolutionParameteriv_size(GLenum pname) +{ + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + case GL_CONVOLUTION_BORDER_MODE: + case GL_CONVOLUTION_FORMAT: + case GL_CONVOLUTION_WIDTH: + case GL_CONVOLUTION_HEIGHT: + case GL_MAX_CONVOLUTION_WIDTH: + case GL_MAX_CONVOLUTION_HEIGHT: + return 1; + default: + return -1; + } +} + +GLint __glGetConvolutionParameterfv_size(GLenum pname) +{ + return __glGetConvolutionParameteriv_size(pname); +} + + +GLint __glGetHistogramParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_HISTOGRAM_WIDTH: + case GL_HISTOGRAM_FORMAT: + case GL_HISTOGRAM_RED_SIZE: + case GL_HISTOGRAM_GREEN_SIZE: + case GL_HISTOGRAM_BLUE_SIZE: + case GL_HISTOGRAM_ALPHA_SIZE: + case GL_HISTOGRAM_LUMINANCE_SIZE: + case GL_HISTOGRAM_SINK: + return 1; + default: + return -1; + } +} + +GLint __glGetHistogramParameteriv_size(GLenum pname) +{ + return __glGetHistogramParameterfv_size(pname); +} + +GLint __glGetMinmaxParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_MINMAX_FORMAT: + case GL_MINMAX_SINK: + return 1; + default: + return -1; + } +} + +GLint __glGetMinmaxParameteriv_size(GLenum pname) +{ + return __glGetMinmaxParameterfv_size(pname); +} + +GLint __glGetColorTableParameterfv_size(GLenum pname) +{ + switch(pname) { + + case GL_COLOR_TABLE_SCALE: /* return RGBA */ + case GL_COLOR_TABLE_BIAS: + return 4; + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + default: + return 0; + } +} + +GLint __glGetColorTableParameteriv_size(GLenum pname) +{ + return __glGetColorTableParameterfv_size(pname); +} + diff --git a/xc/programs/Xserver/GL/glx/singlesize.h b/xc/programs/Xserver/GL/glx/singlesize.h index 97381639a..ce176ab07 100644 --- a/xc/programs/Xserver/GL/glx/singlesize.h +++ b/xc/programs/Xserver/GL/glx/singlesize.h @@ -1,26 +1,41 @@ #ifndef _singlesize_h_ #define _singlesize_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlesize.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ extern GLint __glReadPixels_size(GLenum format, GLenum type, @@ -52,7 +67,16 @@ extern GLint __glGetBooleanv_size(GLenum sq); extern GLint __glGetTexLevelParameterfv_size(GLenum pname); extern GLint __glGetTexLevelParameteriv_size(GLenum pname); extern GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, - GLenum type, GLint width, GLint height); + GLenum type, GLint width, GLint height, + GLint depth); +extern GLint __glGetColorTableParameterfv_size(GLenum pname); +extern GLint __glGetColorTableParameteriv_size(GLenum pname); +extern GLint __glGetConvolutionParameterfv_size(GLenum pname); +extern GLint __glGetConvolutionParameteriv_size(GLenum pname); +extern GLint __glGetHistogramParameterfv_size(GLenum pname); +extern GLint __glGetHistogramParameteriv_size(GLenum pname); +extern GLint __glGetMinmaxParameterfv_size(GLenum pname); +extern GLint __glGetMinmaxParameteriv_size(GLenum pname); #endif /* _singlesize_h_ */ diff --git a/xc/programs/Xserver/GL/glx/unpack.h b/xc/programs/Xserver/GL/glx/unpack.h index 80a805aab..0aff20ffe 100644 --- a/xc/programs/Xserver/GL/glx/unpack.h +++ b/xc/programs/Xserver/GL/glx/unpack.h @@ -1,26 +1,41 @@ #ifndef __GLX_unpack_h__ #define __GLX_unpack_h__ -/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/unpack.h,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define __GLX_PAD(s) (((s)+3) & (GLuint)~3) @@ -41,7 +56,7 @@ #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) #endif -extern void __glXMemInit(); +extern void __glXMemInit(void); extern xGLXSingleReply __glXReply; @@ -134,6 +149,7 @@ extern xGLXSingleReply __glXReply; GLbyte *swapPC; \ GLbyte *swapEnd + #define __GLX_SWAP_INT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ diff --git a/xc/programs/Xserver/GL/glx/xfont.c b/xc/programs/Xserver/GL/glx/xfont.c index 8bf6e8116..e449816ec 100644 --- a/xc/programs/Xserver/GL/glx/xfont.c +++ b/xc/programs/Xserver/GL/glx/xfont.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/xfont.c,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:41 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/xfont.c,v 1.2 2001/01/08 16:21:41 nathanh Exp $ */ #define NEED_REPLIES diff --git a/xc/programs/Xserver/GL/include/GL/glx_ansic.h b/xc/programs/Xserver/GL/include/GL/glx_ansic.h index e6ccd3a2f..0a1d7bc20 100644 --- a/xc/programs/Xserver/GL/include/GL/glx_ansic.h +++ b/xc/programs/Xserver/GL/include/GL/glx_ansic.h @@ -1,26 +1,41 @@ #ifndef _glx_ansic_h_ #define _glx_ansic_h_ -/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.3 1999/07/11 08:49:18 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/01/08 16:21:42 $ $Revision: 1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.2 2001/01/08 16:21:42 nathanh Exp $ */ /* @@ -37,18 +52,13 @@ ** tree and all should be taken care of. */ -#ifdef XFree86Server +#ifdef XF86 #include <xf86Version.h> #define XF_Minimum_Version ( (3 * 10) + (9) ) #define XF_Version ( (XF86_VERSION_MAJOR * 10) + (XF86_VERSION_MINOR) ) #endif -#if defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version) -#include "xf86_ansic.h" -#else -#endif - -#if 0 && defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version) +#if XF86 && ( XF_Version >= XF_Minimum_Version) #include "xf86Module.h" @@ -99,6 +109,8 @@ #define __glXStrtok(s, delim) xf86strtok(s, delim) #define __glXStrcspn(s, reject) xf86strcspn(s, reject) #define __glXGetenv(a) xf86getenv(a) +#define __glXAtoi(a) xf86atoi(a) + #ifndef assert #define assert(a) @@ -110,19 +122,6 @@ ** Either not a loadable module, or pre X3.9 */ -/* assert() is named __assert() in the LynxOS libc. We might get - * unresolved externals if we #undef assert and include assert.h - * if assert.h was already included on our way here.... - */ -#if defined(Lynx) && defined(__assert_h) -#undef __assert_h -#endif - -#ifdef assert -#undef assert -#endif - -#include <assert.h> #define GLX_STDOUT stdout #define GLX_STDERR stderr @@ -157,6 +156,7 @@ #define __glXStrtok(s, delim) strtok(s, delim) #define __glXStrcspn(s, reject) strcspn(s, reject) #define __glXGetenv(a) getenv(a) +#define __glXAtoi(a) atoi(a) #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index 62ee2add7..f5b083078 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h @@ -45,6 +45,8 @@ typedef struct _TDFXRec *TDFXPtr; #include "tdfx_priv.h" extern void TDFXSwapContextFifo(ScreenPtr pScreen); extern void TDFXLostContext(ScreenPtr pScreen); +extern Bool TDFXSetupSLI(ScrnInfoPtr pScrn, Bool sliEnable, int aaSamples); +extern Bool TDFXDisableSLI(TDFXPtr pTDFX); #ifdef XF86DRI extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index a39c9b780..b4c61161f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -1945,14 +1945,15 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { static Bool TDFXEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn; -#ifdef XF86DRI ScreenPtr pScreen; +#ifdef XF86DRI TDFXPtr pTDFX; #endif TDFXTRACE("TDFXEnterVT start\n"); pScrn = xf86Screens[scrnIndex]; - InstallFifo(pScrn); + pScreen = screenInfo.screens[scrnIndex]; + TDFXInitFifo(pScreen); #ifdef XF86DRI pTDFX = TDFXPTR(pScrn); if (pTDFX->directRenderingEnabled) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c index 42e32e0d8..500472d79 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c @@ -129,6 +129,7 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) start_sec=0; readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); do { + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); stat=TDFXReadLongMMIO(pTDFX, 0); if (stat&SST_BUSY) i=0; else i++; cnt++; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c index 4f784ca27..a13d91dfa 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c @@ -12,7 +12,7 @@ /* #define RD_ABORT_ERROR */ #define H3VDD -static Bool TDFXDisableSLI(TDFXPtr pTDFX) +Bool TDFXDisableSLI(TDFXPtr pTDFX) { int i; int v; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux index d6c2f67ec..862bb6c3f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux @@ -167,6 +167,9 @@ all::;@echo === KERNEL HEADERS IN $(TREE) all::;@echo === SMP=${SMP} MODULES=${MODULES} MODVERSIONS=${MODVERSIONS} AGP=${AGP} all::;@echo === kill_fasync has $(PARAMS) parameters all::;@echo === Compiling for machine $(MACHINE) +all::;@echo === WARNING +all::;@echo === WARNING 2.4.0 kernels before test11 DONT WORK +all::;@echo === WARNING ifeq ($(MODULES),0) all::;@echo diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c index 7d79a013b..b98a29885 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c @@ -36,7 +36,7 @@ #define TDFX_NAME "tdfx" #define TDFX_DESC "3dfx Banshee/Voodoo3+" -#define TDFX_DATE "20000928" +#define TDFX_DATE "20001030" #define TDFX_MAJOR 1 #define TDFX_MINOR 0 #define TDFX_PATCHLEVEL 0 |