diff --git a/Doxyfile b/Doxyfile deleted file mode 100644 index 4f1aae5..0000000 --- a/Doxyfile +++ /dev/null @@ -1,1212 +0,0 @@ -# Doxyfile 1.4.0 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = Sage - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 0.9.1 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. - -SHOW_DIRECTORIES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the progam writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = include/GL/sage.h drivers/driver.h drivers/glide/drv_api.c drivers/glide/drv_texman.c drivers/glide/drv_cb.c drivers/glide/drv_tex.c - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = NO - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), -# the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/Makefile b/Makefile index 1dd7041..c4d8cf1 100644 --- a/Makefile +++ b/Makefile @@ -7,24 +7,22 @@ DRIVER ?= glide all: lib/libGL.so.1.1 CC = gcc -CFLAGS = -Wall -W -pedantic +HOST_CC = gcc +CFLAGS = -Wall +CFLAGS += -Wno-unused CFLAGS += -O2 -# CFLAGS += -ffast-math -DFAST_MATH +# in case of problems disable -DNDEBUG to enable assertions +CFLAGS += -DNDEBUG +#CFLAGS += -g +#CFLAGS += -ffast-math -DFAST_MATH CFLAGS += -I. -Iinclude -Idrivers -CFLAGS += -g -Wno-unused -LD = gcc +# disable software scaledown of hardware-unsupported large textures +#CFLAGS += -DFX_RESCALEHACK=0 +LD = $(CC) LDFLAGS = -LDLIBS = -lm +LDLIBS = -lX11 -ldl -lm AS = nasm -ASFLAGS = -O6 -felf -D__linux__ -Ix86/ -Imain/ - -# MSS begin -ifeq ($(MSS),1) -CFLAGS += -DMSS=1 -include mss.h -LDFLAGS += -Llib -LDLIBS += -lmss -endif -# MSS end +ASFLAGS = -O2 -felf -D__linux__ -Ix86/ -Imain/ CORE_SOURCES = \ util/cfg.c \ @@ -83,6 +81,8 @@ X86_SOURCES = \ x86/sse_mat.asm \ x86/sse_clip.asm \ x86/sse_misc.asm + +x86/x86.o: x86/x86chk.h endif include drivers/$(DRIVER)/config @@ -94,7 +94,7 @@ SOURCES = $(CORE_SOURCES) $(TNL_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES) OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) .c.o: - $(CC) -o $@ $(CFLAGS) -c $< + $(CC) -o $@ $(CFLAGS) -fPIC -DPIC -c $< .asm.o: $(AS) -o $@ $(ASFLAGS) $< @@ -106,13 +106,17 @@ $(X86_SOURCES:.asm=.o): x86/x86.inc x86/x86.inc: x86/x86gen.exe $< -o $@ +x86/x86chk.h: x86/x86gen.exe + $< -c -o $@ + x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $< + $(HOST_CC) -o $@ $(CFLAGS) $< clean:: -$(RM) $(OBJECTS) -$(RM) x86/*.o + -$(RM) x86/x86chk.h + -$(RM) x86/x86.inc realclean:: clean - -$(RM) x86/x86.inc -$(RM) lib/libGL.so.1.1 diff --git a/Makefile.DJ b/Makefile.DJ index be2a70b..e7e9ccf 100644 --- a/Makefile.DJ +++ b/Makefile.DJ @@ -2,32 +2,40 @@ .SUFFIXES: .asm .o .INTERMEDIATE: x86/x86gen.exe +LIBNAME = "SAGE_GL 0.9.x" DRIVER ?= glide -all: lib/libGL.a +all: lib/libgl.a lib/gl.dxe CC = gcc -CFLAGS = -Wall -W -pedantic +HOST_CC = gcc +CFLAGS = -Wall +CFLAGS += -Wno-unused CFLAGS += -O2 -# CFLAGS += -ffast-math -DFAST_MATH +# in case of problems disable -DNDEBUG to enable assertions +CFLAGS += -DNDEBUG +#CFLAGS += -g +#CFLAGS += -ffast-math -DFAST_MATH CFLAGS += -I. -Iinclude -Idrivers -CFLAGS += -g -Wno-unused CFLAGS += -D__DOS__ -LD = gcc +# disable software scaledown of hardware-unsupported large textures +CFLAGS += -DFX_RESCALEHACK=0 +#CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 +LD = $(CC) LDFLAGS = LDLIBS = -lm AS = nasm -ASFLAGS = -O6 -fcoff -D__DJGPP__ -Ix86/ -Imain/ --prefix _ +ASFLAGS = -O2 -fcoff -D__DJGPP__ -Ix86/ -Imain/ --prefix _ +# workaround the sse issue in DXE builds: note that this +# is only needed for DXE, but not for the static library. +ASFLAGS+= -DBROKEN_MOVAPS AR = ar ARFLAGS = crus - -# MSS begin -ifeq ($(MSS),1) -CFLAGS += -DMSS=1 -include mss.h -LDFLAGS += -Llib -LDLIBS += -lmss +DXE3GEN = dxe3gen +DXE3FLAGS = -E _sage_ -E _gl -X _gl_ +ifeq ($(DRIVER),glide) +DXE3FLAGS+= -P glide3x.dxe endif -# MSS end CORE_SOURCES = \ util/cfg.c \ @@ -86,6 +94,8 @@ X86_SOURCES = \ x86/sse_mat.asm \ x86/sse_clip.asm \ x86/sse_misc.asm + +x86/x86.o: x86/x86chk.h endif include drivers/$(DRIVER)/config @@ -99,21 +109,30 @@ OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) .asm.o: $(AS) -o $@ $(ASFLAGS) $< -lib/libGL.a: $(OBJECTS) +lib/libgl.a: $(OBJECTS) $(AR) $(ARFLAGS) $@ $^ +lib/gl.dxe: $(OBJECTS) + -$(DXE3GEN) -o $@ -Y lib/libigl.a -D $(LIBNAME) $(DXE3FLAGS) -U $(OBJECTS) + $(X86_SOURCES:.asm=.o): x86/x86.inc x86/x86.inc: x86/x86gen.exe $< -o $@ +x86/x86chk.h: x86/x86gen.exe + $< -c -o $@ + x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $< + $(HOST_CC) -o $@ $(CFLAGS) $< clean:: -$(RM) $(OBJECTS) -$(RM) x86/*.o + -$(RM) x86/x86chk.h + -$(RM) x86/x86.inc realclean:: clean - -$(RM) x86/x86.inc - -$(RM) lib/libGL.a + -$(RM) lib/libgl.a + -$(RM) lib/gl.dxe + -$(RM) lib/libigl.a diff --git a/Makefile.icc b/Makefile.icc index 22a7321..3f20630 100644 --- a/Makefile.icc +++ b/Makefile.icc @@ -6,25 +6,23 @@ DRIVER ?= glide all: lib/libGL.so.1.1 -CC = /opt/intel/cc/9.0/bin/icc -CFLAGS = -Wall +#CC = /opt/intel/cc/9.0/bin/icc +CC = icc +HOST_CC = icc +CFLAGS = -Wall CFLAGS += -O2 -ip -# CFLAGS += -rcd -xK -DFAST_MATH +# in case of problems disable -DNDEBUG to enable assertions +CFLAGS += -DNDEBUG +#CFLAGS += -g +#CFLAGS += -rcd -xK -DFAST_MATH CFLAGS += -I. -Iinclude -Idrivers -# CFLAGS += -g -LD = /opt/intel/cc/9.0/bin/icc +# disable software scaledown of hardware-unsupported large textures +#CFLAGS += -DFX_RESCALEHACK=0 +LD = $(CC) LDFLAGS = -i-static -LDLIBS = -lm +LDLIBS = -lX11 -ldl -lm AS = nasm -ASFLAGS = -O6 -felf -D__linux__ -Ix86/ -Imain/ - -# MSS begin -ifeq ($(MSS),1) -CFLAGS += -DMSS=1 -include mss.h -LDFLAGS += -Llib -LDLIBS += -lmss -endif -# MSS end +ASFLAGS = -O2 -felf -D__linux__ -Ix86/ -Imain/ CORE_SOURCES = \ util/cfg.c \ @@ -83,6 +81,8 @@ X86_SOURCES = \ x86/sse_mat.asm \ x86/sse_clip.asm \ x86/sse_misc.asm + +x86/x86.o: x86/x86chk.h endif include drivers/$(DRIVER)/config @@ -106,13 +106,17 @@ $(X86_SOURCES:.asm=.o): x86/x86.inc x86/x86.inc: x86/x86gen.exe $< -o $@ +x86/x86chk.h: x86/x86gen.exe + $< -c -o $@ + x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $< + $(HOST_CC) -o $@ $(CFLAGS) $< clean:: -$(RM) $(OBJECTS) -$(RM) x86/*.o + -$(RM) x86/x86chk.h + -$(RM) x86/x86.inc realclean:: clean - -$(RM) x86/x86.inc -$(RM) lib/libGL.so.1.1 diff --git a/Makefile.mgw b/Makefile.mgw index 7f6f341..4bfd89b 100644 --- a/Makefile.mgw +++ b/Makefile.mgw @@ -6,27 +6,26 @@ DRIVER ?= glide all: lib/opengl32.dll lib/libopengl32.a -CC = mingw32-gcc -CFLAGS = -Wall -W -pedantic +CC = gcc +HOST_CC = gcc +CFLAGS = -m32 -Wall +CFLAGS += -Wno-unused CFLAGS += -O2 +# in case of problems disable -DNDEBUG to enable assertions +CFLAGS += -DNDEBUG +#CFLAGS += -g CFLAGS += -ffast-math -DFAST_MATH CFLAGS += -I. -Iinclude -Idrivers -CFLAGS += -g -Wno-unused -LD = mingw32-gcc -LDFLAGS = +# disable software scaledown of hardware-unsupported large textures +#CFLAGS += -DFX_RESCALEHACK=0 +LD = $(CC) +LDFLAGS = -m32 -Wl,--enable-auto-image-base -Wl,--no-undefined -Wl,-k LDLIBS = -lm -AS = nasmw -ASFLAGS = -O6 -fwin32 -D__WIN32__ -Ix86/ -Imain/ --prefix _ +AS = nasm +ASFLAGS = -O2 -fwin32 -D__WIN32__ -Ix86/ -Imain/ --prefix _ RC = windres -RCFLAGS = -O coff - -# MSS begin -ifeq ($(MSS),1) -CFLAGS += -DMSS=1 -include mss.h -LDFLAGS += -Llib -LDLIBS += -lmss -endif -# MSS end +RCFLAGS = --output-format=coff --target=pe-i386 +DLLTOOL = dlltool CORE_SOURCES = \ util/cfg.c \ @@ -85,6 +84,8 @@ X86_SOURCES = \ x86/sse_mat.asm \ x86/sse_clip.asm \ x86/sse_misc.asm + +x86/x86.o: x86/x86chk.h endif include drivers/$(DRIVER)/config @@ -102,27 +103,30 @@ OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) .rc.res: $(RC) -o $@ $(RCFLAGS) $< -lib/opengl32.dll: $(OBJECTS) drivers/$(DRIVER)/opengl.res - $(LD) -o $@ -shared $(LDFLAGS) $^ $(LDLIBS) -Wl,-k -# $(LD) -o $@ -shared $(LDFLAGS) $^ $(LDLIBS) - lib/libopengl32.a: - dlltool --dllname opengl32.dll --def drivers/opengl32.def --output-lib $@ -k + $(DLLTOOL) --as-flags=--32 -m i386 --dllname opengl32.dll --input-def drivers/opengl32.def --output-lib $@ -k + +lib/opengl32.dll: $(OBJECTS) drivers/$(DRIVER)/opengl.res drivers/opengl32.def + $(LD) -shared -o $@ $^ $(LDFLAGS) $(LDLIBS) $(X86_SOURCES:.asm=.o): x86/x86.inc x86/x86.inc: x86/x86gen.exe $< -o $@ +x86/x86chk.h: x86/x86gen.exe + $< -c -o $@ + x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $< + $(HOST_CC) -o $@ $(CFLAGS) $< clean:: -$(RM) $(OBJECTS) -$(RM) drivers/$(DRIVER)/opengl.res -$(RM) x86/*.o + -$(RM) x86/x86chk.h + -$(RM) x86/x86.inc realclean:: clean - -$(RM) x86/x86.inc -$(RM) lib/opengl32.dll -$(RM) lib/libopengl32.a diff --git a/doc/conform/Makefile.mgw b/doc/conform/Makefile.mgw index f3856ed..7c79041 100644 --- a/doc/conform/Makefile.mgw +++ b/doc/conform/Makefile.mgw @@ -30,7 +30,7 @@ CC = mingw32-gcc CFLAGS = -Wall -W -pedantic CFLAGS += -O2 -ffast-math CFLAGS += -I. -I../include -LD = mingw32-gcc +LD = $(CC) LDFLAGS = -s LDFLAGS = -L../lib LDLIBS = -lglut32 -lglu32 -lopengl32 -lglide3x -lm diff --git a/doc/conform/extgl.c b/doc/conform/extgl.c index 2cd4f56..b661af3 100644 --- a/doc/conform/extgl.c +++ b/doc/conform/extgl.c @@ -37,7 +37,7 @@ GLAPI void GLAPIENTRY myBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { -#ifdef __WIN32__ +#ifdef _WIN32 static PFNGLBLENDCOLOREXTPROC BlendColorEXT = NULL; if (BlendColorEXT == NULL) { BlendColorEXT = (PFNGLBLENDCOLOREXTPROC)wglGetProcAddress("glBlendColorEXT"); @@ -54,7 +54,7 @@ myBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) GLAPI void GLAPIENTRY myBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { -#ifdef __WIN32__ +#ifdef _WIN32 static PFNGLBLENDFUNCSEPARATEEXTPROC BlendFuncSeparateEXT = NULL; if (BlendFuncSeparateEXT == NULL) { BlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)wglGetProcAddress("glBlendFuncSeparateEXT"); @@ -71,7 +71,7 @@ myBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlph GLAPI void GLAPIENTRY myBlendEquationEXT (GLenum mode) { -#ifdef __WIN32__ +#ifdef _WIN32 static PFNGLBLENDEQUATIONEXTPROC BlendEquationEXT = NULL; if (BlendEquationEXT == NULL) { BlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)wglGetProcAddress("glBlendEquationEXT"); @@ -88,7 +88,7 @@ myBlendEquationEXT (GLenum mode) GLAPI void GLAPIENTRY myBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha) { -#ifdef __WIN32__ +#ifdef _WIN32 static PFNGLBLENDEQUATIONSEPARATEEXTPROC BlendEquationSeparateEXT; if (BlendEquationSeparateEXT == NULL) { BlendEquationSeparateEXT = (PFNGLBLENDEQUATIONSEPARATEEXTPROC)wglGetProcAddress("glBlendEquationSeparateEXT"); @@ -105,7 +105,7 @@ myBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha) GLAPI void APIENTRY myActiveTextureARB (GLenum texture) { -#ifdef __WIN32__ +#ifdef _WIN32 static PFNGLACTIVETEXTUREARBPROC ActiveTextureARB; if (ActiveTextureARB == NULL) { ActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB"); @@ -122,7 +122,7 @@ myActiveTextureARB (GLenum texture) GLAPI void APIENTRY myMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t) { -#ifdef __WIN32__ +#ifdef _WIN32 static PFNGLMULTITEXCOORD2FARBPROC MultiTexCoord2fARB = NULL; if (MultiTexCoord2fARB == NULL) { MultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB"); @@ -134,3 +134,4 @@ myMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t) glMultiTexCoord2fARB(target, s, t); #endif } + diff --git a/doc/texenv/Makefile b/doc/texenv/Makefile index f2e53b4..2118ada 100644 --- a/doc/texenv/Makefile +++ b/doc/texenv/Makefile @@ -4,7 +4,7 @@ CC = gcc CFLAGS += -Wall -W -pedantic -ansi CFLAGS += -O2 -LD = gcc +LD = $(CC) LDFLAGS = -s LDLIBS = diff --git a/doc/tools/api.h b/doc/tools/api.h index 523cc40..30e660c 100644 --- a/doc/tools/api.h +++ b/doc/tools/api.h @@ -10,6 +10,7 @@ void glCallLists (GLsizei n, GLenum type, const GLvoid *lists); void glClear (GLbitfield mask); void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); void glClearDepth (GLclampd depth); +void glClearStencil (GLint s); void glClientActiveTexture (GLenum texture); void glClipPlane (GLenum plane, const GLdouble *equation); void glColor3b (GLbyte red, GLbyte green, GLbyte blue); @@ -48,6 +49,7 @@ void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alph void glColorMaterial (GLenum face, GLenum mode); void glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +void glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); void glCullFace (GLenum mode); void glDeleteLists (GLuint list, GLsizei range); @@ -84,6 +86,7 @@ void glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GL GLuint glGenLists (GLsizei range); void glGenTextures (GLsizei n, GLuint *textures); void glGetBooleanv (GLenum pname, GLboolean *params); +void glGetCompressedTexImage (GLenum target, GLint lod, GLvoid *img); void glGetDoublev (GLenum pname, GLdouble *params); GLenum glGetError (void); void glGetFloatv (GLenum pname, GLfloat *params); @@ -206,6 +209,9 @@ void glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); void glSecondaryColor3usv (const GLushort *v); void glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void glShadeModel (GLenum mode); +void glStencilFunc (GLenum func, GLint ref, GLuint mask); +void glStencilMask (GLuint mask); +void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); void glTexCoord1d (GLdouble s); void glTexCoord1dv (const GLdouble *v); void glTexCoord1f (GLfloat s); @@ -255,6 +261,7 @@ void glTexParameterf (GLenum target, GLenum pname, GLfloat param); void glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); void glTexParameteri (GLenum target, GLenum pname, GLint param); void glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +void glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); void glTranslated (GLdouble x, GLdouble y, GLdouble z); void glTranslatef (GLfloat x, GLfloat y, GLfloat z); diff --git a/drivers/foo/drv_api.c b/drivers/foo/drv_api.c index f420fbd..0f41e33 100644 --- a/drivers/foo/drv_api.c +++ b/drivers/foo/drv_api.c @@ -1,4 +1,5 @@ #include +#include #include "GL/gl.h" #include "GL/sage.h" @@ -30,9 +31,13 @@ sage_init (void) return 32; } +#if defined(__MSDOS__)||defined(_WIN32) + cfg_load("sage.ini"); +#else if (cfg_load("sage.ini") != 0) { cfg_load("/etc/sage.ini"); } +#endif hardware = 0; @@ -99,6 +104,9 @@ sage_bind (sageContext *ctx, void *win, int width, int height) } return 0; } +#ifdef __MSDOS__ + win = NULL; /* DOS: no window handle. */ +#endif if (ctx == current) { if (win == current->drawable) { /* nop */ @@ -157,3 +165,31 @@ sage_swap (int interval) (void)interval; GLCALL(Flush)(); } + + +#ifdef __MSDOS__ +static struct { + const char *name; + SageProc proc; +} functab[] = { +#define ALIAS(x, y) \ + { "gl" #x #y, (SageProc)gl##x }, +#include "../../main/alias.h" + { "glLockArraysEXT", (SageProc)glLockArraysEXT }, + { "glUnlockArraysEXT", (SageProc)glUnlockArraysEXT }, + { "glPolygonOffsetEXT", (SageProc)glPolygonOffsetEXT } +}; + +SageProc +sage_GetProcAddress (const char *procname) +{ + const int n = sizeof(functab) / sizeof(functab[0]); + int i; + for (i = 0; i < n; i++) { + if (!strcmp(procname, functab[i].name)) { + return functab[i].proc; + } + } + return NULL; +} +#endif diff --git a/drivers/foo/glx.c b/drivers/foo/glx.c index 9ae48dc..8465edd 100644 --- a/drivers/foo/glx.c +++ b/drivers/foo/glx.c @@ -1,6 +1,11 @@ #include #include +/* new glx.h dependencies: */ +#include +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptr; + #include #include #include "GL/sage.h" diff --git a/drivers/foo/wgl.c b/drivers/foo/wgl.c index 9efc1f5..657f2c8 100644 --- a/drivers/foo/wgl.c +++ b/drivers/foo/wgl.c @@ -1,4 +1,7 @@ #define WIN32_LEAN_AND_MEAN +#define _GDI32_ /* so that __declspec(dllimport) is disabled: */ + /* this file must not use any gdi.h functions. */ +#undef __W32API_USE_DLLIMPORT /* non-standart mingw.org thing */ #include #include "GL/gl.h" @@ -370,26 +373,6 @@ wglSetPixelFormat (HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd) return FALSE; } -#if 0 - /* Make sure the object supports this pixel format */ - switch (GetObjectType(hdc)) { - case OBJ_DC: - if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW)) { - return FALSE; - } - break; - case OBJ_MEMDC: - if (!(pfd.dwFlags & PFD_DRAW_TO_BITMAP)) { - return FALSE; - } - break; - default: - return FALSE; - } - - GdiSetPixelFormat(hDC, iPixelFormat); -#endif - pixelFormat = iPixelFormat; return TRUE; } diff --git a/drivers/glide/config b/drivers/glide/config index e0a0c8c..b8cb8d3 100644 --- a/drivers/glide/config +++ b/drivers/glide/config @@ -1,6 +1,6 @@ -.INTERMEDIATE: drivers/$(DRIVER)/x86/drvgen.exe +.INTERMEDIATE: drivers/$(DRIVER)/x86/drvgen.exe glide3x.dxe -GLIDESDK ?= . +GLIDESDK ?= g3sdk CFLAGS += -I$(GLIDESDK)/include LDFLAGS += -L$(GLIDESDK)/lib @@ -20,6 +20,8 @@ ifeq ($(X86),1) DRIVER_SOURCES += \ drivers/$(DRIVER)/x86/k3d_emit.asm \ drivers/$(DRIVER)/x86/sse_emit.asm + +drivers/$(DRIVER)/drv_api.o: drivers/$(DRIVER)/drvchk.h endif drivers/$(DRIVER)/x86/k3d_emit.o: drivers/$(DRIVER)/x86/k3d_emit.asm drivers/$(DRIVER)/x86/k3d_vbtmp.asm drivers/$(DRIVER)/x86/drv.inc @@ -30,13 +32,25 @@ drivers/$(DRIVER)/x86/sse_emit.o: drivers/$(DRIVER)/x86/sse_emit.asm drivers/$(D drivers/$(DRIVER)/x86/drv.inc: drivers/$(DRIVER)/x86/drvgen.exe $< -o $@ +drivers/$(DRIVER)/drvchk.h: drivers/$(DRIVER)/x86/drvgen.exe + $< -c -o $@ drivers/$(DRIVER)/x86/drvgen.exe: drivers/$(DRIVER)/x86/drvgen.c glinternal.h main/context.h drivers/$(DRIVER)/drv.h - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $< + $(HOST_CC) -o $@ $(CFLAGS) $< + +# dxe3gen needs glide3x.dxe when generating the import lib libigl.a. +# so we generate a dummy glide3x.dxe to cover common glide3x exports +# and all possible libc dependencies: +lib/gl.dxe: glide3x.dxe +drivers/$(DRIVER)/glide3x_dxe.o: drivers/$(DRIVER)/glide3x_dxe.c + $(CC) -O0 -Wall -o $@ -c $< +glide3x.dxe: drivers/$(DRIVER)/glide3x_dxe.o + -$(DXE3GEN) -o glide3x.dxe -E _gr -E _gu -U $< clean:: -$(RM) drivers/$(DRIVER)/x86/k3d_emit.o -$(RM) drivers/$(DRIVER)/x86/sse_emit.o - -realclean:: + -$(RM) drivers/$(DRIVER)/glide3x_dxe.o + -$(RM) drivers/$(DRIVER)/drvchk.h -$(RM) drivers/$(DRIVER)/x86/drv.inc + diff --git a/drivers/glide/drv.h b/drivers/glide/drv.h index f452596..a357e7c 100644 --- a/drivers/glide/drv.h +++ b/drivers/glide/drv.h @@ -154,18 +154,31 @@ extern int allow_compressed; extern int allow_multitex; -extern char * (FX_CALL *gfGetRegistryOrEnvironmentStringExt) (char *theEntry); -extern GrContext_t (FX_CALL *gfSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers); -extern void (FX_CALL *gfBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil); -extern void (FX_CALL *gfColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a); -extern void (FX_CALL *gfStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); -extern void (FX_CALL *gfStencilMaskExt) (GrStencil_t value); -extern void (FX_CALL *gfStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass); -extern void (FX_CALL *gfColorCombineExt) (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); -extern void (FX_CALL *gfAlphaCombineExt) (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); -extern void (FX_CALL *gfTexColorCombineExt) (GrChipID_t 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); -extern void (FX_CALL *gfTexAlphaCombineExt) (GrChipID_t 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); -extern void (FX_CALL *gfConstantColorValueExt) (GrChipID_t tmu, GrColor_t value); +typedef char * (FX_CALL *gfGetRegistryOrEnvironmentStringExt_f) (char *theEntry); +typedef GrContext_t (FX_CALL *gfSstWinOpenExt_f) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers); +typedef void (FX_CALL *gfBufferClearExt_f) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil); +typedef void (FX_CALL *gfColorMaskExt_f) (FxBool r, FxBool g, FxBool b, FxBool a); +typedef void (FX_CALL *gfStencilFuncExt_f) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); +typedef void (FX_CALL *gfStencilMaskExt_f) (GrStencil_t value); +typedef void (FX_CALL *gfStencilOpExt_f) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass); +typedef void (FX_CALL *gfColorCombineExt_f) (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 (FX_CALL *gfAlphaCombineExt_f) (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 (FX_CALL *gfTexColorCombineExt_f) (GrChipID_t 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 (FX_CALL *gfTexAlphaCombineExt_f) (GrChipID_t 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 (FX_CALL *gfConstantColorValueExt_f) (GrChipID_t tmu, GrColor_t value); + +extern gfGetRegistryOrEnvironmentStringExt_f gfGetRegistryOrEnvironmentStringExt; +extern gfSstWinOpenExt_f gfSstWinOpenExt; +extern gfBufferClearExt_f gfBufferClearExt; +extern gfColorMaskExt_f gfColorMaskExt; +extern gfStencilFuncExt_f gfStencilFuncExt; +extern gfStencilMaskExt_f gfStencilMaskExt; +extern gfStencilOpExt_f gfStencilOpExt; +extern gfColorCombineExt_f gfColorCombineExt; +extern gfAlphaCombineExt_f gfAlphaCombineExt; +extern gfTexColorCombineExt_f gfTexColorCombineExt; +extern gfTexAlphaCombineExt_f gfTexAlphaCombineExt; +extern gfConstantColorValueExt_f gfConstantColorValueExt; #define GR_TMU_SPLIT 99 diff --git a/drivers/glide/drv_api.c b/drivers/glide/drv_api.c index e301250..ef6adc4 100644 --- a/drivers/glide/drv_api.c +++ b/drivers/glide/drv_api.c @@ -4,6 +4,7 @@ */ +#include #include #include @@ -63,46 +64,30 @@ void (*drv_copypv) (int vdst, int vsrc); void (*drv_interp) (float t, int vdst, int vout, int vin); -/* -char * (FX_CALL *gfGetRegistryOrEnvironmentStringExt) (char *theEntry); -GrContext_t (FX_CALL *gfSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers); -void (FX_CALL *gfBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil); -void (FX_CALL *gfColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a); -void (FX_CALL *gfStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); -void (FX_CALL *gfStencilMaskExt) (GrStencil_t value); -void (FX_CALL *gfStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass); -void (FX_CALL *gfColorCombineExt) (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); -void (FX_CALL *gfAlphaCombineExt) (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); -void (FX_CALL *gfTexColorCombineExt) (GrChipID_t 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); -void (FX_CALL *gfTexAlphaCombineExt) (GrChipID_t 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); -void (FX_CALL *gfConstantColorValueExt) (GrChipID_t tmu, GrColor_t value); -*/ - - /** Get registry or environment string. */ -char * FX_CALL (*gfGetRegistryOrEnvironmentStringExt) (char *theEntry); +gfGetRegistryOrEnvironmentStringExt_f gfGetRegistryOrEnvironmentStringExt; /** Open hardware context. */ -GrContext_t FX_CALL (*gfSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers); +gfSstWinOpenExt_f gfSstWinOpenExt; /** Clear buffer. */ -void FX_CALL (*gfBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil); +gfBufferClearExt_f gfBufferClearExt; /** Color mask. */ -void FX_CALL (*gfColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a); +gfColorMaskExt_f gfColorMaskExt; /** Stencil function. */ -void FX_CALL (*gfStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); +gfStencilFuncExt_f gfStencilFuncExt; /** Stencil mask. */ -void FX_CALL (*gfStencilMaskExt) (GrStencil_t value); +gfStencilMaskExt_f gfStencilMaskExt; /** Stencil op. */ -void FX_CALL (*gfStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass); +gfStencilOpExt_f gfStencilOpExt; /** Color combiner. */ -void FX_CALL (*gfColorCombineExt) (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); +gfColorCombineExt_f gfColorCombineExt; /** Alpha combiner. */ -void FX_CALL (*gfAlphaCombineExt) (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); +gfAlphaCombineExt_f gfAlphaCombineExt; /** Texture color combiner. */ -void FX_CALL (*gfTexColorCombineExt) (GrChipID_t 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); +gfTexColorCombineExt_f gfTexColorCombineExt; /** Texture alpha combiner. */ -void FX_CALL (*gfTexAlphaCombineExt) (GrChipID_t 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); +gfTexAlphaCombineExt_f gfTexAlphaCombineExt; /** Constant color. */ -void FX_CALL (*gfConstantColorValueExt) (GrChipID_t tmu, GrColor_t value); +gfConstantColorValueExt_f gfConstantColorValueExt; /** @@ -263,10 +248,27 @@ findBestRes (int width, int height) { #define GLIDE_RESOLUTION(w, h) { GR_RESOLUTION_##w##x##h, w, h } static int resolutions[][3] = { + GLIDE_RESOLUTION(320, 200), + GLIDE_RESOLUTION(320, 240), + GLIDE_RESOLUTION(512, 384), + GLIDE_RESOLUTION(640, 400), GLIDE_RESOLUTION(640, 480), GLIDE_RESOLUTION(800, 600), GLIDE_RESOLUTION(1024, 768), - GLIDE_RESOLUTION(1280, 1024) + GLIDE_RESOLUTION(1280, 1024), + GLIDE_RESOLUTION(1600, 1200), + /**/ + GLIDE_RESOLUTION(400, 300), + GLIDE_RESOLUTION(856, 480), + GLIDE_RESOLUTION(960, 720), + GLIDE_RESOLUTION(1152, 864), + GLIDE_RESOLUTION(1280, 960), + GLIDE_RESOLUTION(1600, 1024), + GLIDE_RESOLUTION(1792, 1344), + GLIDE_RESOLUTION(1856, 1392), + GLIDE_RESOLUTION(1920, 1440), + GLIDE_RESOLUTION(2048, 1536), + GLIDE_RESOLUTION(2048, 2048) }; unsigned i; for (i = 0; i < sizeof(resolutions) / sizeof(resolutions[0]); i++) { @@ -436,9 +438,13 @@ sage_init (void) return 0; } +#if defined(__MSDOS__)||defined(_WIN32) + cfg_load("sage.ini"); +#else if (cfg_load("sage.ini") != 0) { cfg_load("/etc/sage.ini"); } +#endif grSstSelect(0); @@ -459,18 +465,18 @@ sage_init (void) hwext_pixext = (strstr(str, "PIXEXT") != NULL); hwext_combine = (strstr(str, "COMBINE") != NULL); - *(GrProc *)&gfGetRegistryOrEnvironmentStringExt = grGetProcAddress("grGetRegistryOrEnvironmentStringExt"); - *(GrProc *)&gfSstWinOpenExt = grGetProcAddress("grSstWinOpenExt"); - *(GrProc *)&gfBufferClearExt = grGetProcAddress("grBufferClearExt"); - *(GrProc *)&gfColorMaskExt = grGetProcAddress("grColorMaskExt"); - *(GrProc *)&gfStencilFuncExt = grGetProcAddress("grStencilFuncExt"); - *(GrProc *)&gfStencilMaskExt = grGetProcAddress("grStencilMaskExt"); - *(GrProc *)&gfStencilOpExt = grGetProcAddress("grStencilOpExt"); - *(GrProc *)&gfColorCombineExt = grGetProcAddress("grColorCombineExt"); - *(GrProc *)&gfAlphaCombineExt = grGetProcAddress("grAlphaCombineExt"); - *(GrProc *)&gfTexColorCombineExt = grGetProcAddress("grTexColorCombineExt"); - *(GrProc *)&gfTexAlphaCombineExt = grGetProcAddress("grTexAlphaCombineExt"); - *(GrProc *)&gfConstantColorValueExt = grGetProcAddress("grConstantColorValueExt"); + gfGetRegistryOrEnvironmentStringExt = (gfGetRegistryOrEnvironmentStringExt_f) grGetProcAddress("grGetRegistryOrEnvironmentStringExt"); + gfSstWinOpenExt = (gfSstWinOpenExt_f) grGetProcAddress("grSstWinOpenExt"); + gfBufferClearExt = (gfBufferClearExt_f) grGetProcAddress("grBufferClearExt"); + gfColorMaskExt = (gfColorMaskExt_f) grGetProcAddress("grColorMaskExt"); + gfStencilFuncExt = (gfStencilFuncExt_f) grGetProcAddress("grStencilFuncExt"); + gfStencilMaskExt = (gfStencilMaskExt_f) grGetProcAddress("grStencilMaskExt"); + gfStencilOpExt = (gfStencilOpExt_f) grGetProcAddress("grStencilOpExt"); + gfColorCombineExt = (gfColorCombineExt_f) grGetProcAddress("grColorCombineExt"); + gfAlphaCombineExt = (gfAlphaCombineExt_f) grGetProcAddress("grAlphaCombineExt"); + gfTexColorCombineExt = (gfTexColorCombineExt_f) grGetProcAddress("grTexColorCombineExt"); + gfTexAlphaCombineExt = (gfTexAlphaCombineExt_f) grGetProcAddress("grTexAlphaCombineExt"); + gfConstantColorValueExt = (gfConstantColorValueExt_f) grGetProcAddress("grConstantColorValueExt"); current = NULL; @@ -516,7 +522,10 @@ sage_open (int db_flag, allow_texuma = hwext_texuma && !YES("3dfx.disable.texuma"); allow_texmirror = hwext_texmirror && !YES("3dfx.disable.texmirror"); allow_fogcoord = hwext_fogcoord && !YES("3dfx.disable.fogcoord"); - allow_32bpt = (fb_color == 24 && hwext_texfmt) && !YES("3dfx.disable.32bpt"); + allow_32bpt = hwext_texfmt && !YES("3dfx.disable.32bpt"); +#if 0 /* FS: only check if we have the ARGB_8888 & co, like Mesa. */ + if (fb_color != 24) allow_32bpt = 0; +#endif allow_blendsquare = (hardware >= GR_SSTTYPE_Voodoo4) && !YES("3dfx.disable.blendsquare"); allow_combine = GL_TRUE && !YES("3dfx.disable.combine"); allow_multitex = (getInteger(GR_NUM_TMU) > 1) && !YES("3dfx.disable.multitex"); @@ -634,6 +643,9 @@ sage_bind (sageContext *ctx, void *win, int width, int height) } return 0; } +#ifdef __MSDOS__ + win = NULL; /* DOS: no window handle. */ +#endif if (ctx == current) { if (win == current->drawable) { /* nop */ @@ -648,14 +660,14 @@ sage_bind (sageContext *ctx, void *win, int width, int height) } if (hwext_pixext) { - ctx->gr_ctx = gfSstWinOpenExt((int)win, + ctx->gr_ctx = gfSstWinOpenExt((FxU32)win, findBestRes(width, height), GR_REFRESH_60Hz, GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT, ctx->fmt, 2, 1); } else if (ctx->fmt == GR_PIXFMT_RGB_565) { - ctx->gr_ctx = grSstWinOpen((int)win, + ctx->gr_ctx = grSstWinOpen((FxU32)win, findBestRes(width, height), GR_REFRESH_60Hz, GR_COLORFORMAT_ABGR, @@ -726,3 +738,36 @@ sage_swap (int interval) GLCALL(Flush)(); grBufferSwap(interval); } + + +#ifdef __MSDOS__ +static struct { + const char *name; + SageProc proc; +} functab[] = { +#define ALIAS(x, y) \ + { "gl" #x #y, (SageProc)gl##x }, +#include "../../main/alias.h" + { "glLockArraysEXT", (SageProc)glLockArraysEXT }, + { "glUnlockArraysEXT", (SageProc)glUnlockArraysEXT }, + { "glPolygonOffsetEXT", (SageProc)glPolygonOffsetEXT } +}; + +SageProc +sage_GetProcAddress (const char *procname) +{ + const int n = sizeof(functab) / sizeof(functab[0]); + int i; + for (i = 0; i < n; i++) { + if (!strcmp(procname, functab[i].name)) { + return functab[i].proc; + } + } + return NULL; +} +#endif + +#ifdef X86 +/* validate structure sizes and member offsets in x86/drv.inc: */ +#include "drvchk.h" +#endif diff --git a/drivers/glide/drv_setup.c b/drivers/glide/drv_setup.c index 3884d24..373ac0f 100644 --- a/drivers/glide/drv_setup.c +++ b/drivers/glide/drv_setup.c @@ -249,6 +249,7 @@ fxWPad (const TEXDEF *texDef, const TEX_IMG *texImage, int sclamp) } default: gl_assert(0); + return; } break; @@ -320,11 +321,13 @@ fxWPad (const TEXDEF *texDef, const TEX_IMG *texImage, int sclamp) } default: gl_assert(0); + return; } break; default: gl_assert(0); + return; } } @@ -398,6 +401,7 @@ fxHPad (const TEXDEF *texDef, const TEX_IMG *texImage, int tclamp) default: gl_assert(0); + return; } } @@ -409,11 +413,7 @@ is_pow2 (int n) return 0; } - while ((n & 1) == 0) { - n >>= 1; - } - - return !(n & ~1); + return !(n & (n - 1)); } @@ -1420,6 +1420,7 @@ convertStencilOp (GLenum op) return GR_STENCILOP_DECR_WRAP; default: gl_assert(0); + return GR_STENCILOP_KEEP; } } @@ -1452,6 +1453,7 @@ drv_setupStencil (void) } +#if FX_RESCALEHACK static void scale_down (const TEX_IMG *srcTexImg, TEX_IMG *dstTexImg, const TEXDEF *texDef) { @@ -1491,3 +1493,4 @@ scale_down (const TEX_IMG *srcTexImg, TEX_IMG *dstTexImg, const TEXDEF *texDef) dstFxImg->width = realDstWidth; dstFxImg->height = realDstHeight; } +#endif diff --git a/drivers/glide/drv_vb.c b/drivers/glide/drv_vb.c index 4f715c7..b5da647 100644 --- a/drivers/glide/drv_vb.c +++ b/drivers/glide/drv_vb.c @@ -452,7 +452,7 @@ vb_init (void) init_q0q1fs(); #ifdef X86 - if (x86_cpu_bits & _CPU_FEATURE_SSE) { + if ((x86_cpu_bits & _CPU_FEATURE_SSE) && x86_enable_sse) { extern void sse_emitvertices_g (int n); extern void sse_emitvertices_t0 (int n); extern void sse_emitvertices_q0 (int n); @@ -499,7 +499,8 @@ vb_init (void) vb_handler[SETUP_TEX0|SETUP_TEX1|SETUP_PTX1].emit_func = sse_emitvertices_t0q1; vb_handler[SETUP_TEX0|SETUP_PTX0|SETUP_TEX1|SETUP_PTX1].emit_func = sse_emitvertices_q0q1; } - if (x86_cpu_bits & _CPU_FEATURE_3DNOW) { + else + if ((x86_cpu_bits & _CPU_FEATURE_3DNOW) && x86_enable_3dnow) { extern void k3d_emitvertices_g (int n); extern void k3d_emitvertices_t0 (int n); extern void k3d_emitvertices_q0 (int n); diff --git a/drivers/glide/glide3x_dxe.c b/drivers/glide/glide3x_dxe.c new file mode 100644 index 0000000..7dcf277 --- /dev/null +++ b/drivers/glide/glide3x_dxe.c @@ -0,0 +1,176 @@ +/* C source for generating a dummy glide3x.dxe to be used when + * generating an import library for a dxe depending on glide3x. + * + * gcc -Wall -c glide3x.c -o glide3x.o + * dxe3gen -o glide3x.dxe -E _gr -E _gu -U glide3x.o + */ + +/* common gr and gu symbols exported by all + * sst1, sst96, cvg, h3 and h5 glide3x.dxe: + */ +void grAADrawTriangle () {} +void grAlphaBlendFunction () {} +void grAlphaCombine () {} +void grAlphaControlsITRGBLighting () {} +void grAlphaTestFunction () {} +void grAlphaTestReferenceValue () {} +void grBufferClear () {} +void grBufferSwap () {} +void grCheckForRoom () {} +void grChromakeyMode () {} +void grChromakeyValue () {} +void grClipWindow () {} +void grColorCombine () {} +void grColorMask () {} +void grConstantColorValue () {} +void grCoordinateSpace () {} +void grCullMode () {} +void grDepthBiasLevel () {} +void grDepthBufferFunction () {} +void grDepthBufferMode () {} +void grDepthMask () {} +void grDepthRange () {} +void grDisable () {} +void grDisableAllEffects () {} +void grDitherMode () {} +void grDrawLine () {} +void grDrawPoint () {} +void grDrawTriangle () {} +void grDrawVertexArray () {} +void grDrawVertexArrayContiguous () {} +void grEnable () {} +void grErrorSetCallback () {} +void grFinish () {} +void grFlush () {} +void grFogColorValue () {} +void grFogMode () {} +void grFogTable () {} +void grGet () {} +void grGetProcAddress () {} +void grGetRegistryOrEnvironmentString () {} +void grGetString () {} +void grGlideGetState () {} +void grGlideGetVersion () {} +void grGlideGetVertexLayout () {} +void grGlideInit () {} +void grGlideSetState () {} +void grGlideSetVertexLayout () {} +void grGlideShutdown () {} +void grLfbConstantAlpha () {} +void grLfbConstantDepth () {} +void grLfbLock () {} +void grLfbReadRegion () {} +void grLfbUnlock () {} +void grLfbWriteColorFormat () {} +void grLfbWriteColorSwizzle () {} +void grLfbWriteRegion () {} +void grLoadGammaTable () {} +void grQueryResolutions () {} +void grRenderBuffer () {} +void grReset () {} +void grSelectContext () {} +void grSetNumPendingBuffers () {} +void grSplash () {} +void grSstOrigin () {} +void grSstSelect () {} +void grSstVidMode () {} +void grSstWinClose () {} +void grSstWinOpen () {} +void grTexCalcMemRequired () {} +void grTexClampMode () {} +void grTexCombine () {} +void grTexDetailControl () {} +void grTexDownloadMipMap () {} +void grTexDownloadMipMapLevel () {} +void grTexDownloadMipMapLevelPartial () {} +void grTexDownloadTable () {} +void grTexDownloadTableExt () {} +void grTexDownloadTablePartial () {} +void grTexFilterMode () {} +void grTexLodBiasValue () {} +void grTexMaxAddress () {} +void grTexMinAddress () {} +void grTexMipMapMode () {} +void grTexMultibase () {} +void grTexMultibaseAddress () {} +void grTexNCCTable () {} +void grTexSource () {} +void grTexTextureMemRequired () {} +void grTriStats () {} +void grVertexLayout () {} +void grViewport () {} +void gu3dfGetInfo () {} +void gu3dfLoad () {} +void guFogGenerateExp () {} +void guFogGenerateExp2 () {} +void guFogGenerateLinear () {} +void guFogTableIndexToW () {} +void guGammaCorrectionRGB () {} + +/* external libc symbols required by all of + * sst1, sst96, cvg, h3 and h5 glide3x.dxe: + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +long EXTSYM0000 = (long) &_crt0_startup_flags; +long EXTSYM0001 = (long) &__dj_assert; +long EXTSYM0002 = (long) &__djgpp_base_address; +long EXTSYM0003 = (long) &__djgpp_nearptr_disable; +long EXTSYM0004 = (long) &__djgpp_nearptr_enable; +long EXTSYM0005 = (long) &__dj_stderr; +long EXTSYM0006 = (long) &__dj_stdout; +long EXTSYM0007 = (long) &__dpmi_free_physical_address_mapping; +long EXTSYM0008 = (long) &__dpmi_physical_address_mapping; +long EXTSYM0009 = (long) &atof; +long EXTSYM0010 = (long) &atoi; +long EXTSYM0011 = (long) &atol; +long EXTSYM0012 = (long) &clock; +long EXTSYM0013 = (long) &exit; +long EXTSYM0014 = (long) &fclose; +long EXTSYM0015 = (long) &fflush; +long EXTSYM0016 = (long) &fgetc; +long EXTSYM0017 = (long) &fgets; +long EXTSYM0018 = (long) &fopen; +long EXTSYM0019 = (long) &fprintf; +long EXTSYM0020 = (long) &fread; +long EXTSYM0021 = (long) &free; +long EXTSYM0022 = (long) &fwrite; +long EXTSYM0023 = (long) &getc; +long EXTSYM0024 = (long) &getenv; +long EXTSYM0025 = (long) &int86; +long EXTSYM0026 = (long) &longjmp; +long EXTSYM0027 = (long) &malloc; +long EXTSYM0028 = (long) &memcpy; +long EXTSYM0029 = (long) &memset; +long EXTSYM0030 = (long) &pow; +long EXTSYM0031 = (long) &printf; +long EXTSYM0032 = (long) &putenv; +long EXTSYM0033 = (long) &puts; +long EXTSYM0034 = (long) &setjmp; +long EXTSYM0035 = (long) &signal; +long EXTSYM0036 = (long) &sprintf; +long EXTSYM0037 = (long) &sscanf; +long EXTSYM0038 = (long) &strcat; +long EXTSYM0039 = (long) &strchr; +long EXTSYM0040 = (long) &strcmp; +long EXTSYM0041 = (long) &strcpy; +long EXTSYM0042 = (long) &strncat; +long EXTSYM0043 = (long) &strncpy; +long EXTSYM0044 = (long) &strtok; +long EXTSYM0045 = (long) &strtoul; +long EXTSYM0046 = (long) &usleep; +long EXTSYM0047 = (long) &vfprintf; +long EXTSYM0048 = (long) &vsprintf; + diff --git a/drivers/glide/glx.c b/drivers/glide/glx.c index 9ae48dc..8465edd 100644 --- a/drivers/glide/glx.c +++ b/drivers/glide/glx.c @@ -1,6 +1,11 @@ #include #include +/* new glx.h dependencies: */ +#include +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptr; + #include #include #include "GL/sage.h" diff --git a/drivers/glide/wgl.c b/drivers/glide/wgl.c index 316df66..9443a98 100644 --- a/drivers/glide/wgl.c +++ b/drivers/glide/wgl.c @@ -1,4 +1,7 @@ #define WIN32_LEAN_AND_MEAN +#define _GDI32_ /* so that __declspec(dllimport) is disabled: */ + /* this file must not use any gdi.h functions. */ +#undef __W32API_USE_DLLIMPORT /* non-standart mingw.org thing */ #include #include "GL/gl.h" @@ -123,18 +126,18 @@ wglSwapIntervalEXT (int i) GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, - GLint internalFormat, - GLsizei width, GLsizei height, - GLsizei depth, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels ) { WINLOG((eff, "%s: NYI\n", __FUNCTION__)); } + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) { WINLOG((eff, "%s: NYI\n", __FUNCTION__)); } GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint zoffset, GLsizei width, - GLsizei height, GLsizei depth, - GLenum format, - GLenum type, const GLvoid *pixels) { WINLOG((eff, "%s: NYI\n", __FUNCTION__)); } + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels) { WINLOG((eff, "%s: NYI\n", __FUNCTION__)); } #include "wgl_inc.c" @@ -388,26 +391,6 @@ wglSetPixelFormat (HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd) return FALSE; } -#if 0 - /* Make sure the object supports this pixel format */ - switch (GetObjectType(hdc)) { - case OBJ_DC: - if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW)) { - return FALSE; - } - break; - case OBJ_MEMDC: - if (!(pfd.dwFlags & PFD_DRAW_TO_BITMAP)) { - return FALSE; - } - break; - default: - return FALSE; - } - - GdiSetPixelFormat(hDC, iPixelFormat); -#endif - pixelFormat = iPixelFormat; return TRUE; } diff --git a/drivers/glide/x86/drv.inc b/drivers/glide/x86/drv.inc deleted file mode 100644 index a580954..0000000 --- a/drivers/glide/x86/drv.inc +++ /dev/null @@ -1,27 +0,0 @@ -%define FX_PACKEDCOLOR 1 - -%define GR_VERTEX_X_OFFSET 0 -%define GR_VERTEX_Y_OFFSET 4 -%define GR_VERTEX_OOZ_OFFSET 8 -%define GR_VERTEX_OOW_OFFSET 12 -%define GR_VERTEX_PARGB_OFFSET 16 -%define GR_VERTEX_SOW_TMU0_OFFSET 20 -%define GR_VERTEX_TOW_TMU0_OFFSET 24 -%define GR_VERTEX_OOW_TMU0_OFFSET 28 -%define GR_VERTEX_SOW_TMU1_OFFSET 32 -%define GR_VERTEX_TOW_TMU1_OFFSET 36 -%define GR_VERTEX_OOW_TMU1_OFFSET 40 -%define GR_VERTEX_FOG_OFFSET 44 -%define GR_VERTEX_PSPEC_OFFSET 52 -%define sizeof_GrVertex 64 - -%define TFX_OBJ_SSCALE 24 - -%define SETUP_TEX0 (1<<0) -%define SETUP_TEX1 (1<<1) -%define SETUP_PTX0 (1<<2) -%define SETUP_PTX1 (1<<3) -%define SETUP_FOGC (1<<4) -%define SETUP_SPEC (1<<5) -%define SETUP_MAX (1<<6) -%define SETUP_PSIZ (1<<6) diff --git a/drivers/glide/x86/drvgen.c b/drivers/glide/x86/drvgen.c index 8acff7c..745cfda 100644 --- a/drivers/glide/x86/drvgen.c +++ b/drivers/glide/x86/drvgen.c @@ -17,6 +17,7 @@ main (int argc, char **argv) const char *myname = argv[0]; char *out = NULL; FILE *f = stdout; + int c_header = 0; while (--argc) { char *p = *++argv; @@ -28,6 +29,9 @@ main (int argc, char **argv) out = *++argv; argc--; } + else if (!strcmp(p, "-c")) { + c_header = 1; + } } if (out != NULL) { @@ -38,6 +42,9 @@ main (int argc, char **argv) } } + if (c_header) + goto c_out; + fprintf(f, "%%define FX_PACKEDCOLOR\t\t\t%d\n", FX_PACKEDCOLOR); fprintf(f, "\n"); fprintf(f, "%%define GR_VERTEX_X_OFFSET\t\t%d\n", offsetof(GrVertex, x)); @@ -76,6 +83,38 @@ main (int argc, char **argv) fprintf(f, "%%define SETUP_MAX\t\t\t(1<<6)\n"); fprintf(f, "%%define SETUP_PSIZ\t\t\t(1<<6)\n"); + goto done; + +c_out: + fprintf(f, "#define SAGE_COMPILE_TIME_ASSERT(name, x) typedef int _chk_ ## name[(x) * 2 - 1]\n"); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(FX_PACKEDCOLOR_,FX_PACKEDCOLOR==%d);\n", FX_PACKEDCOLOR); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_X_OFFSET,offsetof(GrVertex, x)==%d);\n", offsetof(GrVertex, x)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_Y_OFFSET,offsetof(GrVertex, y)==%d);\n", offsetof(GrVertex, y)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_OOZ_OFFSET,offsetof(GrVertex, ooz)==%d);\n", offsetof(GrVertex, ooz)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_OOW_OFFSET,offsetof(GrVertex, oow)==%d);\n", offsetof(GrVertex, oow)); +#if FX_PACKEDCOLOR + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_PARGB_OFFSET,offsetof(GrVertex, pargb)==%d);\n", offsetof(GrVertex, pargb)); +#else + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_RGB_OFFSET,offsetof(GrVertex, r)==%d);\n", offsetof(GrVertex, r)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_A_OFFSET,offsetof(GrVertex, a)==%d);\n", offsetof(GrVertex, a)); +#endif + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_SOW_TMU0_OFFSET,offsetof(GrVertex, tmuvtx[0].sow)==%d);\n", offsetof(GrVertex, tmuvtx[0].sow)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_TOW_TMU0_OFFSET,offsetof(GrVertex, tmuvtx[0].tow)==%d);\n", offsetof(GrVertex, tmuvtx[0].tow)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_OOW_TMU0_OFFSET,offsetof(GrVertex, tmuvtx[0].oow)==%d);\n", offsetof(GrVertex, tmuvtx[0].oow)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_SOW_TMU1_OFFSET,offsetof(GrVertex, tmuvtx[1].sow)==%d);\n", offsetof(GrVertex, tmuvtx[1].sow)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_TOW_TMU1_OFFSET,offsetof(GrVertex, tmuvtx[1].tow)==%d);\n", offsetof(GrVertex, tmuvtx[1].tow)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_OOW_TMU1_OFFSET,offsetof(GrVertex, tmuvtx[1].oow)==%d);\n", offsetof(GrVertex, tmuvtx[1].oow)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_FOG_OFFSET,offsetof(GrVertex, fog)==%d);\n", offsetof(GrVertex, fog)); +#if FX_PACKEDCOLOR + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_PSPEC_OFFSET,offsetof(GrVertex, pspec)==%d);\n", offsetof(GrVertex, pspec)); +#else + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_SPEC_OFFSET,offsetof(GrVertex, r1)==%d);\n", offsetof(GrVertex, r1)); +#endif + /*fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GR_VERTEX_PAD_OFFSET,offsetof(GrVertex, pad)==%d);\n", offsetof(GrVertex, pad));*/ + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(sizeof_GrVertex,sizeof(GrVertex)==%d);\n", sizeof(GrVertex)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TFX_OBJ_SSCALE,offsetof(TFX_OBJ, sscale)==%d);\n", offsetof(TFX_OBJ, sscale)); + +done: if (out != NULL) { fclose(f); } diff --git a/drivers/glide/x86/sse_vbtmp.asm b/drivers/glide/x86/sse_vbtmp.asm index f25354a..f831378 100644 --- a/drivers/glide/x86/sse_vbtmp.asm +++ b/drivers/glide/x86/sse_vbtmp.asm @@ -13,11 +13,11 @@ proc TAG(sse_emitvertices) ; Viewport transformation mov ebx, [tnl_vb + TNL_VB_CLIPMASK] mov esi, [tnl_vb + TNL_VB_NDC] - movaps xmm7, [i_xxx0] + MOVUAPS xmm7, [i_xxx0] movss xmm2, [ctx_mx_viewport + MAT_MAT + 00 * 4] movss xmm1, [ctx_mx_viewport + MAT_MAT + 05 * 4] movss xmm3, [ctx_mx_viewport + MAT_MAT + 10 * 4] - movaps xmm5, [f_0010] + MOVUAPS xmm5, [f_0010] shufps xmm2, xmm1, SHUF(X, Y, X, Y) orps xmm3, xmm5 movups xmm4, [ctx_mx_viewport + MAT_MAT + 12 * 4] @@ -29,10 +29,10 @@ proc TAG(sse_emitvertices) mov dword [edi + GR_VERTEX_OOW_OFFSET], 0x3f800000 test al, al jnz .1 - movaps xmm0, [esi] + MOVUAPS xmm0, [esi] mulps xmm0, xmm2 addps xmm0, xmm4 - movaps [edi + GR_VERTEX_X_OFFSET], xmm0 + MOVUAPS [edi + GR_VERTEX_X_OFFSET], xmm0 align 16 .1: inc ebx @@ -50,11 +50,11 @@ proc TAG(sse_emitvertices) mov esi, [tnl_vb + TNL_VB_COLOR0_DATA] mov ebx, [tnl_vb + TNL_VB_COLOR0_STRIDE] xorps xmm6, xmm6 - movaps xmm7, [f_bbbb] + MOVUAPS xmm7, [f_bbbb] shl ebx, 4 align 16 .2: - movaps xmm0, [esi] + MOVUAPS xmm0, [esi] mulps xmm0, xmm7 %if FX_PACKEDCOLOR shufps xmm0, xmm0, SHUF(Z, Y, X, W) @@ -68,7 +68,7 @@ proc TAG(sse_emitvertices) %else ; !FX_PACKEDCOLOR minps xmm0, xmm7 maxps xmm0, xmm6 - movaps [edi + GR_VERTEX_RGB_OFFSET], xmm0 + MOVUAPS [edi + GR_VERTEX_RGB_OFFSET], xmm0 %endif ; !FX_PACKEDCOLOR add esi, ebx add edi, sizeof_GrVertex @@ -100,7 +100,7 @@ proc TAG(sse_emitvertices) align 16 .3: movss xmm6, [edi + GR_VERTEX_OOW_OFFSET] - movaps xmm0, [esi] + MOVUAPS xmm0, [esi] shufps xmm6, xmm6, SHUF(X, X, X, X) mulps xmm0, xmm7 mulps xmm0, xmm6 @@ -140,7 +140,7 @@ proc TAG(sse_emitvertices) align 16 .4: movss xmm6, [edi + GR_VERTEX_OOW_OFFSET] - movaps xmm0, [esi] + MOVUAPS xmm0, [esi] shufps xmm6, xmm6, SHUF(X, X, X, X) mulps xmm0, xmm7 mulps xmm0, xmm6 @@ -164,11 +164,11 @@ proc TAG(sse_emitvertices) mov esi, [tnl_vb + TNL_VB_COLOR1_DATA] mov ebx, [tnl_vb + TNL_VB_COLOR1_STRIDE] xorps xmm6, xmm6 - movaps xmm7, [f_bbbb] + MOVUAPS xmm7, [f_bbbb] shl ebx, 4 align 16 .5: - movaps xmm0, [esi] + MOVUAPS xmm0, [esi] mulps xmm0, xmm7 %if FX_PACKEDCOLOR shufps xmm0, xmm0, SHUF(Z, Y, X, W) @@ -182,7 +182,7 @@ proc TAG(sse_emitvertices) %else ; !FX_PACKEDCOLOR minps xmm0, xmm7 maxps xmm0, xmm6 - movaps [edi + GR_VERTEX_SPEC_OFFSET], xmm0 + MOVUAPS [edi + GR_VERTEX_SPEC_OFFSET], xmm0 %endif ; !FX_PACKEDCOLOR add esi, ebx add edi, sizeof_GrVertex diff --git a/g3sdk/include/3dfx.h b/g3sdk/include/3dfx.h new file mode 100644 index 0000000..6b046bc --- /dev/null +++ b/g3sdk/include/3dfx.h @@ -0,0 +1,130 @@ +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +** +** $Revision: 1.3.4.5 $ +** $Date: 2005/08/13 21:07:03 $ +*/ +#ifndef __3DFX_H__ +#define __3DFX_H__ + +/* +** basic data types +*/ +typedef unsigned char FxU8; +typedef signed char FxI8; +typedef unsigned short FxU16; +typedef signed short FxI16; +#if defined(__DJGPP__)||defined(_WIN32) +typedef signed long FxI32; +typedef unsigned long FxU32; +#else +typedef signed int FxI32; +typedef unsigned int FxU32; +#endif +typedef unsigned long AnyPtr; +typedef int FxBool; +typedef float FxFloat; +typedef double FxDouble; + +/* +** color types +*/ +typedef unsigned long FxColor_t; +typedef struct { float r, g, b, a; } FxColor4; + +/* +** fundamental types +*/ +#define FXTRUE 1 +#define FXFALSE 0 + +/* +** helper macros +*/ +#define FXUNUSED( a ) ((void)(a)) +#define FXBIT( i ) ( 1 << (i) ) + +/* +** export macros +*/ + +#if defined(__MSC__) || defined(_MSC_VER) +# if defined (MSVC16) +# define FX_ENTRY +# define FX_CALL +# else +# define FX_ENTRY __declspec( dllimport ) +# define FX_CALL __stdcall +# endif +#elif defined(__WATCOMC__) +# define FX_ENTRY extern +# define FX_CALL __stdcall +#elif defined (__IBMC__) || defined (__IBMCPP__) + /* IBM Visual Age C/C++: */ +# define FX_ENTRY extern +# define FX_CALL __stdcall +#elif defined(__DJGPP__) +# define FX_ENTRY extern +# define FX_CALL +#elif defined(__MINGW32__) +# define FX_ENTRY extern +# define FX_CALL __stdcall +#elif defined(__unix__) +# define FX_ENTRY extern +# define FX_CALL +#elif defined(__MWERKS__) +# if macintosh +# define FX_ENTRY extern +# define FX_CALL +# else /* !macintosh */ +# error "Unknown MetroWerks target platform" +# endif /* !macintosh */ +#else +# warning define FX_ENTRY & FX_CALL for your compiler +# define FX_ENTRY extern +# define FX_CALL +#endif + +/* +** x86 compiler specific stuff +*/ +#if defined(__BORLANDC_) +# define REALMODE + +# define REGW( a, b ) ((a).x.b) +# define REGB( a, b ) ((a).h.b) +# define INT86( a, b, c ) int86(a,b,c) +# define INT86X( a, b, c, d ) int86x(a,b,c,d) + +# define RM_SEG( a ) FP_SEG( a ) +# define RM_OFF( a ) FP_OFF( a ) +#elif defined(__WATCOMC__) +# undef FP_SEG +# undef FP_OFF + +# define REGW( a, b ) ((a).w.b) +# define REGB( a, b ) ((a).h.b) +# define INT86( a, b, c ) int386(a,b,c) +# define INT86X( a, b, c, d ) int386x(a,b,c,d) + +# define RM_SEG( a ) ( ( ( ( FxU32 ) (a) ) & 0x000F0000 ) >> 4 ) +# define RM_OFF( a ) ( ( FxU16 ) (a) ) +#endif + +#endif /* !__3DFX_H__ */ diff --git a/g3sdk/include/g3ext.h b/g3sdk/include/g3ext.h new file mode 100644 index 0000000..ebb1682 --- /dev/null +++ b/g3sdk/include/g3ext.h @@ -0,0 +1,187 @@ +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +*/ + +/* +** H3EXT.H +** +** The following #defines are relevant when using Glide: +** +** One of the following "platform constants" must be defined during +** compilation: +** +** __DOS__ Defined for 32-bit DOS applications +** __WIN32__ Defined for 32-bit Windows applications +** __sparc__ Defined for Sun Solaris/SunOS +** __linux__ Defined for Linux applications +** __FreeBSD__ Defined for FreeBSD applications +** __NetBSD__ Defined for NetBSD applications +** __OpenBSD__ Defined for OpenBSD applications +** __IRIX__ Defined for SGI Irix applications +** +*/ +#ifndef __H3EXT_H__ +#define __H3EXT_H__ + +#include <3dfx.h> +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** ----------------------------------------------------------------------- +** TYPE DEFINITIONS +** ----------------------------------------------------------------------- +*/ +/* +** ----------------------------------------------------------------------- +** CONSTANTS AND TYPES +** ----------------------------------------------------------------------- +*/ + +/* + * gregk 5/3/99 + * Constants defined for SSTH3_ALPHADITHERMODE registry key + */ + +#define OPTIMAL 1 +#define SHARPER 2 +#define SMOOTHER 3 + +/* tbext */ +#define GR_BUFFER_TEXTUREBUFFER_EXT 0x6 +#define GR_BUFFER_TEXTUREAUXBUFFER_EXT 0x7 + +typedef FxU32 GrPixelFormat_t; + +#define GR_PIXFMT_I_8 0x0001 +#define GR_PIXFMT_AI_88 0x0002 +#define GR_PIXFMT_RGB_565 0x0003 +#define GR_PIXFMT_ARGB_1555 0x0004 +#define GR_PIXFMT_ARGB_8888 0x0005 +#define GR_PIXFMT_AA_2_RGB_565 0x0006 +#define GR_PIXFMT_AA_2_ARGB_1555 0x0007 +#define GR_PIXFMT_AA_2_ARGB_8888 0x0008 +#define GR_PIXFMT_AA_4_RGB_565 0x0009 +#define GR_PIXFMT_AA_4_ARGB_1555 0x000a +#define GR_PIXFMT_AA_4_ARGB_8888 0x000b +#define GR_PIXFMT_AA_8_RGB_565 0x000c /* 8xaa */ +#define GR_PIXFMT_AA_8_ARGB_1555 0x000d +#define GR_PIXFMT_AA_8_ARGB_8888 0x000e + + +#define GR_LFBWRITEMODE_Z32 0x0008 + +typedef FxU32 GrAAMode_t; + +#define GR_AA_NONE 0x0000 +#define GR_AA_4SAMPLES 0x0001 + +typedef FxU8 GrStencil_t; + +typedef FxU32 GrStencilOp_t; +#define GR_STENCILOP_KEEP 0x00 /* keep current value */ +#define GR_STENCILOP_ZERO 0x01 /* set to zero */ +#define GR_STENCILOP_REPLACE 0x02 /* replace with reference value */ +#define GR_STENCILOP_INCR_CLAMP 0x03 /* increment - clamp */ +#define GR_STENCILOP_DECR_CLAMP 0x04 /* decrement - clamp */ +#define GR_STENCILOP_INVERT 0x05 /* bitwise inversion */ +#define GR_STENCILOP_INCR_WRAP 0x06 /* increment - wrap */ +#define GR_STENCILOP_DECR_WRAP 0x07 /* decrement - wrap */ + +#define GR_TEXTURE_UMA_EXT 0x06 +#define GR_STENCIL_MODE_EXT 0x07 +#define GR_OPENGL_MODE_EXT 0x08 + +typedef FxU32 GrCCUColor_t; + +typedef FxU32 GrACUColor_t; + +typedef FxU32 GrTCCUColor_t; + +typedef FxU32 GrTACUColor_t; + +#define GR_CMBX_ZERO 0x00 +#define GR_CMBX_TEXTURE_ALPHA 0x01 +#define GR_CMBX_ALOCAL 0x02 +#define GR_CMBX_AOTHER 0x03 +#define GR_CMBX_B 0x04 +#define GR_CMBX_CONSTANT_ALPHA 0x05 +#define GR_CMBX_CONSTANT_COLOR 0x06 +#define GR_CMBX_DETAIL_FACTOR 0x07 +#define GR_CMBX_ITALPHA 0x08 +#define GR_CMBX_ITRGB 0x09 +#define GR_CMBX_LOCAL_TEXTURE_ALPHA 0x0a +#define GR_CMBX_LOCAL_TEXTURE_RGB 0x0b +#define GR_CMBX_LOD_FRAC 0x0c +#define GR_CMBX_OTHER_TEXTURE_ALPHA 0x0d +#define GR_CMBX_OTHER_TEXTURE_RGB 0x0e +#define GR_CMBX_TEXTURE_RGB 0x0f +#define GR_CMBX_TMU_CALPHA 0x10 +#define GR_CMBX_TMU_CCOLOR 0x11 + +typedef FxU32 GrCombineMode_t; +#define GR_FUNC_MODE_ZERO 0x00 +#define GR_FUNC_MODE_X 0x01 +#define GR_FUNC_MODE_ONE_MINUS_X 0x02 +#define GR_FUNC_MODE_NEGATIVE_X 0x03 +#define GR_FUNC_MODE_X_MINUS_HALF 0x04 + +typedef FxU32 GrAlphaBlendOp_t; +#define GR_BLEND_OP_ADD 0x00 +#define GR_BLEND_OP_SUB 0x01 +#define GR_BLEND_OP_REVSUB 0x02 + +#define GR_BLEND_SAME_COLOR_EXT 0x08 +#define GR_BLEND_ONE_MINUS_SAME_COLOR_EXT 0x09 + +/* Napalm extensions to GrTextureFormat_t */ +#define GR_TEXFMT_ARGB_CMP_FXT1 0x11 +#define GR_TEXFMT_ARGB_8888 0x12 +#define GR_TEXFMT_YUYV_422 0x13 +#define GR_TEXFMT_UYVY_422 0x14 +#define GR_TEXFMT_AYUV_444 0x15 +#define GR_TEXFMT_ARGB_CMP_DXT1 0x16 +#define GR_TEXFMT_ARGB_CMP_DXT2 0x17 +#define GR_TEXFMT_ARGB_CMP_DXT3 0x18 +#define GR_TEXFMT_ARGB_CMP_DXT4 0x19 +#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A +#define GR_TEXTFMT_RGB_888 0xFF + +/* Napalm extensions to GrLOD_t */ +#define GR_LOD_LOG2_2048 0xb +#define GR_LOD_LOG2_1024 0xa +#define GR_LOD_LOG2_512 0x9 + +/* Napalm extensions to GrTexBaseRange_t */ +#define GR_TEXBASE_2048 0x7 +#define GR_TEXBASE_1024 0x6 +#define GR_TEXBASE_512 0x5 +#define GR_TEXBASE_256_TO_1 0x4 + +#ifdef __cplusplus +} +#endif + +#include + +#endif /* __H3EXT_H__ */ diff --git a/g3sdk/include/glide.h b/g3sdk/include/glide.h new file mode 100644 index 0000000..5308b6f --- /dev/null +++ b/g3sdk/include/glide.h @@ -0,0 +1,946 @@ +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +*/ + +/* +** GLIDE.H +** +** The following #defines are relevant when using Glide: +** +** One of the following "platform constants" must be defined during +** compilation: +** +** __DOS__ Defined for 32-bit DOS applications +** __WIN32__ Defined for 32-bit Windows applications +** __sparc__ Defined for Sun Solaris/SunOS +** __linux__ Defined for Linux applications +** __FreeBSD__ Defined for FreeBSD applications +** __NetBSD__ Defined for NetBSD applications +** __OpenBSD__ Defined for OpenBSD applications +** __IRIX__ Defined for SGI Irix applications +** +*/ +#ifndef __GLIDE_H__ +#define __GLIDE_H__ + +#include <3dfx.h> +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** ----------------------------------------------------------------------- +** TYPE DEFINITIONS +** ----------------------------------------------------------------------- +*/ +typedef FxU32 GrColor_t; +typedef FxU8 GrAlpha_t; +typedef FxU32 GrMipMapId_t; +typedef FxU32 GrStipplePattern_t; +typedef FxU8 GrFog_t; +typedef unsigned long GrContext_t; +typedef int (FX_CALL *GrProc)(); + +/* +** ----------------------------------------------------------------------- +** CONSTANTS AND TYPES +** ----------------------------------------------------------------------- +*/ +#define GR_NULL_MIPMAP_HANDLE ((GrMipMapId_t) -1) + +#define GR_MIPMAPLEVELMASK_EVEN FXBIT(0) +#define GR_MIPMAPLEVELMASK_ODD FXBIT(1) +#define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD ) + +#define GR_LODBIAS_BILINEAR 0.5 +#define GR_LODBIAS_TRILINEAR 0.0 + +typedef FxI32 GrChipID_t; +#define GR_TMU0 0x0 +#define GR_TMU1 0x1 +#define GR_TMU2 0x2 + +#define GR_FBI 0x0 + +typedef FxI32 GrCombineFunction_t; +#define GR_COMBINE_FUNCTION_ZERO 0x0 +#define GR_COMBINE_FUNCTION_NONE GR_COMBINE_FUNCTION_ZERO +#define GR_COMBINE_FUNCTION_LOCAL 0x1 +#define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2 +#define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3 +#define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER +#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4 +#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5 +#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6 +#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7 +#define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL +#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8 +#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9 +#define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL +#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10 + +typedef FxI32 GrCombineFactor_t; +#define GR_COMBINE_FACTOR_ZERO 0x0 +#define GR_COMBINE_FACTOR_NONE GR_COMBINE_FACTOR_ZERO +#define GR_COMBINE_FACTOR_LOCAL 0x1 +#define GR_COMBINE_FACTOR_OTHER_ALPHA 0x2 +#define GR_COMBINE_FACTOR_LOCAL_ALPHA 0x3 +#define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4 +#define GR_COMBINE_FACTOR_TEXTURE_RGB 0x5 +#define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA +#define GR_COMBINE_FACTOR_LOD_FRACTION 0x5 +#define GR_COMBINE_FACTOR_ONE 0x8 +#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9 +#define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa +#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb +#define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc +#define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA +#define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd + + +typedef FxI32 GrCombineLocal_t; +#define GR_COMBINE_LOCAL_ITERATED 0x0 +#define GR_COMBINE_LOCAL_CONSTANT 0x1 +#define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT +#define GR_COMBINE_LOCAL_DEPTH 0x2 + +typedef FxI32 GrCombineOther_t; +#define GR_COMBINE_OTHER_ITERATED 0x0 +#define GR_COMBINE_OTHER_TEXTURE 0x1 +#define GR_COMBINE_OTHER_CONSTANT 0x2 +#define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT + + +typedef FxI32 GrAlphaSource_t; +#define GR_ALPHASOURCE_CC_ALPHA 0x0 +#define GR_ALPHASOURCE_ITERATED_ALPHA 0x1 +#define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2 +#define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3 + + +typedef FxI32 GrColorCombineFnc_t; +#define GR_COLORCOMBINE_ZERO 0x0 +#define GR_COLORCOMBINE_CCRGB 0x1 +#define GR_COLORCOMBINE_ITRGB 0x2 +#define GR_COLORCOMBINE_ITRGB_DELTA0 0x3 +#define GR_COLORCOMBINE_DECAL_TEXTURE 0x4 +#define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa +#define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb +#define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc +#define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd +#define GR_COLORCOMBINE_DIFF_SPEC_A 0xe +#define GR_COLORCOMBINE_DIFF_SPEC_B 0xf +#define GR_COLORCOMBINE_ONE 0x10 + +typedef FxI32 GrAlphaBlendFnc_t; +#define GR_BLEND_ZERO 0x0 +#define GR_BLEND_SRC_ALPHA 0x1 +#define GR_BLEND_SRC_COLOR 0x2 +#define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR +#define GR_BLEND_DST_ALPHA 0x3 +#define GR_BLEND_ONE 0x4 +#define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5 +#define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6 +#define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR +#define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7 +#define GR_BLEND_RESERVED_8 0x8 +#define GR_BLEND_RESERVED_9 0x9 +#define GR_BLEND_RESERVED_A 0xa +#define GR_BLEND_RESERVED_B 0xb +#define GR_BLEND_RESERVED_C 0xc +#define GR_BLEND_RESERVED_D 0xd +#define GR_BLEND_RESERVED_E 0xe +#define GR_BLEND_ALPHA_SATURATE 0xf +#define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE + +typedef FxI32 GrAspectRatio_t; +#define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */ +#define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */ +#define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */ +#define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */ +#define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */ +#define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */ +#define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */ + +typedef FxI32 GrBuffer_t; +#define GR_BUFFER_FRONTBUFFER 0x0 +#define GR_BUFFER_BACKBUFFER 0x1 +#define GR_BUFFER_AUXBUFFER 0x2 +#define GR_BUFFER_DEPTHBUFFER 0x3 +#define GR_BUFFER_ALPHABUFFER 0x4 +#define GR_BUFFER_TRIPLEBUFFER 0x5 + +typedef FxI32 GrChromakeyMode_t; +#define GR_CHROMAKEY_DISABLE 0x0 +#define GR_CHROMAKEY_ENABLE 0x1 + +typedef FxI32 GrChromaRangeMode_t; +#define GR_CHROMARANGE_RGB_ALL_EXT 0x0 + +#define GR_CHROMARANGE_DISABLE_EXT 0x00 +#define GR_CHROMARANGE_ENABLE_EXT 0x01 + +typedef FxI32 GrTexChromakeyMode_t; +#define GR_TEXCHROMA_DISABLE_EXT 0x0 +#define GR_TEXCHROMA_ENABLE_EXT 0x1 + +#define GR_TEXCHROMARANGE_RGB_ALL_EXT 0x0 + +typedef FxI32 GrCmpFnc_t; +#define GR_CMP_NEVER 0x0 +#define GR_CMP_LESS 0x1 +#define GR_CMP_EQUAL 0x2 +#define GR_CMP_LEQUAL 0x3 +#define GR_CMP_GREATER 0x4 +#define GR_CMP_NOTEQUAL 0x5 +#define GR_CMP_GEQUAL 0x6 +#define GR_CMP_ALWAYS 0x7 + +typedef FxI32 GrColorFormat_t; +#define GR_COLORFORMAT_ARGB 0x0 +#define GR_COLORFORMAT_ABGR 0x1 + +#define GR_COLORFORMAT_RGBA 0x2 +#define GR_COLORFORMAT_BGRA 0x3 + +typedef FxI32 GrCullMode_t; +#define GR_CULL_DISABLE 0x0 +#define GR_CULL_NEGATIVE 0x1 +#define GR_CULL_POSITIVE 0x2 + +typedef FxI32 GrDepthBufferMode_t; +#define GR_DEPTHBUFFER_DISABLE 0x0 +#define GR_DEPTHBUFFER_ZBUFFER 0x1 +#define GR_DEPTHBUFFER_WBUFFER 0x2 +#define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS 0x3 +#define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS 0x4 + +typedef FxI32 GrDitherMode_t; +#define GR_DITHER_DISABLE 0x0 +#define GR_DITHER_2x2 0x1 +#define GR_DITHER_4x4 0x2 + +typedef FxI32 GrStippleMode_t; +#define GR_STIPPLE_DISABLE 0x0 +#define GR_STIPPLE_PATTERN 0x1 +#define GR_STIPPLE_ROTATE 0x2 + +typedef FxI32 GrFogMode_t; +#define GR_FOG_DISABLE 0x0 +#define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1 +#define GR_FOG_WITH_TABLE_ON_Q 0x2 +#define GR_FOG_WITH_TABLE_ON_W GR_FOG_WITH_TABLE_ON_Q +#define GR_FOG_WITH_ITERATED_Z 0x3 +#define GR_FOG_WITH_ITERATED_ALPHA_EXT 0x4 +#define GR_FOG_MULT2 0x100 +#define GR_FOG_ADD2 0x200 + +typedef FxU32 GrLock_t; +#define GR_LFB_READ_ONLY 0x00 +#define GR_LFB_WRITE_ONLY 0x01 +#define GR_LFB_IDLE 0x00 +#define GR_LFB_NOIDLE 0x10 + +#define GR_LFB_WRITE_ONLY_EXPLICIT_EXT 0x02 /* explicitly not allow reading from the lfb pointer */ + +typedef FxI32 GrLfbBypassMode_t; +#define GR_LFBBYPASS_DISABLE 0x0 +#define GR_LFBBYPASS_ENABLE 0x1 + +typedef FxI32 GrLfbWriteMode_t; +#define GR_LFBWRITEMODE_565 0x0 /* RGB:RGB */ +#define GR_LFBWRITEMODE_555 0x1 /* RGB:RGB */ +#define GR_LFBWRITEMODE_1555 0x2 /* ARGB:ARGB */ +#define GR_LFBWRITEMODE_RESERVED1 0x3 +#define GR_LFBWRITEMODE_888 0x4 /* RGB */ +#define GR_LFBWRITEMODE_8888 0x5 /* ARGB */ +#define GR_LFBWRITEMODE_RESERVED2 0x6 +#define GR_LFBWRITEMODE_RESERVED3 0x7 +#define GR_LFBWRITEMODE_RESERVED4 0x8 +#define GR_LFBWRITEMODE_RESERVED5 0x9 +#define GR_LFBWRITEMODE_RESERVED6 0xa +#define GR_LFBWRITEMODE_RESERVED7 0xb +#define GR_LFBWRITEMODE_565_DEPTH 0xc /* RGB:DEPTH */ +#define GR_LFBWRITEMODE_555_DEPTH 0xd /* RGB:DEPTH */ +#define GR_LFBWRITEMODE_1555_DEPTH 0xe /* ARGB:DEPTH */ +#define GR_LFBWRITEMODE_ZA16 0xf /* DEPTH:DEPTH */ +#define GR_LFBWRITEMODE_ANY 0xFF + + +typedef FxI32 GrOriginLocation_t; +#define GR_ORIGIN_UPPER_LEFT 0x0 +#define GR_ORIGIN_LOWER_LEFT 0x1 +#define GR_ORIGIN_ANY 0xFF + +typedef struct { + int size; + void *lfbPtr; + FxU32 strideInBytes; + GrLfbWriteMode_t writeMode; + GrOriginLocation_t origin; +} GrLfbInfo_t; + +typedef FxI32 GrLOD_t; +#define GR_LOD_LOG2_256 0x8 +#define GR_LOD_LOG2_128 0x7 +#define GR_LOD_LOG2_64 0x6 +#define GR_LOD_LOG2_32 0x5 +#define GR_LOD_LOG2_16 0x4 +#define GR_LOD_LOG2_8 0x3 +#define GR_LOD_LOG2_4 0x2 +#define GR_LOD_LOG2_2 0x1 +#define GR_LOD_LOG2_1 0x0 + +typedef FxI32 GrMipMapMode_t; +#define GR_MIPMAP_DISABLE 0x0 /* no mip mapping */ +#define GR_MIPMAP_NEAREST 0x1 /* use nearest mipmap */ +#define GR_MIPMAP_NEAREST_DITHER 0x2 /* GR_MIPMAP_NEAREST + LOD dith */ + +typedef FxI32 GrSmoothingMode_t; +#define GR_SMOOTHING_DISABLE 0x0 +#define GR_SMOOTHING_ENABLE 0x1 + +typedef FxI32 GrTextureClampMode_t; +#define GR_TEXTURECLAMP_WRAP 0x0 +#define GR_TEXTURECLAMP_CLAMP 0x1 +#define GR_TEXTURECLAMP_MIRROR_EXT 0x2 + +typedef FxI32 GrTextureCombineFnc_t; +#define GR_TEXTURECOMBINE_ZERO 0x0 /* texout = 0 */ +#define GR_TEXTURECOMBINE_DECAL 0x1 /* texout = texthis */ +#define GR_TEXTURECOMBINE_OTHER 0x2 /* this TMU in passthru mode */ +#define GR_TEXTURECOMBINE_ADD 0x3 /* tout = tthis + t(this+1) */ +#define GR_TEXTURECOMBINE_MULTIPLY 0x4 /* texout = tthis * t(this+1) */ +#define GR_TEXTURECOMBINE_SUBTRACT 0x5 /* Sutract from upstream TMU */ +#define GR_TEXTURECOMBINE_DETAIL 0x6 /* detail--detail on tthis */ +#define GR_TEXTURECOMBINE_DETAIL_OTHER 0x7 /* detail--detail on tthis+1 */ +#define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8 /* trilinear--odd levels tthis*/ +#define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9 /*trilinear--even levels tthis*/ +#define GR_TEXTURECOMBINE_ONE 0xa /* texout = 0xFFFFFFFF */ + +typedef FxI32 GrTextureFilterMode_t; +#define GR_TEXTUREFILTER_POINT_SAMPLED 0x0 +#define GR_TEXTUREFILTER_BILINEAR 0x1 + +typedef FxI32 GrTextureFormat_t; +/* KoolSmoky - */ +#define GR_TEXFMT_8BIT 0x0 +#define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT +#define GR_TEXFMT_YIQ_422 0x1 +#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */ +#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */ +#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4 +#define GR_TEXFMT_P_8 0x5 /* 8-bit palette */ +#define GR_TEXFMT_RSVD0 0x6 /* GR_TEXFMT_P_8_RGBA */ +#define GR_TEXFMT_P_8_6666 GR_TEXFMT_RSVD0 +#define GR_TEXFMT_P_8_6666_EXT GR_TEXFMT_RSVD0 +#define GR_TEXFMT_RSVD1 0x7 +#define GR_TEXFMT_16BIT 0x8 +#define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT +#define GR_TEXFMT_AYIQ_8422 0x9 +#define GR_TEXFMT_RGB_565 0xa +#define GR_TEXFMT_ARGB_1555 0xb +#define GR_TEXFMT_ARGB_4444 0xc +#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd +#define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */ +#define GR_TEXFMT_RSVD2 0xf +#define GR_TEXFMT_RSVD4 GR_TEXFMT_RSVD2 + +typedef FxU32 GrTexTable_t; +#define GR_TEXTABLE_NCC0 0x0 +#define GR_TEXTABLE_NCC1 0x1 +#define GR_TEXTABLE_PALETTE 0x2 +#define GR_TEXTABLE_PALETTE_6666_EXT 0x3 + +typedef FxU32 GrNCCTable_t; +#define GR_NCCTABLE_NCC0 0x0 +#define GR_NCCTABLE_NCC1 0x1 + +typedef FxU32 GrTexBaseRange_t; +#define GR_TEXBASE_256 0x3 +#define GR_TEXBASE_128 0x2 +#define GR_TEXBASE_64 0x1 +#define GR_TEXBASE_32_TO_1 0x0 + + +typedef FxU32 GrEnableMode_t; +#define GR_MODE_DISABLE 0x0 +#define GR_MODE_ENABLE 0x1 + +#define GR_AA_ORDERED 0x01 +#define GR_ALLOW_MIPMAP_DITHER 0x02 +#define GR_PASSTHRU 0x03 +#define GR_SHAMELESS_PLUG 0x04 +#define GR_VIDEO_SMOOTHING 0x05 + +typedef FxU32 GrCoordinateSpaceMode_t; +#define GR_WINDOW_COORDS 0x00 +#define GR_CLIP_COORDS 0x01 + +/* Types of data in strips */ +#define GR_FLOAT 0 +#define GR_U8 1 + +/* Parameters for strips */ +#define GR_PARAM_XY 0x01 +#define GR_PARAM_Z 0x02 +#define GR_PARAM_W 0x03 +#define GR_PARAM_Q 0x04 +#define GR_PARAM_FOG_EXT 0x05 + +#define GR_PARAM_A 0x10 + +#define GR_PARAM_RGB 0x20 + +#define GR_PARAM_PARGB 0x30 + +#define GR_PARAM_ST0 0x40 +#define GR_PARAM_ST1 GR_PARAM_ST0+1 +#define GR_PARAM_ST2 GR_PARAM_ST0+2 + +#define GR_PARAM_Q0 0x50 +#define GR_PARAM_Q1 GR_PARAM_Q0+1 +#define GR_PARAM_Q2 GR_PARAM_Q0+2 + +#define GR_PARAM_DISABLE 0x00 +#define GR_PARAM_ENABLE 0x01 + +/* +** grDrawVertexArray/grDrawVertexArrayContiguous primitive type +*/ +#define GR_POINTS 0 +#define GR_LINE_STRIP 1 +#define GR_LINES 2 +#define GR_POLYGON 3 +#define GR_TRIANGLE_STRIP 4 +#define GR_TRIANGLE_FAN 5 +#define GR_TRIANGLES 6 +#define GR_TRIANGLE_STRIP_CONTINUE 7 +#define GR_TRIANGLE_FAN_CONTINUE 8 + +/* +** grGet/grReset types +*/ +#define GR_BITS_DEPTH 0x01 +#define GR_BITS_RGBA 0x02 +#define GR_FIFO_FULLNESS 0x03 +#define GR_FOG_TABLE_ENTRIES 0x04 +#define GR_GAMMA_TABLE_ENTRIES 0x05 +#define GR_GLIDE_STATE_SIZE 0x06 +#define GR_GLIDE_VERTEXLAYOUT_SIZE 0x07 +#define GR_IS_BUSY 0x08 +#define GR_LFB_PIXEL_PIPE 0x09 +#define GR_MAX_TEXTURE_SIZE 0x0a +#define GR_MAX_TEXTURE_ASPECT_RATIO 0x0b +#define GR_MEMORY_FB 0x0c +#define GR_MEMORY_TMU 0x0d +#define GR_MEMORY_UMA 0x0e +#define GR_NUM_BOARDS 0x0f +#define GR_NON_POWER_OF_TWO_TEXTURES 0x10 +#define GR_NUM_FB 0x11 +#define GR_NUM_SWAP_HISTORY_BUFFER 0x12 +#define GR_NUM_TMU 0x13 +#define GR_PENDING_BUFFERSWAPS 0x14 +#define GR_REVISION_FB 0x15 +#define GR_REVISION_TMU 0x16 +#define GR_STATS_LINES 0x17 /* grGet/grReset */ +#define GR_STATS_PIXELS_AFUNC_FAIL 0x18 +#define GR_STATS_PIXELS_CHROMA_FAIL 0x19 +#define GR_STATS_PIXELS_DEPTHFUNC_FAIL 0x1a +#define GR_STATS_PIXELS_IN 0x1b +#define GR_STATS_PIXELS_OUT 0x1c +#define GR_STATS_PIXELS 0x1d /* grReset */ +#define GR_STATS_POINTS 0x1e /* grGet/grReset */ +#define GR_STATS_TRIANGLES_IN 0x1f +#define GR_STATS_TRIANGLES_OUT 0x20 +#define GR_STATS_TRIANGLES 0x21 /* grReset */ +#define GR_SWAP_HISTORY 0x22 +#define GR_SUPPORTS_PASSTHRU 0x23 +#define GR_TEXTURE_ALIGN 0x24 +#define GR_VIDEO_POSITION 0x25 +#define GR_VIEWPORT 0x26 +#define GR_WDEPTH_MIN_MAX 0x27 +#define GR_ZDEPTH_MIN_MAX 0x28 +#define GR_VERTEX_PARAMETER 0x29 +#define GR_BITS_GAMMA 0x2a +#define GR_GET_RESERVED_1 0x1000 + +/* +** grGetString types +*/ +#define GR_EXTENSION 0xa0 +#define GR_HARDWARE 0xa1 +#define GR_RENDERER 0xa2 +#define GR_VENDOR 0xa3 +#define GR_VERSION 0xa4 + +/* +** ----------------------------------------------------------------------- +** STRUCTURES +** ----------------------------------------------------------------------- +*/ + +typedef struct { + GrLOD_t smallLodLog2; + GrLOD_t largeLodLog2; + GrAspectRatio_t aspectRatioLog2; + GrTextureFormat_t format; + void *data; +} GrTexInfo; + +typedef struct GrSstPerfStats_s { + FxU32 pixelsIn; /* # pixels processed (minus buffer clears) */ + FxU32 chromaFail; /* # pixels not drawn due to chroma key */ + FxU32 zFuncFail; /* # pixels not drawn due to Z comparison */ + FxU32 aFuncFail; /* # pixels not drawn due to alpha comparison */ + FxU32 pixelsOut; /* # pixels drawn (including buffer clears) */ +} GrSstPerfStats_t; + +typedef struct { + GrScreenResolution_t resolution; + GrScreenRefresh_t refresh; + int numColorBuffers; + int numAuxBuffers; +} GrResolution; + +typedef GrResolution GlideResolution; + +#define GR_QUERY_ANY -1 + +typedef FxU32 GrLfbSrcFmt_t; +#define GR_LFB_SRC_FMT_565 0x00 +#define GR_LFB_SRC_FMT_555 0x01 +#define GR_LFB_SRC_FMT_1555 0x02 +#define GR_LFB_SRC_FMT_888 0x04 +#define GR_LFB_SRC_FMT_8888 0x05 +#define GR_LFB_SRC_FMT_565_DEPTH 0x0c +#define GR_LFB_SRC_FMT_555_DEPTH 0x0d +#define GR_LFB_SRC_FMT_1555_DEPTH 0x0e +#define GR_LFB_SRC_FMT_ZA16 0x0f +#define GR_LFB_SRC_FMT_RLE16 0x80 + +#ifdef H3D +#define GR_HINT_H3DENABLE 4 +#undef GR_HINTTYPE_MAX +#define GR_HINTTYPE_MAX 4 +#endif + +/* +** ----------------------------------------------------------------------- +** FUNCTION PROTOTYPES +** ----------------------------------------------------------------------- +*/ +#ifndef FX_GLIDE_NO_FUNC_PROTO +/* +** rendering functions +*/ +FX_ENTRY void FX_CALL +grDrawPoint( const void *pt ); + +FX_ENTRY void FX_CALL +grDrawLine( const void *v1, const void *v2 ); + +FX_ENTRY void FX_CALL +grDrawTriangle( const void *a, const void *b, const void *c ); + +FX_ENTRY void FX_CALL +grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode); + +FX_ENTRY void FX_CALL +grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers); + +FX_ENTRY void FX_CALL +grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride); + +/* +** Antialiasing Functions +*/ + +FX_ENTRY void FX_CALL +grAADrawTriangle( + const void *a, const void *b, const void *c, + FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias + ); + +/* +** buffer management +*/ +FX_ENTRY void FX_CALL +grBufferClear( GrColor_t color, GrAlpha_t alpha, FxU32 depth ); + +FX_ENTRY void FX_CALL +grBufferSwap( FxU32 swap_interval ); + +FX_ENTRY void FX_CALL +grRenderBuffer( GrBuffer_t buffer ); + +/* +** error management +*/ +typedef void (*GrErrorCallbackFnc_t)( const char *string, FxBool fatal ); + +FX_ENTRY void FX_CALL +grErrorSetCallback( GrErrorCallbackFnc_t fnc ); + +/* +** SST routines +*/ +FX_ENTRY void FX_CALL +grFinish(void); + +FX_ENTRY void FX_CALL +grFlush(void); + +FX_ENTRY GrContext_t FX_CALL +grSstWinOpen( + FxU32 hWnd, + GrScreenResolution_t screen_resolution, + GrScreenRefresh_t refresh_rate, + GrColorFormat_t color_format, + GrOriginLocation_t origin_location, + int nColBuffers, + int nAuxBuffers); + +FX_ENTRY FxBool FX_CALL +grSstWinClose( GrContext_t context ); + +FX_ENTRY void FX_CALL +grSetNumPendingBuffers(FxI32 NumPendingBuffers); + +FX_ENTRY FxBool FX_CALL +grSelectContext( GrContext_t context ); + +FX_ENTRY void FX_CALL +grSstOrigin(GrOriginLocation_t origin); + +FX_ENTRY void FX_CALL +grSstSelect( int which_sst ); + +/* +** Glide configuration and special effect maintenance functions +*/ +FX_ENTRY void FX_CALL +grAlphaBlendFunction( + GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, + GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df + ); + +FX_ENTRY void FX_CALL +grAlphaCombine( + GrCombineFunction_t function, GrCombineFactor_t factor, + GrCombineLocal_t local, GrCombineOther_t other, + FxBool invert + ); + +FX_ENTRY void FX_CALL +grAlphaControlsITRGBLighting( FxBool enable ); + +FX_ENTRY void FX_CALL +grAlphaTestFunction( GrCmpFnc_t function ); + +FX_ENTRY void FX_CALL +grAlphaTestReferenceValue( GrAlpha_t value ); + +FX_ENTRY void FX_CALL +grChromakeyMode( GrChromakeyMode_t mode ); + +FX_ENTRY void FX_CALL +grChromakeyValue( GrColor_t value ); + +FX_ENTRY void FX_CALL +grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy ); + +FX_ENTRY void FX_CALL +grColorCombine( + GrCombineFunction_t function, GrCombineFactor_t factor, + GrCombineLocal_t local, GrCombineOther_t other, + FxBool invert ); + +FX_ENTRY void FX_CALL +grColorMask( FxBool rgb, FxBool a ); + +FX_ENTRY void FX_CALL +grCullMode( GrCullMode_t mode ); + +FX_ENTRY void FX_CALL +grConstantColorValue( GrColor_t value ); + +FX_ENTRY void FX_CALL +grDepthBiasLevel( FxI32 level ); + +FX_ENTRY void FX_CALL +grDepthBufferFunction( GrCmpFnc_t function ); + +FX_ENTRY void FX_CALL +grDepthBufferMode( GrDepthBufferMode_t mode ); + +FX_ENTRY void FX_CALL +grDepthMask( FxBool mask ); + +FX_ENTRY void FX_CALL +grDisableAllEffects( void ); + +FX_ENTRY void FX_CALL +grDitherMode( GrDitherMode_t mode ); + +FX_ENTRY void FX_CALL +grFogColorValue( GrColor_t fogcolor ); + +FX_ENTRY void FX_CALL +grFogMode( GrFogMode_t mode ); + +FX_ENTRY void FX_CALL +grFogTable( const GrFog_t ft[] ); + +FX_ENTRY void FX_CALL +grLoadGammaTable( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue); + +FX_ENTRY void FX_CALL +grSplash(float x, float y, float width, float height, FxU32 frame); + +FX_ENTRY FxU32 FX_CALL +grGet( FxU32 pname, FxU32 plength, FxI32 *params ); + +FX_ENTRY const char * FX_CALL +grGetString( FxU32 pname ); + +FX_ENTRY FxI32 FX_CALL +grQueryResolutions( const GrResolution *resTemplate, GrResolution *output ); + +FX_ENTRY FxBool FX_CALL +grReset( FxU32 what ); + +FX_ENTRY GrProc FX_CALL +grGetProcAddress( char *procName ); + +FX_ENTRY void FX_CALL +grEnable( GrEnableMode_t mode ); + +FX_ENTRY void FX_CALL +grDisable( GrEnableMode_t mode ); + +FX_ENTRY void FX_CALL +grCoordinateSpace( GrCoordinateSpaceMode_t mode ); + +FX_ENTRY void FX_CALL +grDepthRange( FxFloat n, FxFloat f ); + +FX_ENTRY void FX_CALL +grStippleMode( GrStippleMode_t mode ); + +FX_ENTRY void FX_CALL +grStipplePattern( GrStipplePattern_t mode ); + +FX_ENTRY void FX_CALL +grViewport( FxI32 x, FxI32 y, FxI32 width, FxI32 height ); + +/* +** texture mapping control functions +*/ +FX_ENTRY FxU32 FX_CALL +grTexCalcMemRequired( + GrLOD_t lodmin, GrLOD_t lodmax, + GrAspectRatio_t aspect, GrTextureFormat_t fmt); + +FX_ENTRY FxU32 FX_CALL +grTexTextureMemRequired( FxU32 evenOdd, + GrTexInfo *info ); + +FX_ENTRY FxU32 FX_CALL +grTexMinAddress( GrChipID_t tmu ); + +FX_ENTRY FxU32 FX_CALL +grTexMaxAddress( GrChipID_t tmu ); + +FX_ENTRY void FX_CALL +grTexNCCTable( GrNCCTable_t table ); + +FX_ENTRY void FX_CALL +grTexSource( GrChipID_t tmu, + FxU32 startAddress, + FxU32 evenOdd, + GrTexInfo *info ); + +FX_ENTRY void FX_CALL +grTexClampMode( + GrChipID_t tmu, + GrTextureClampMode_t s_clampmode, + GrTextureClampMode_t t_clampmode + ); + +FX_ENTRY void FX_CALL +grTexCombine( + GrChipID_t tmu, + GrCombineFunction_t rgb_function, + GrCombineFactor_t rgb_factor, + GrCombineFunction_t alpha_function, + GrCombineFactor_t alpha_factor, + FxBool rgb_invert, + FxBool alpha_invert + ); + +FX_ENTRY void FX_CALL +grTexDetailControl( + GrChipID_t tmu, + int lod_bias, + FxU8 detail_scale, + float detail_max + ); + +FX_ENTRY void FX_CALL +grTexFilterMode( + GrChipID_t tmu, + GrTextureFilterMode_t minfilter_mode, + GrTextureFilterMode_t magfilter_mode + ); + + +FX_ENTRY void FX_CALL +grTexLodBiasValue(GrChipID_t tmu, float bias ); + +FX_ENTRY void FX_CALL +grTexDownloadMipMap( GrChipID_t tmu, + FxU32 startAddress, + FxU32 evenOdd, + GrTexInfo *info ); + +FX_ENTRY void FX_CALL +grTexDownloadMipMapLevel( GrChipID_t tmu, + FxU32 startAddress, + GrLOD_t thisLod, + GrLOD_t largeLod, + GrAspectRatio_t aspectRatio, + GrTextureFormat_t format, + FxU32 evenOdd, + void *data ); + +FX_ENTRY FxBool FX_CALL +grTexDownloadMipMapLevelPartial( GrChipID_t tmu, + FxU32 startAddress, + GrLOD_t thisLod, + GrLOD_t largeLod, + GrAspectRatio_t aspectRatio, + GrTextureFormat_t format, + FxU32 evenOdd, + void *data, + int start, + int end ); + +FX_ENTRY void FX_CALL +grTexDownloadTable( GrTexTable_t type, + void *data ); + +FX_ENTRY void FX_CALL +grTexDownloadTablePartial( GrTexTable_t type, + void *data, + int start, + int end ); + +FX_ENTRY void FX_CALL +grTexMipMapMode( GrChipID_t tmu, + GrMipMapMode_t mode, + FxBool lodBlend ); + +FX_ENTRY void FX_CALL +grTexMultibase( GrChipID_t tmu, + FxBool enable ); + +FX_ENTRY void FX_CALL +grTexMultibaseAddress( GrChipID_t tmu, + GrTexBaseRange_t range, + FxU32 startAddress, + FxU32 evenOdd, + GrTexInfo *info ); + +/* +** linear frame buffer functions +*/ + +FX_ENTRY FxBool FX_CALL +grLfbLock( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, + GrOriginLocation_t origin, FxBool pixelPipeline, + GrLfbInfo_t *info ); + +FX_ENTRY FxBool FX_CALL +grLfbUnlock( GrLock_t type, GrBuffer_t buffer ); + +FX_ENTRY void FX_CALL +grLfbConstantAlpha( GrAlpha_t alpha ); + +FX_ENTRY void FX_CALL +grLfbConstantDepth( FxU32 depth ); + +FX_ENTRY void FX_CALL +grLfbWriteColorSwizzle(FxBool swizzleBytes, FxBool swapWords); + +FX_ENTRY void FX_CALL +grLfbWriteColorFormat(GrColorFormat_t colorFormat); + +FX_ENTRY FxBool FX_CALL +grLfbWriteRegion( GrBuffer_t dst_buffer, + FxU32 dst_x, FxU32 dst_y, + GrLfbSrcFmt_t src_format, + FxU32 src_width, FxU32 src_height, + FxBool pixelPipeline, + FxI32 src_stride, void *src_data ); + +FX_ENTRY FxBool FX_CALL +grLfbReadRegion( GrBuffer_t src_buffer, + FxU32 src_x, FxU32 src_y, + FxU32 src_width, FxU32 src_height, + FxU32 dst_stride, void *dst_data ); + +/* +** glide management functions +*/ +FX_ENTRY void FX_CALL +grGlideInit( void ); + +FX_ENTRY void FX_CALL +grGlideShutdown( void ); + +FX_ENTRY void FX_CALL +grGlideGetState( void *state ); + +FX_ENTRY void FX_CALL +grGlideSetState( const void *state ); + +FX_ENTRY void FX_CALL +grGlideGetVertexLayout( void *layout ); + +FX_ENTRY void FX_CALL +grGlideSetVertexLayout( const void *layout ); + +#endif /* FX_GLIDE_NO_FUNC_PROTO */ + +#ifdef __cplusplus +} +#endif + +#include + +#endif /* __GLIDE_H__ */ diff --git a/g3sdk/include/glidesys.h b/g3sdk/include/glidesys.h new file mode 100644 index 0000000..03b1ce4 --- /dev/null +++ b/g3sdk/include/glidesys.h @@ -0,0 +1,160 @@ +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +** +** $Header: /cvsroot/glide/glide3x/h5/glide3/src/glidesys.h,v 1.3.4.3 2003/07/24 03:51:08 anholt Exp $ +** $Log: +** 3 3dfx 1.0.1.0.1.0 10/11/00 Brent Forced check in to enforce +** branching. +** 2 3dfx 1.0.1.0 06/20/00 Joseph Kain Changes to support the +** Napalm Glide open source release. Changes include cleaned up offensive +** comments and new legal headers. +** 1 3dfx 1.0 09/11/99 StarTeam VTS Administrator +** $ +** +** 4 11/05/98 11:18a Russp +** Fix GLIDE_NUM_TMU error check (change "&&" to "||") +** +** 3 7/24/98 1:41p Hohn +** +** 2 6/15/98 10:50a Peter +** made csim compile time option + * + * 1 1/16/98 4:29p Atai + * create glide 3 src + * + * 10 12/09/97 12:20p Peter + * mac glide port + * + * 9 11/04/97 4:00p Dow + * Banshee Mods + * + * 8 8/18/97 3:52p Peter + * pre-hw arrival fixes/cleanup + * + * 7 6/02/97 4:09p Peter + * Compile w/ gcc for Dural + * + * 6 5/27/97 1:16p Peter + * Basic cvg, w/o cmd fifo stuff. + * + * 5 5/21/97 6:05a Peter +*/ +#ifndef __GLIDESYS_H__ +#define __GLIDESYS_H__ + +/* +n** ----------------------------------------------------------------------- +** COMPILER/ENVIRONMENT CONFIGURATION +** ----------------------------------------------------------------------- +*/ + +/* Endianness is stored in bits [30:31] */ +#define GLIDE_ENDIAN_SHIFT 30 +#define GLIDE_ENDIAN_LITTLE (0x1 << GLIDE_ENDIAN_SHIFT) +#define GLIDE_ENDIAN_BIG (0x2 << GLIDE_ENDIAN_SHIFT) + +/* OS is stored in bits [0:6] */ +#define GLIDE_OS_SHIFT 0 +#define GLIDE_OS_UNIX 0x1 +#define GLIDE_OS_DOS32 0x2 +#define GLIDE_OS_WIN32 0x4 +#define GLIDE_OS_MACOS 0x8 +#define GLIDE_OS_OS2 0x10 +#define GLIDE_OS_OTHER 0x40 /* For Proprietary Arcade HW */ + +/* Sim vs. Hardware is stored in bits [7:8] */ +#define GLIDE_SST_SHIFT 7 +#define GLIDE_SST_SIM (0x1 << GLIDE_SST_SHIFT) +#define GLIDE_SST_HW (0x2 << GLIDE_SST_SHIFT) + +/* Hardware Type is stored in bits [9:13] */ +#define GLIDE_HW_SHIFT 9 +#define GLIDE_HW_SST1 (0x1 << GLIDE_HW_SHIFT) +#define GLIDE_HW_SST96 (0x2 << GLIDE_HW_SHIFT) +#define GLIDE_HW_H3 (0x4 << GLIDE_HW_SHIFT) +#define GLIDE_HW_SST2 (0x8 << GLIDE_HW_SHIFT) +#define GLIDE_HW_CVG (0x10 << GLIDE_HW_SHIFT) + +/* +** Make sure we handle all instances of WIN32 +*/ +#ifndef __WIN32__ +# if defined (_WIN32) || defined (WIN32) || defined(__NT__) +# define __WIN32__ +# endif +#endif + +/* We need two checks on the OS: one for endian, the other for OS */ +/* Check for endianness */ +#if defined(__IRIX__) || defined(__sparc__) || defined(MACOS) +# define GLIDE_ENDIAN GLIDE_ENDIAN_BIG +#else +# define GLIDE_ENDIAN GLIDE_ENDIAN_LITTLE +#endif + +/* Check for OS */ +#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__) || \ + defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +# define GLIDE_OS GLIDE_OS_UNIX +#elif defined(__DOS__) || defined(__MSDOS__) +# define GLIDE_OS GLIDE_OS_DOS32 +#elif defined(__WIN32__) +# define GLIDE_OS GLIDE_OS_WIN32 +#elif defined(macintosh) +# define GLIDE_OS GLIDE_OS_MACOS +#else +#error "Unknown OS" +#endif + +/* Check for Simulator vs. Hardware */ +#if HAL_CSIM || HWC_CSIM +# define GLIDE_SST GLIDE_SST_SIM +#else +# define GLIDE_SST GLIDE_SST_HW +#endif + +/* Check for type of hardware */ +#ifdef SST96 +# define GLIDE_HW GLIDE_HW_SST96 +#elif defined(H3) +# define GLIDE_HW GLIDE_HW_H3 +#elif defined(SST2) +# define GLIDE_HW GLIDE_HW_SST2 +#elif defined(CVG) +# define GLIDE_HW GLIDE_HW_CVG +#else /* Default to SST1 */ +# define GLIDE_HW GLIDE_HW_SST1 +#endif + + +#define GLIDE_PLATFORM (GLIDE_ENDIAN | GLIDE_OS | GLIDE_SST | GLIDE_HW) + +/* +** Control the number of TMUs +*/ +#ifndef GLIDE_NUM_TMU +# define GLIDE_NUM_TMU 2 +#endif + + +#if ((GLIDE_NUM_TMU < 0) || (GLIDE_NUM_TMU > 3)) +# error "GLIDE_NUM_TMU set to an invalid value" +#endif + +#endif /* __GLIDESYS_H__ */ diff --git a/g3sdk/include/glideutl.h b/g3sdk/include/glideutl.h new file mode 100644 index 0000000..16c6e32 --- /dev/null +++ b/g3sdk/include/glideutl.h @@ -0,0 +1,153 @@ +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +** +** $Header: /cvsroot/glide/glide3x/h5/glide3/src/glideutl.h,v 1.3.4.2 2003/06/05 08:23:53 koolsmoky Exp $ +** $Log: +** 3 3dfx 1.0.1.0.1.0 10/11/00 Brent Forced check in to enforce +** branching. +** 2 3dfx 1.0.1.0 06/20/00 Joseph Kain Changes to support the +** Napalm Glide open source release. Changes include cleaned up offensive +** comments and new legal headers. +** 1 3dfx 1.0 09/11/99 StarTeam VTS Administrator +** $ +** +** 4 7/24/98 1:41p Hohn +** +** 3 1/30/98 4:27p Atai +** gufog* prototype +** +** 1 1/29/98 4:00p Atai + * + * 1 1/16/98 4:29p Atai + * create glide 3 src + * + * 11 1/07/98 11:18a Atai + * remove GrMipMapInfo and GrGC.mm_table in glide3 + * + * 10 1/06/98 6:47p Atai + * undo grSplash and remove gu routines + * + * 9 1/05/98 6:04p Atai + * move 3df gu related data structure from glide.h to glideutl.h + * + * 8 12/18/97 2:13p Peter + * fogTable cataclysm + * + * 7 12/15/97 5:52p Atai + * disable obsolete glide2 api for glide3 + * + * 6 8/14/97 5:32p Pgj + * remove dead code per GMT + * + * 5 6/12/97 5:19p Pgj + * Fix bug 578 + * + * 4 3/05/97 9:36p Jdt + * Removed guFbWriteRegion added guEncodeRLE16 + * + * 3 1/16/97 3:45p Dow + * Embedded fn protos in ifndef FX_GLIDE_NO_FUNC_PROTO +*/ + +/* Glide Utility routines */ + +#ifndef __GLIDEUTL_H__ +#define __GLIDEUTL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** 3DF texture file structs +*/ + +typedef struct +{ + FxU32 width, height; + int small_lod, large_lod; + GrAspectRatio_t aspect_ratio; + GrTextureFormat_t format; +} Gu3dfHeader; + +typedef struct +{ + FxU8 yRGB[16]; + FxI16 iRGB[4][3]; + FxI16 qRGB[4][3]; + FxU32 packed_data[12]; +} GuNccTable; + +typedef struct { + FxU32 data[256]; +} GuTexPalette; + +typedef union { + GuNccTable nccTable; + GuTexPalette palette; +} GuTexTable; + +typedef struct +{ + Gu3dfHeader header; + GuTexTable table; + void *data; + FxU32 mem_required; /* memory required for mip map in bytes. */ +} Gu3dfInfo; + +#ifndef FX_GLIDE_NO_FUNC_PROTO +/* +** Gamma functions +*/ + +FX_ENTRY void FX_CALL +guGammaCorrectionRGB( FxFloat red, FxFloat green, FxFloat blue ); + +/* +** fog stuff +*/ +FX_ENTRY float FX_CALL +guFogTableIndexToW( int i ); + +FX_ENTRY void FX_CALL +guFogGenerateExp( GrFog_t *fogtable, float density ); + +FX_ENTRY void FX_CALL +guFogGenerateExp2( GrFog_t *fogtable, float density ); + +FX_ENTRY void FX_CALL +guFogGenerateLinear(GrFog_t *fogtable, + float nearZ, float farZ ); + +/* +** hi-level texture manipulation tools. +*/ +FX_ENTRY FxBool FX_CALL +gu3dfGetInfo( const char *filename, Gu3dfInfo *info ); + +FX_ENTRY FxBool FX_CALL +gu3dfLoad( const char *filename, Gu3dfInfo *data ); + +#endif /* FX_GLIDE_NO_FUNC_PROTO */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GLIDEUTL_H__ */ diff --git a/g3sdk/include/sst1vid.h b/g3sdk/include/sst1vid.h new file mode 100644 index 0000000..d76e714 --- /dev/null +++ b/g3sdk/include/sst1vid.h @@ -0,0 +1,148 @@ +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +** +** $Header: /cvsroot/glide/glide3x/h5/incsrc/sst1vid.h,v 1.3.4.1 2003/04/06 18:23:10 koolsmoky Exp $ +** $Log: +** 7 3dfx 1.4.1.0.1.0 10/11/00 Brent Forced check in to enforce +** branching. +** 6 3dfx 1.4.1.0 06/20/00 Joseph Kain Changes to support the +** Napalm Glide open source release. Changes include cleaned up offensive +** comments and new legal headers. +** 5 3dfx 1.4 12/10/99 Leo Galway Removed previous hi-res +** mode information for Glide3. These modes were only necessary for +** Cornerstone (or future hi-res) support in RT4.2 source branch and +** proceeded to break the V3 and V2 builds (from 3dfx view), hence they have +** been removed. +** 4 3dfx 1.3 12/08/99 Leo Galway Added mode information for +** 1600x1280, 1792x1440, 1920x1080, 1920x1200, 2046x1536 (as a result of +** glide being tested with Cornerstone modes). Although not all of these +** modes are currently capable under Glide, their inclusion prevents Glide +** apps from displaying in incorrect modes when these hi-res modes are +** selected. Search for SUSTAINED_ENGINEERING_CHANGE_BEGIN. +** 3 3dfx 1.2 09/17/99 Jeremy Zelsnack +** 2 3dfx 1.1 09/17/99 Jeremy Zelsnack +** 1 3dfx 1.0 09/11/99 StarTeam VTS Administrator +** $ +** +** 8 3/04/99 1:19p Atai +** sync new res modes +** +** 10 2/27/99 12:28p Dow +** new resolutions +** +** 6 2/13/99 1:56p Dow +** Added new resolution constants +** +** 5 7/24/98 1:38p Hohn + * + * 4 9/09/97 7:35p Sellers + * Added 400x300 resolution + * + * 3 8/24/97 9:31a Sellers + * moved new video timing to sst1vid.h + * redefined 1600x1280 to be 1600x1200 + * + * 2 6/05/97 11:14p Pgj + * + * 5 7/24/96 3:43p Sellers + * added 512x384 @ 60 Hz for arcade monitors + * added 512x256 @ 60 Hz for arcade monitors + * + * 4 7/18/96 10:58a Sellers + * fixed FT and TF clock delay values for lower frequencies with + * .5/.5 combos + * + * 3 6/18/96 6:54p Sellers + * added sst1InitShutdownSli() to fix Glide Splash screen problems with + * SLI + * + * 2 6/13/96 7:45p Sellers + * added "voodoo.ini" support + * added DirectX support + * misc cleanup + * + * 2 6/11/96 1:43p Sellers + * added support for 60, 75, 85, and 120 Hz refresh rates for "most" + * resolutions + * + * 1 5/08/96 5:43p Paik + * Video definitions +*/ +#ifndef __SST1VID_H__ +#define __SST1VID_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Video defines */ + +typedef FxI32 GrScreenRefresh_t; +#define GR_REFRESH_60Hz 0x0 +#define GR_REFRESH_70Hz 0x1 +#define GR_REFRESH_72Hz 0x2 +#define GR_REFRESH_75Hz 0x3 +#define GR_REFRESH_80Hz 0x4 +#define GR_REFRESH_90Hz 0x5 +#define GR_REFRESH_100Hz 0x6 +#define GR_REFRESH_85Hz 0x7 +#define GR_REFRESH_120Hz 0x8 +#define GR_REFRESH_NONE 0xff + +typedef FxI32 GrScreenResolution_t; +#define GR_RESOLUTION_320x200 0x0 +#define GR_RESOLUTION_320x240 0x1 +#define GR_RESOLUTION_400x256 0x2 +#define GR_RESOLUTION_512x384 0x3 +#define GR_RESOLUTION_640x200 0x4 +#define GR_RESOLUTION_640x350 0x5 +#define GR_RESOLUTION_640x400 0x6 +#define GR_RESOLUTION_640x480 0x7 +#define GR_RESOLUTION_800x600 0x8 +#define GR_RESOLUTION_960x720 0x9 +#define GR_RESOLUTION_856x480 0xa +#define GR_RESOLUTION_512x256 0xb +#define GR_RESOLUTION_1024x768 0xC +#define GR_RESOLUTION_1280x1024 0xD +#define GR_RESOLUTION_1600x1200 0xE +#define GR_RESOLUTION_400x300 0xF +#define GR_RESOLUTION_1152x864 0x10 +#define GR_RESOLUTION_1280x960 0x11 +#define GR_RESOLUTION_1600x1024 0x12 +#define GR_RESOLUTION_1792x1344 0x13 +#define GR_RESOLUTION_1856x1392 0x14 +#define GR_RESOLUTION_1920x1440 0x15 +#define GR_RESOLUTION_2048x1536 0x16 +#define GR_RESOLUTION_2048x2048 0x17 +#define GR_RESOLUTION_NONE 0xff + +#ifdef GR_RESOLUTION_MAX +#undef GR_RESOLUTION_MAX +#endif +#ifdef GR_RESOLUTION_MIN +#undef GR_RESOLUTION_MIN +#endif +#define GR_RESOLUTION_MIN GR_RESOLUTION_320x200 +#define GR_RESOLUTION_MAX GR_RESOLUTION_2048x2048 + +#ifdef __cplusplus +} +#endif + +#endif /* __SST1VID_H__ */ diff --git a/g3sdk/lib/glide3x.def b/g3sdk/lib/glide3x.def new file mode 100644 index 0000000..411f417 --- /dev/null +++ b/g3sdk/lib/glide3x.def @@ -0,0 +1,98 @@ +LIBRARY glide3x.dll +EXPORTS +grAADrawTriangle@24 +grAlphaBlendFunction@16 +grAlphaCombine@20 +grAlphaControlsITRGBLighting@4 +grAlphaTestFunction@4 +grAlphaTestReferenceValue@4 +grBufferClear@12 +grBufferSwap@4 +grCheckForRoom@4 +grChromakeyMode@4 +grChromakeyValue@4 +grClipWindow@16 +grColorCombine@20 +grColorMask@8 +grConstantColorValue@4 +grCoordinateSpace@4 +grCullMode@4 +grDepthBiasLevel@4 +grDepthBufferFunction@4 +grDepthBufferMode@4 +grDepthMask@4 +grDepthRange@8 +grDisable@4 +grDisableAllEffects@0 +grDitherMode@4 +grDrawLine@8 +grDrawPoint@4 +grDrawTriangle@12 +grDrawVertexArray@12 +grDrawVertexArrayContiguous@16 +grEnable@4 +grErrorSetCallback@4 +grFinish@0 +grFlush@0 +grFogColorValue@4 +grFogMode@4 +grFogTable@4 +grGet@12 +grGetProcAddress@4 +grGetString@4 +grGlideGetState@4 +grGlideGetVertexLayout@4 +grGlideInit@0 +grGlideSetState@4 +grGlideSetVertexLayout@4 +grGlideShutdown@0 +grLfbConstantAlpha@4 +grLfbConstantDepth@4 +grLfbLock@24 +grLfbReadRegion@28 +grLfbUnlock@8 +grLfbWriteColorFormat@4 +grLfbWriteColorSwizzle@8 +grLfbWriteRegion@36 +grLoadGammaTable@16 +grQueryResolutions@8 +grRenderBuffer@4 +grReset@4 +grSelectContext@4 +grSetNumPendingBuffers@4 +grSplash@20 +grSstConfigPipeline@12 +grSstOrigin@4 +grSstSelect@4 +grSstVidMode@8 +grSstWinClose@4 +grSstWinOpen@28 +grTexCalcMemRequired@16 +grTexClampMode@12 +grTexCombine@28 +grTexDetailControl@16 +grTexDownloadMipMap@16 +grTexDownloadMipMapLevel@32 +grTexDownloadMipMapLevelPartial@40 +grTexDownloadTable@8 +grTexDownloadTablePartial@16 +grTexFilterMode@12 +grTexLodBiasValue@8 +grTexMaxAddress@4 +grTexMinAddress@4 +grTexMipMapMode@12 +grTexMultibase@8 +grTexMultibaseAddress@20 +grTexNCCTable@4 +grTexSource@16 +grTexTextureMemRequired@8 +grVertexLayout@12 +grViewport@16 +gu3dfGetInfo@8 +gu3dfLoad@8 +guEncodeRLE16@16 +guFogGenerateExp2@8 +guFogGenerateExp@8 +guFogGenerateLinear@12 +guFogTableIndexToW@4 +guGammaCorrectionRGB@12 diff --git a/g3sdk/lib/glide3x.lib b/g3sdk/lib/glide3x.lib new file mode 100644 index 0000000..60d950f Binary files /dev/null and b/g3sdk/lib/glide3x.lib differ diff --git a/g3sdk/lib/libglide3x.dll.a b/g3sdk/lib/libglide3x.dll.a new file mode 100644 index 0000000..bda8ce0 Binary files /dev/null and b/g3sdk/lib/libglide3x.dll.a differ diff --git a/g3sdk/lib/libglide3x_dxe.a b/g3sdk/lib/libglide3x_dxe.a new file mode 100644 index 0000000..ea51437 Binary files /dev/null and b/g3sdk/lib/libglide3x_dxe.a differ diff --git a/include/GL/gl.h b/include/GL/gl.h index f59ddd2..e0b5af6 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -3,7 +3,7 @@ #ifndef GLAPI -#ifdef __WIN32__ +#ifdef _WIN32 #define GLAPI __declspec(dllexport) #else #define GLAPI @@ -11,7 +11,7 @@ #endif #ifndef GLAPIENTRY -#ifdef __WIN32__ +#ifdef _WIN32 #define GLAPIENTRY __stdcall #else #define GLAPIENTRY @@ -48,7 +48,6 @@ typedef double GLdouble; /* double precision float */ typedef double GLclampd; /* double precision float in [0,1] */ - /* * Constants */ diff --git a/include/GL/sage.h b/include/GL/sage.h index 4b4e9c4..b1c2869 100644 --- a/include/GL/sage.h +++ b/include/GL/sage.h @@ -90,6 +90,11 @@ void sage_fini (void); */ void sage_swap (int interval); +#ifdef __MSDOS__ +typedef void (*SageProc) (); +SageProc sage_GetProcAddress (const char *procname); +#endif + #ifdef __cplusplus } #endif diff --git a/main/context.c b/main/context.c index ec8d5ab..cc90500 100644 --- a/main/context.c +++ b/main/context.c @@ -29,7 +29,7 @@ GLuint ctx_depthbits; GLuint ctx_depthmaxi; GLfloat ctx_depthmaxf; GLuint ctx_stencilmaxi; -GLuint ctx_redbits, ctx_greenbits, ctx_bluebits, ctx_alphabits; +GLuint ctx_redbits, ctx_greenbits, ctx_bluebits, ctx_alphabits, ctx_stencilbits; GLboolean ctx_texcodec; @@ -147,6 +147,7 @@ ctx_init (int db_flag, ctx_depthbits = depth_size; ctx_depthmaxi = (1 << depth_size) - 1; ctx_depthmaxf = (GLfloat)ctx_depthmaxi; + ctx_stencilbits = stencil_size; ctx_stencilmaxi = (1 << stencil_size) - 1; ctx_redbits = red_size; ctx_greenbits = green_size; @@ -492,6 +493,10 @@ gl_enum (GLenum e) return "GL_STACK_OVERFLOW"; case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW"; + case GL_INVALID_ENUM: + return "GL_INVALID_ENUM"; + case GL_OUT_OF_MEMORY: + return "GL_OUT_OF_MEMORY"; case GL_INVALID_VALUE: default: return "GL_INVALID_VALUE"; diff --git a/main/context.h b/main/context.h index b5cd6df..9598936 100644 --- a/main/context.h +++ b/main/context.h @@ -185,7 +185,7 @@ extern GLuint ctx_depthbits; extern GLuint ctx_depthmaxi; extern GLfloat ctx_depthmaxf; extern GLuint ctx_stencilmaxi; -extern GLuint ctx_redbits, ctx_greenbits, ctx_bluebits, ctx_alphabits; +extern GLuint ctx_redbits, ctx_greenbits, ctx_bluebits, ctx_alphabits, ctx_stencilbits; extern GLboolean ctx_texcodec; diff --git a/main/dlist.c b/main/dlist.c index c8730c7..4ebd403 100644 --- a/main/dlist.c +++ b/main/dlist.c @@ -289,6 +289,7 @@ dlist_playback (GLuint real_id) break; default: gl_assert(0); + return; } node += opsize[node->op]; } @@ -366,6 +367,7 @@ dlist_destroy (GLuint real_id) case OP_EOL: case OP_INVALID: gl_assert(0); + return NULL; } } free(block); @@ -1373,6 +1375,7 @@ imm_CallLists (GLsizei n, GLenum type, const GLvoid *lists) case GL_4_BYTES: stride = sizeof(GLbyte) * 4; break; default: gl_assert(0); + return; } while (n--) { list = 0; @@ -1416,9 +1419,10 @@ imm_ListBase (GLuint base) /****************************************************************************** * XXX used for debug (remove) */ - - +#if 0 #include +#undef NDEBUG +#include static void dlist_print (GLuint real_id) { @@ -1567,9 +1571,11 @@ dlist_print (GLuint real_id) printf("--- glCallList(%d)\n", (node + 1)->i); break; default: - gl_assert(0); + printf("--- UNKNOWN DLIST OP(%d)\n", node->op); + assert(0); } node += opsize[node->op]; } printf("DLIST END ---\n"); } +#endif /* #if 0 */ diff --git a/main/enable.c b/main/enable.c index 865b4d4..a24567f 100644 --- a/main/enable.c +++ b/main/enable.c @@ -271,6 +271,8 @@ GLboolean GLAPIENTRY imm_IsEnabled (GLenum cap) { switch (cap) { + case GL_ALPHA_TEST: + return ctx_color.alpha_test; case GL_FOG: return ctx_fog.fogging; default: diff --git a/main/fake.c b/main/fake.c index d51b0a1..9752348 100644 --- a/main/fake.c +++ b/main/fake.c @@ -3,11 +3,13 @@ #include -#define NYI() \ +/*#define NYI() \ do { \ printf(">>>%s:\n", __FUNCTION__); \ fflush(stdout); \ } while (0) +#endif*/ +#define NYI() do {} while (0) GLAPI void GLAPIENTRY diff --git a/main/fog.c b/main/fog.c index 99dc1cc..50e419b 100644 --- a/main/fog.c +++ b/main/fog.c @@ -37,6 +37,7 @@ imm_Fogfv (GLenum pname, const GLfloat *params) break; default: gl_assert(0); + return; } ctx_gl_state |= NEW_FOG; @@ -82,6 +83,7 @@ imm_Fogiv (GLenum pname, const GLint *params) break; default: gl_assert(0); + return; } ctx_gl_state |= NEW_FOG; diff --git a/main/get.c b/main/get.c index 5403d1c..da2d212 100644 --- a/main/get.c +++ b/main/get.c @@ -113,7 +113,7 @@ imm_GetIntegerv (GLenum pname, GLint *params) params[0] = ctx_pack.swap_bytes; break; case GL_STENCIL_BITS: - params[0] = 0; + params[0] = ctx_stencilbits; break; case GL_DEPTH_BITS: params[0] = ctx_depthbits; diff --git a/main/light.c b/main/light.c index 5774ef4..f98a061 100644 --- a/main/light.c +++ b/main/light.c @@ -13,9 +13,26 @@ void GLAPIENTRY imm_ColorMaterial (GLenum face, GLenum mode) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); - gl_assert(mode == GL_EMISSION || mode == GL_AMBIENT || mode == GL_DIFFUSE || - mode == GL_SPECULAR || mode == GL_AMBIENT_AND_DIFFUSE); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } + switch (mode) { + case GL_EMISSION: + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_AMBIENT_AND_DIFFUSE: + break; + default: + gl_assert(0); + return; + } /* XXX must be outside begin/end */ FLUSH_VERTICES(); @@ -30,7 +47,12 @@ imm_ColorMaterial (GLenum face, GLenum mode) void GLAPIENTRY imm_ShadeModel (GLenum mode) { - gl_assert(mode == GL_SMOOTH || mode == GL_FLAT); + switch (mode) { + case GL_SMOOTH: + case GL_FLAT: break; + default: gl_assert(0); + return; + } FLUSH_VERTICES(); diff --git a/main/texcodec.c b/main/texcodec.c index ed47646..7a01201 100644 --- a/main/texcodec.c +++ b/main/texcodec.c @@ -1,25 +1,50 @@ #include #include -#ifdef __linux__ +/* this requires dxtn library of Daniel Borca, i.e. tc-1.1.tar.gz + * from http://www.geocities.ws/dborca/opengl/tc.html + * + * and NOT libtxc_dxtn from freedesktop.org, which is different: + * http://people.freedesktop.org/~cbrill/libtxc_dxtn/ + * http://cgit.freedesktop.org/~mareko/libtxc_dxtn/ + * (also see https://github.com/divVerent/s2tc for an alternative) + * + * (Mesa6.4 does use libtxc_dxtn, maybe the code can be updated) + */ + +#ifndef USE_EXTERNAL_DXTN_LIB +#define USE_EXTERNAL_DXTN_LIB 0 +#endif + +#if !USE_EXTERNAL_DXTN_LIB + +#define _sage_dlopen(name, mode) NULL +#define _sage_dlsym(hndl, proc) NULL +#define _sage_dlclose(hndl) + +#elif defined(__linux__) #include +#define _sage_dlopen dlopen +#define _sage_dlsym dlsym +#define _sage_dlclose dlclose #define DXTN_LIB "libdxtn.so" #elif defined(__DJGPP__) -#define dlopen(name, mode) NULL -#define dlsym(hndl, proc) NULL -#define dlclose(hndl) +#include +#define _sage_dlopen dlopen +#define _sage_dlsym(hndl, proc) dlsym(hndl,"_" proc) +#define _sage_dlclose dlclose #define DXTN_LIB "dxtn.dxe" -#elif defined(__WIN32__) +#elif defined(_WIN32) #define WIN32_LEAN_AND_MEAN #include -#define dlopen(name, mode) LoadLibrary(name) -#define dlsym(hndl, proc) GetProcAddress(hndl, proc) -#define dlclose(hndl) FreeLibrary(hndl) +#define _sage_dlopen(name, mode) LoadLibrary(name) +#define _sage_dlsym(hndl, proc) GetProcAddress(hndl, proc) +#define _sage_dlclose(hndl) FreeLibrary(hndl) #define DXTN_LIB "dxtn.dll" #endif @@ -32,7 +57,7 @@ #include "texcodec.h" -#define GET_PTR(type, name) name = (type)dlsym(h, #name) +#define GET_PTR(type,name) if(!(name=(type)_sage_dlsym(h,#name))){tc_fini();return -1;} typedef void (*TC_FETCHER) (const void *texture, int stride_in_pixels, int i, int j, unsigned char *rgba); @@ -41,27 +66,30 @@ typedef void (*TC_ENCODER) (int width, int height, int comps, const void *source static void *h = NULL; -static TC_FETCHER fxt1_decode_1; -static TC_FETCHER dxt1_rgb_decode_1; -static TC_FETCHER dxt1_rgba_decode_1; -static TC_FETCHER dxt3_rgba_decode_1; -static TC_FETCHER dxt5_rgba_decode_1; +static TC_FETCHER fxt1_decode_1 = NULL; +static TC_FETCHER dxt1_rgb_decode_1 = NULL; +static TC_FETCHER dxt1_rgba_decode_1 = NULL; +static TC_FETCHER dxt3_rgba_decode_1 = NULL; +static TC_FETCHER dxt5_rgba_decode_1 = NULL; -static TC_ENCODER fxt1_encode; -static TC_ENCODER dxt1_rgb_encode; -static TC_ENCODER dxt1_rgba_encode; -static TC_ENCODER dxt3_rgba_encode; -static TC_ENCODER dxt5_rgba_encode; +static TC_ENCODER fxt1_encode = NULL; +static TC_ENCODER dxt1_rgb_encode = NULL; +static TC_ENCODER dxt1_rgba_encode = NULL; +static TC_ENCODER dxt3_rgba_encode = NULL; +static TC_ENCODER dxt5_rgba_encode = NULL; int tc_init (void) { +#if !USE_EXTERNAL_DXTN_LIB + return -1; +#else if (h != NULL) { return 0; } - h = dlopen(DXTN_LIB, RTLD_NOW | RTLD_LOCAL); + h = _sage_dlopen(DXTN_LIB, RTLD_NOW | RTLD_LOCAL); if (h == NULL) { return -1; } @@ -78,16 +106,30 @@ tc_init (void) GET_PTR(TC_ENCODER, dxt5_rgba_encode); return 0; +#endif } void tc_fini (void) { +#if USE_EXTERNAL_DXTN_LIB if (h != NULL) { - dlclose(h); + _sage_dlclose(h); h = NULL; + + fxt1_decode_1 = NULL; + dxt1_rgb_decode_1 = NULL; + dxt1_rgba_decode_1 = NULL; + dxt3_rgba_decode_1 = NULL; + dxt5_rgba_decode_1 = NULL; + fxt1_encode = NULL; + dxt1_rgb_encode = NULL; + dxt1_rgba_encode = NULL; + dxt3_rgba_encode = NULL; + dxt5_rgba_encode = NULL; } +#endif } @@ -96,6 +138,9 @@ tc_decode (void *dst, GLenum *dst_format, GLenum *dst_type, GLsizei width, GLsizei height, const void *src, GLenum src_format) { +#if !USE_EXTERNAL_DXTN_LIB + return NULL; +#else int i, j; int comp; GLubyte *output; @@ -152,6 +197,7 @@ tc_decode (void *dst, GLenum *dst_format, GLenum *dst_type, *dst_format = (comp == 3) ? GL_RGB : GL_RGBA; *dst_type = GL_UNSIGNED_BYTE; return dst; +#endif } @@ -284,6 +330,9 @@ tc_encode (const PACKING *unpack, GLenum src_format, GLenum src_type) { +#if !USE_EXTERNAL_DXTN_LIB + return NULL; +#else TC_ENCODER encoder = NULL; int srcStrideInBytes; int srcTexelBytes; @@ -338,6 +387,7 @@ tc_encode (const PACKING *unpack, encoder(src_width, src_height, srcTexelBytes, src, srcStrideInBytes, dst, destRowStride); return dst; +#endif } diff --git a/main/texture.c b/main/texture.c index 6b2fcfd..383cc34 100644 --- a/main/texture.c +++ b/main/texture.c @@ -527,6 +527,7 @@ imm_TexEnvfv (GLenum target, GLenum pname, const GLfloat *params) break; default: gl_assert(0); + return; } break; case GL_TEXTURE_FILTER_CONTROL: @@ -538,6 +539,7 @@ imm_TexEnvfv (GLenum target, GLenum pname, const GLfloat *params) break; default: gl_assert(0); + return; } ctx_gl_state |= NEW_TEXTURE; @@ -588,6 +590,7 @@ imm_TexParameterfv (GLenum target, GLenum pname, const GLfloat *params) default: gl_error(NULL, GL_INVALID_VALUE, "%s: %x\n", __FUNCTION__, pname); gl_assert(0); + return; } ctx_gl_state |= NEW_TEXTURE; @@ -627,6 +630,7 @@ imm_TexGenfv (GLenum coord, GLenum pname, const GLfloat *params) break; default: gl_assert(0); + return; } break; case GL_OBJECT_PLANE: @@ -640,6 +644,7 @@ imm_TexGenfv (GLenum coord, GLenum pname, const GLfloat *params) break; default: gl_assert(0); + return; } ctx_gl_state |= NEW_TEXTURE; @@ -788,6 +793,7 @@ imm_TexEnviv (GLenum target, GLenum pname, const GLint *params) break; default: gl_assert(0); + return; } break; case GL_TEXTURE_FILTER_CONTROL: @@ -799,6 +805,7 @@ imm_TexEnviv (GLenum target, GLenum pname, const GLint *params) break; default: gl_assert(0); + return; } ctx_gl_state |= NEW_TEXTURE; @@ -849,6 +856,7 @@ imm_TexParameteriv (GLenum target, GLenum pname, const GLint *params) default: gl_error(NULL, GL_INVALID_VALUE, "%s: %x\n", __FUNCTION__, pname); gl_assert(0); + return; } ctx_gl_state |= NEW_TEXTURE; @@ -888,6 +896,7 @@ imm_TexGeniv (GLenum coord, GLenum pname, const GLint *params) break; default: gl_assert(0); + return; } break; case GL_OBJECT_PLANE: @@ -907,6 +916,7 @@ imm_TexGeniv (GLenum coord, GLenum pname, const GLint *params) } default: gl_assert(0); + return; } ctx_gl_state |= NEW_TEXTURE; @@ -946,6 +956,7 @@ imm_TexGendv (GLenum coord, GLenum pname, const GLdouble *params) break; default: gl_assert(0); + return; } break; case GL_OBJECT_PLANE: @@ -965,6 +976,7 @@ imm_TexGendv (GLenum coord, GLenum pname, const GLdouble *params) } default: gl_assert(0); + return; } ctx_gl_state |= NEW_TEXTURE; diff --git a/mk.bat b/mk.bat deleted file mode 100644 index 1decc8f..0000000 --- a/mk.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -set PATH=d:\mingw\bin -redir -e 1 -o 2 mingw32-make -f Makefile.mgw X86=1 diff --git a/sage.ini b/sage.ini index 8a51ee0..8abb949 100644 --- a/sage.ini +++ b/sage.ini @@ -24,6 +24,17 @@ # eg: Doom3, Kotor1/2, NeverwinterNights #wgl.ignore.stencilbuffer = y +############################################################################### +# x86 configuration +############################################################################### + +# enable use of 3dnow features: +x86.enable.3dnow = y + +# enable use of SSE features: +# SSE is buggy and can cause black screens with segfaults on startup. +x86.enable.sse = y + ############################################################################### # 3dfx configuration ############################################################################### diff --git a/tnl/imm_api.c b/tnl/imm_api.c index 180382f..7f48060 100644 --- a/tnl/imm_api.c +++ b/tnl/imm_api.c @@ -12,9 +12,14 @@ void GLAPIENTRY imm_Begin (GLenum mode) { - if (tnl_primitive != TNL_OUTSIDE_BE) gl_assert(0); - - gl_assert(tnl_prim_num < TNL_PRIM_MAX); + if (tnl_primitive != TNL_OUTSIDE_BE) { + gl_assert(0); + return; + } + if (tnl_prim_num >= TNL_PRIM_MAX) { + gl_assert(0); + return; + } /* start building a new primitive */ tnl_prim[tnl_prim_num].start = tnl_vb.num; @@ -30,7 +35,10 @@ imm_Begin (GLenum mode) void GLAPIENTRY imm_End (void) { - if (tnl_primitive == TNL_OUTSIDE_BE) gl_assert(0); + if (tnl_primitive == TNL_OUTSIDE_BE) { + gl_assert(0); + return; + } /* close the primitive */ tnl_prim[tnl_prim_num - 1].name |= TNL_PRIM_END; diff --git a/tnl/imm_array.c b/tnl/imm_array.c index a37cb45..5a5f02b 100644 --- a/tnl/imm_array.c +++ b/tnl/imm_array.c @@ -48,6 +48,7 @@ break; \ default: \ gl_assert(0); \ + return; \ } \ a->size = sz; \ a->type = e_type; \ @@ -455,6 +456,7 @@ imm_EnableClientState (GLenum cap) break; default: gl_assert(0); + return; } } @@ -518,6 +520,7 @@ imm_DisableClientState (GLenum cap) break; default: gl_assert(0); + return; } } @@ -642,6 +645,7 @@ imm_DrawElements (GLenum mode, GLsizei count, } default: gl_assert(0); + break; } imm_End(); } diff --git a/tnl/imm_vertex.c b/tnl/imm_vertex.c index 1514a92..f975280 100644 --- a/tnl/imm_vertex.c +++ b/tnl/imm_vertex.c @@ -198,7 +198,15 @@ imm_EdgeFlagv (const GLboolean *flag) void GLAPIENTRY imm_Materialf (GLenum face, GLenum pname, GLfloat param) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } switch (pname) { case GL_SHININESS: @@ -206,6 +214,7 @@ imm_Materialf (GLenum face, GLenum pname, GLfloat param) break; default: gl_assert(0); + return; } } @@ -213,7 +222,15 @@ imm_Materialf (GLenum face, GLenum pname, GLfloat param) void GLAPIENTRY imm_Materialfv (GLenum face, GLenum pname, const GLfloat *params) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } switch (pname) { case GL_AMBIENT: @@ -237,6 +254,7 @@ imm_Materialfv (GLenum face, GLenum pname, const GLfloat *params) break; default: gl_assert(0); + return; } } @@ -740,7 +758,15 @@ imm_FogCoorddv (const GLdouble *v) void GLAPIENTRY imm_Materiali (GLenum face, GLenum pname, GLint param) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } switch (pname) { case GL_SHININESS: @@ -748,6 +774,7 @@ imm_Materiali (GLenum face, GLenum pname, GLint param) break; default: gl_assert(0); + return; } } @@ -755,7 +782,15 @@ imm_Materiali (GLenum face, GLenum pname, GLint param) void GLAPIENTRY imm_Materialiv (GLenum face, GLenum pname, const GLint *params) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } switch (pname) { case GL_AMBIENT: @@ -779,6 +814,7 @@ imm_Materialiv (GLenum face, GLenum pname, const GLint *params) break; default: gl_assert(0); + return; } } diff --git a/tnl/sav_array.c b/tnl/sav_array.c index 2e2f9de..4ad7384 100644 --- a/tnl/sav_array.c +++ b/tnl/sav_array.c @@ -448,6 +448,7 @@ sav_DrawElements (GLenum mode, GLsizei count, } default: gl_assert(0); + break; } sav_End(); } diff --git a/tnl/sav_vertex.c b/tnl/sav_vertex.c index 7d4b8ce..59d1df4 100644 --- a/tnl/sav_vertex.c +++ b/tnl/sav_vertex.c @@ -198,8 +198,22 @@ sav_EdgeFlagv (const GLboolean *flag) void GLAPIENTRY sav_Materialf (GLenum face, GLenum pname, GLfloat param) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); - gl_assert(pname == GL_SHININESS); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } + switch (pname) { + case GL_SHININESS: + break; + default: + gl_assert(0); + return; + } MAT_F(1, face, pname, param, 0.0F, 0.0F, 0.0F); } @@ -208,14 +222,28 @@ sav_Materialf (GLenum face, GLenum pname, GLfloat param) void GLAPIENTRY sav_Materialfv (GLenum face, GLenum pname, const GLfloat *params) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } - gl_assert(pname == GL_AMBIENT || - pname == GL_DIFFUSE || - pname == GL_SPECULAR || - pname == GL_EMISSION || - pname == GL_SHININESS || - pname == GL_AMBIENT_AND_DIFFUSE); + switch (pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + case GL_SHININESS: + case GL_AMBIENT_AND_DIFFUSE: + break; + default: + gl_assert(0); + return; + } if (pname != GL_SHININESS) { MAT_F(4, face, pname, params[0], params[1], params[2], params[3]); @@ -724,8 +752,22 @@ sav_FogCoorddv (const GLdouble *v) void GLAPIENTRY sav_Materiali (GLenum face, GLenum pname, GLint param) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); - gl_assert(pname == GL_SHININESS); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } + switch (pname) { + case GL_SHININESS: + break; + default: + gl_assert(0); + return; + } MAT_F(1, face, pname, (GLfloat)param, 0.0F, 0.0F, 0.0F); } @@ -734,14 +776,28 @@ sav_Materiali (GLenum face, GLenum pname, GLint param) void GLAPIENTRY sav_Materialiv (GLenum face, GLenum pname, const GLint *params) { - gl_assert(face == GL_FRONT || face == GL_BACK || face == GL_FRONT_AND_BACK); + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + default: + gl_assert(0); + return; + } - gl_assert(pname == GL_AMBIENT || - pname == GL_DIFFUSE || - pname == GL_SPECULAR || - pname == GL_EMISSION || - pname == GL_SHININESS || - pname == GL_AMBIENT_AND_DIFFUSE); + switch (pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + case GL_SHININESS: + case GL_AMBIENT_AND_DIFFUSE: + break; + default: + gl_assert(0); + return; + } if (pname != GL_SHININESS) { MAT_F(4, face, pname, I_TO_FLOAT(params[0]), I_TO_FLOAT(params[1]), I_TO_FLOAT(params[2]), I_TO_FLOAT(params[3])); diff --git a/util/cfg.c b/util/cfg.c index 7a7142a..519c1a5 100644 --- a/util/cfg.c +++ b/util/cfg.c @@ -7,7 +7,6 @@ */ -#include #include #include #include @@ -31,6 +30,18 @@ typedef struct ENTRY { static ENTRY cfg_list = { &cfg_list, &cfg_list, NULL, {0} }; +static int +cfg_isspace (int c) +{ + switch(c) { + case ' ': case '\t': + case '\n': case '\r': + case '\f': case '\v': return 1; + } + return 0; +} + + /** * Load configuration file. * @@ -55,7 +66,7 @@ cfg_load (const char *filename) ENTRY *e; beg = line; - while (isspace(*beg)) { + while (cfg_isspace(*beg)) { beg++; } @@ -63,7 +74,7 @@ cfg_load (const char *filename) if (end == beg) { continue; } - while (isspace(*(end - 1))) { + while (cfg_isspace(*(end - 1))) { end--; } *end = '\0'; @@ -82,11 +93,11 @@ cfg_load (const char *filename) if (*mid == '\0') { continue; /* `abc=' */ } - while (isspace(*mid)) { + while (cfg_isspace(*mid)) { mid++; } - while (isspace(*(end - 1))) { + while (cfg_isspace(*(end - 1))) { end--; } *end = '\0'; @@ -114,7 +125,10 @@ cfg_load (const char *filename) } fclose(f); +#ifndef __MSDOS__ atexit(cfg_kill); +#endif + return 0; } diff --git a/util/macros.h b/util/macros.h index ea4c2e8..87a38fb 100644 --- a/util/macros.h +++ b/util/macros.h @@ -2,12 +2,21 @@ #define MACROS_H_included +#ifdef __DJGPP__ +#define SQRT(x) sqrt(x) +#define COS(x) cos(x) +#define SIN(x) sin(x) +#define FABS(x) fabs(x) +#define EXP(x) exp(x) +#define POW(x, y) pow(x, y) +#else #define SQRT(x) sqrtf(x) #define COS(x) cosf(x) #define SIN(x) sinf(x) #define FABS(x) fabsf(x) #define EXP(x) expf(x) #define POW(x, y) powf(x, y) +#endif #define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT))) diff --git a/x86/sse_clip.asm b/x86/sse_clip.asm index 6f2e667..4cd4614 100644 --- a/x86/sse_clip.asm +++ b/x86/sse_clip.asm @@ -52,7 +52,7 @@ proc sse_clipmask jz .next_k align 16 .j_loop: - movaps xmm2, [esi] + MOVUAPS xmm2, [esi] rcpps xmm0, xmm2 push ebp @@ -78,7 +78,7 @@ proc sse_clipmask mov cl, [x86_clip_lut + ecx] pop ebp - movaps xmm1, xmm2 + MOVUAPS xmm1, xmm2 mov [ebx], cl or eax, ecx test ecx, ecx @@ -87,7 +87,7 @@ proc sse_clipmask shufps xmm0, xmm0, SHUF(W, W, W, W) mulps xmm2, xmm0 movt xmm2, xmm0 - movaps [ebp], xmm2 + MOVUAPS [ebp], xmm2 align 16 .next_j: add esi, 16 diff --git a/x86/sse_mat.asm b/x86/sse_mat.asm index b067a70..a9b0f78 100644 --- a/x86/sse_mat.asm +++ b/x86/sse_mat.asm @@ -73,13 +73,13 @@ proc matrix_mul_vec4_batch_sse mov ecx, [esp+16] align 16 .0: - movaps xmm0, [eax] + MOVUAPS xmm0, [eax] prefetchnta [eax+0x30] - movaps xmm1, xmm0 + MOVUAPS xmm1, xmm0 add eax, 16 - movaps xmm2, xmm0 + MOVUAPS xmm2, xmm0 add edx, 16 - movaps xmm3, xmm0 + MOVUAPS xmm3, xmm0 prefetchnta [edx+0x20] shufps xmm0, xmm0, SHUF(X, X, X, X) shufps xmm1, xmm1, SHUF(Y, Y, Y, Y) @@ -92,7 +92,7 @@ proc matrix_mul_vec4_batch_sse addps xmm1, xmm0 addps xmm2, xmm3 addps xmm1, xmm2 - movaps [edx-16], xmm1 + MOVUAPS [edx-16], xmm1 dec ecx jnz .0 ret @@ -111,11 +111,11 @@ proc matrix_mul_vec3_batch_sse mov ecx, [esp+16] align 16 .0: - movaps xmm0, [eax] + MOVUAPS xmm0, [eax] prefetchnta [eax+0x30] - movaps xmm1, xmm0 + MOVUAPS xmm1, xmm0 add eax, 16 - movaps xmm2, xmm0 + MOVUAPS xmm2, xmm0 add edx, 16 prefetchnta [edx+0x20] shufps xmm0, xmm0, SHUF(X, X, X, X) @@ -127,7 +127,7 @@ proc matrix_mul_vec3_batch_sse addps xmm1, xmm0 addps xmm2, xmm7 addps xmm1, xmm2 - movaps [edx-16], xmm1 + MOVUAPS [edx-16], xmm1 dec ecx jnz .0 ret diff --git a/x86/sse_misc.asm b/x86/sse_misc.asm index b30d822..4c315c2 100644 --- a/x86/sse_misc.asm +++ b/x86/sse_misc.asm @@ -31,10 +31,10 @@ proc sse_calc_veyn4 mov ecx, [tnl_vb + TNL_VB_LEN] align 16 .0: - movaps xmm0, [eax] - movaps xmm1, xmm0 - movaps xmm2, xmm0 - movaps xmm3, xmm0 + MOVUAPS xmm0, [eax] + MOVUAPS xmm1, xmm0 + MOVUAPS xmm2, xmm0 + MOVUAPS xmm3, xmm0 shufps xmm0, xmm0, SHUF(X, X, X, X) shufps xmm1, xmm1, SHUF(Y, Y, Y, Y) shufps xmm2, xmm2, SHUF(Z, Z, Z, Z) @@ -46,19 +46,19 @@ proc sse_calc_veyn4 addps xmm1, xmm0 addps xmm2, xmm3 addps xmm1, xmm2 - movaps [edx], xmm1 ; x | y | z | w + MOVUAPS [edx], xmm1 ; x | y | z | w - movaps xmm0, xmm1 ; x | y | z | w + MOVUAPS xmm0, xmm1 ; x | y | z | w mulps xmm1, xmm1 ; x*x | y*y | z*z | w*w - movaps xmm2, xmm1 - movaps xmm3, xmm1 + MOVUAPS xmm2, xmm1 + MOVUAPS xmm3, xmm1 shufps xmm2, xmm2, SHUF(Y, Z, X, W) ; y*y | z*z | x*x | w*w shufps xmm3, xmm3, SHUF(Z, X, Y, W) ; z*z | x*x | y*y | w*w addps xmm1, xmm2 addps xmm1, xmm3 rsqrtps xmm1, xmm1 mulps xmm0, xmm1 - movaps [edi], xmm0 + MOVUAPS [edi], xmm0 add eax, 16 add edx, 16 @@ -85,9 +85,9 @@ proc sse_calc_veyn3 mov ecx, [tnl_vb + TNL_VB_LEN] align 16 .0: - movaps xmm0, [eax] - movaps xmm1, xmm0 - movaps xmm2, xmm0 + MOVUAPS xmm0, [eax] + MOVUAPS xmm1, xmm0 + MOVUAPS xmm2, xmm0 shufps xmm0, xmm0, SHUF(X, X, X, X) shufps xmm1, xmm1, SHUF(Y, Y, Y, Y) shufps xmm2, xmm2, SHUF(Z, Z, Z, Z) @@ -97,19 +97,19 @@ proc sse_calc_veyn3 addps xmm1, xmm0 addps xmm2, xmm7 addps xmm1, xmm2 - movaps [edx], xmm1 ; x | y | z | w + MOVUAPS [edx], xmm1 ; x | y | z | w - movaps xmm0, xmm1 ; x | y | z | w + MOVUAPS xmm0, xmm1 ; x | y | z | w mulps xmm1, xmm1 ; x*x | y*y | z*z | w*w - movaps xmm2, xmm1 - movaps xmm3, xmm1 + MOVUAPS xmm2, xmm1 + MOVUAPS xmm3, xmm1 shufps xmm2, xmm2, SHUF(Y, Z, X, W) ; y*y | z*z | x*x | w*w shufps xmm3, xmm3, SHUF(Z, X, Y, W) ; z*z | x*x | y*y | w*w addps xmm1, xmm2 addps xmm1, xmm3 rsqrtps xmm1, xmm1 mulps xmm0, xmm1 - movaps [edi], xmm0 + MOVUAPS [edi], xmm0 add eax, 16 add edx, 16 @@ -138,11 +138,11 @@ proc sse_calc_neye %if 0 align 16 .0: - movaps xmm0, [eax] + MOVUAPS xmm0, [eax] prefetchnta [eax+0x30] - movaps xmm1, xmm0 + MOVUAPS xmm1, xmm0 add eax, 16 - movaps xmm2, xmm0 + MOVUAPS xmm2, xmm0 add edx, 16 prefetchnta [edx+0x20] shufps xmm0, xmm0, SHUF(X, X, X, X) @@ -153,7 +153,7 @@ proc sse_calc_neye mulps xmm2, xmm6 addps xmm1, xmm0 addps xmm1, xmm2 - movaps [edx-16], xmm1 + MOVUAPS [edx-16], xmm1 dec ecx jnz .0 %else @@ -165,10 +165,10 @@ proc sse_calc_neye .0: test edi, TNL_NORMAL_BIT jz .1 - movaps xmm0, [eax] + MOVUAPS xmm0, [eax] prefetchnta [eax+0x30] - movaps xmm1, xmm0 - movaps xmm2, xmm0 + MOVUAPS xmm1, xmm0 + MOVUAPS xmm2, xmm0 prefetchnta [edx+0x30] shufps xmm0, xmm0, SHUF(X, X, X, X) shufps xmm1, xmm1, SHUF(Y, Y, Y, Y) @@ -180,7 +180,7 @@ proc sse_calc_neye addps xmm1, xmm2 align 16 .1: - movaps [edx], xmm1 + MOVUAPS [edx], xmm1 add esi, 4 add eax, 16 add edx, 16 @@ -193,9 +193,9 @@ proc sse_calc_neye ret align 16 .2: - movaps xmm0, [eax] - movaps xmm1, xmm0 - movaps xmm2, xmm0 + MOVUAPS xmm0, [eax] + MOVUAPS xmm1, xmm0 + MOVUAPS xmm2, xmm0 shufps xmm0, xmm0, SHUF(X, X, X, X) shufps xmm1, xmm1, SHUF(Y, Y, Y, Y) shufps xmm2, xmm2, SHUF(Z, Z, Z, Z) @@ -206,7 +206,7 @@ proc sse_calc_neye addps xmm1, xmm2 align 16 .3: - movaps [edx], xmm1 + MOVUAPS [edx], xmm1 add edx, 16 dec ecx jnz .3 @@ -227,16 +227,16 @@ proc sse_reflect mov eax, [tnl_vb + TNL_VB_VEYN] mov ecx, [tnl_vb + TNL_VB_NEYE] mov edx, [tnl_vb + TNL_VB_REFL] - movaps xmm5, [f_0010] - movaps xmm6, [f_2222] + MOVUAPS xmm5, [f_0010] + MOVUAPS xmm6, [f_2222] align 16 .0: - movaps xmm1, [eax] ; ux | uy | uz | uw - movaps xmm2, [ecx] ; nx | ny | nz | nw - movaps xmm0, xmm1 ; ux | uy | uz | uw + MOVUAPS xmm1, [eax] ; ux | uy | uz | uw + MOVUAPS xmm2, [ecx] ; nx | ny | nz | nw + MOVUAPS xmm0, xmm1 ; ux | uy | uz | uw mulps xmm1, xmm2 ; ux*nx | uy*ny | uz*nz | uw*nw - movaps xmm3, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw - movaps xmm4, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw + MOVUAPS xmm3, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw + MOVUAPS xmm4, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw shufps xmm3, xmm3, SHUF(Y, Z, X, W) shufps xmm4, xmm4, SHUF(Z, X, Y, W) addps xmm1, xmm3 @@ -246,7 +246,7 @@ proc sse_reflect mulps xmm1, xmm2 subps xmm1, xmm5 subps xmm0, xmm1 - movaps [edx], xmm0 + MOVUAPS [edx], xmm0 add eax, 16 add ecx, 16 @@ -265,17 +265,17 @@ proc sse_reflect_mvec mov eax, [tnl_vb + TNL_VB_VEYN] mov ecx, [tnl_vb + TNL_VB_NEYE] mov edx, [tnl_vb + TNL_VB_REFL] - movaps xmm5, [f_0010] - movaps xmm6, [f_2222] - movaps xmm7, [f_h000] + MOVUAPS xmm5, [f_0010] + MOVUAPS xmm6, [f_2222] + MOVUAPS xmm7, [f_h000] align 16 .0: - movaps xmm1, [eax] ; ux | uy | uz | uw - movaps xmm2, [ecx] ; nx | ny | nz | nw - movaps xmm0, xmm1 ; ux | uy | uz | uw + MOVUAPS xmm1, [eax] ; ux | uy | uz | uw + MOVUAPS xmm2, [ecx] ; nx | ny | nz | nw + MOVUAPS xmm0, xmm1 ; ux | uy | uz | uw mulps xmm1, xmm2 ; ux*nx | uy*ny | uz*nz | uw*nw - movaps xmm3, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw - movaps xmm4, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw + MOVUAPS xmm3, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw + MOVUAPS xmm4, xmm1 ; ux*nx | uy*ny | uz*nz | uw*nw shufps xmm3, xmm3, SHUF(Y, Z, X, W) shufps xmm4, xmm4, SHUF(Z, X, Y, W) addps xmm1, xmm3 @@ -286,10 +286,10 @@ proc sse_reflect_mvec subps xmm1, xmm5 subps xmm0, xmm1 - movaps xmm1, xmm0 + MOVUAPS xmm1, xmm0 mulps xmm1, xmm1 - movaps xmm2, xmm1 - movaps xmm3, xmm1 + MOVUAPS xmm2, xmm1 + MOVUAPS xmm3, xmm1 shufps xmm2, xmm2, SHUF(Y, Z, X, W) shufps xmm3, xmm3, SHUF(Z, X, Y, W) addps xmm1, xmm2 @@ -298,7 +298,7 @@ proc sse_reflect_mvec mulps xmm1, xmm7 movt xmm0, xmm1 - movaps [edx], xmm0 + MOVUAPS [edx], xmm0 add eax, 16 add ecx, 16 diff --git a/x86/sse_vertex.asm b/x86/sse_vertex.asm index e09b163..6d0b036 100644 --- a/x86/sse_vertex.asm +++ b/x86/sse_vertex.asm @@ -28,7 +28,7 @@ proc sse_Vertex3fv, 4 shufps xmm0, [f_0001], SHUF(X, Y, Z, W) shufps xmm0, xmm0, SHUF(Y, Z, X, W) movlps xmm0, [eax] - movaps [edx], xmm0 + MOVUAPS [edx], xmm0 cmp ecx, [tnl_vb + TNL_VB_MAX] je .0 ret @@ -50,7 +50,7 @@ proc sse_Color3fv, 4 shufps xmm0, [f_0001], SHUF(X, Y, Z, W) shufps xmm0, xmm0, SHUF(Y, Z, X, W) movlps xmm0, [edx] - movaps [eax], xmm0 + MOVUAPS [eax], xmm0 mov eax, [tnl_vb + TNL_VB_FLAGS] or dword [eax + ecx * 4], TNL_COLOR0_BIT or dword [tnl_general_flags], TNL_COLOR0_BIT @@ -66,7 +66,7 @@ proc sse_Color4fv, 4 sal eax, 4 add eax, [tnl_vb + TNL_VB_COLOR0_PTR] movups xmm0, [edx] - movaps [eax], xmm0 + MOVUAPS [eax], xmm0 mov eax, [tnl_vb + TNL_VB_FLAGS] or dword [eax + ecx * 4], TNL_COLOR0_BIT or dword [tnl_general_flags], TNL_COLOR0_BIT @@ -81,9 +81,9 @@ proc sse_TexCoord2fv, 4 mov eax, ecx sal eax, 4 add eax, [tnl_vb + TNL_VB_TEXCOORD0_PTR] - movaps xmm0, [f_0001] + MOVUAPS xmm0, [f_0001] movlps xmm0, [edx] - movaps [eax], xmm0 + MOVUAPS [eax], xmm0 mov eax, [tnl_vb + TNL_VB_FLAGS] or dword [eax + ecx * 4], TNL_TEXCOORD0_BIT or dword [tnl_general_flags], TNL_TEXCOORD0_BIT @@ -102,9 +102,9 @@ proc sse_MultiTexCoord2fv, 8 mov eax, ebx sal eax, 4 add eax, [tnl_vb + edx * 4 - GL_TEXTURE0 * sizeof_TNL_ARRAY + TNL_VB_TEXCOORD0_PTR] - movaps xmm0, [f_0001] + MOVUAPS xmm0, [f_0001] movlps xmm0, [esi] - movaps [eax], xmm0 + MOVUAPS [eax], xmm0 mov edx, [tnl_vb + TNL_VB_FLAGS] sub ecx, GL_TEXTURE0 mov eax, TNL_TEXCOORD0_BIT diff --git a/x86/x86.c b/x86/x86.c index 7816987..86f99de 100644 --- a/x86/x86.c +++ b/x86/x86.c @@ -1,3 +1,6 @@ +#include +#include + #include "GL/gl.h" #include "glinternal.h" @@ -5,6 +8,7 @@ #include "main/context.h" #include "main/matrix.h" #include "tnl/tnl.h" +#include "util/cfg.h" #include "cpu.h" #include "x86.h" @@ -45,6 +49,9 @@ void GLAPIENTRY sse_MultiTexCoord2fv (GLenum texture, const GLfloat *v); int x86_cpu_bits; char x86_cpu_name[13]; +int x86_enable_sse; +int x86_enable_3dnow; + static int sse_init (void) @@ -85,21 +92,29 @@ k3d_init (void) } +#define YES(v) !strcmp(cfg_get(v, "n"), "y") + int x86_init (void) { x86_cpu_bits = cpusoft(x86_cpu_name); + x86_enable_3dnow = YES("x86.enable.3dnow"); + x86_enable_sse = YES("x86.enable.sse"); + tnl_clipmask_tab[0] = x86_clipmask; /*ctx_imm_table.Vertex3fv = x86_Vertex3fv;*/ ctx_imm_table.TexCoord2fv = x86_TexCoord2fv; ctx_imm_table.MultiTexCoord2fv = x86_MultiTexCoord2fv; - if (x86_cpu_bits & _CPU_FEATURE_SSE) { + if ((x86_cpu_bits & _CPU_FEATURE_SSE) && x86_enable_sse) { sse_init(); } - if (x86_cpu_bits & _CPU_FEATURE_3DNOW) { + else if ((x86_cpu_bits & _CPU_FEATURE_3DNOW) && x86_enable_3dnow) { k3d_init(); } return 0; } + +/* validate structure sizes and member offsets in x86.inc: */ +#include "x86chk.h" diff --git a/x86/x86.h b/x86/x86.h index 116be3b..b247c6b 100644 --- a/x86/x86.h +++ b/x86/x86.h @@ -29,6 +29,9 @@ extern int x86_cpu_bits; extern char x86_cpu_name[]; +extern int x86_enable_sse; +extern int x86_enable_3dnow; + int x86_init (void); #endif diff --git a/x86/x86.inc b/x86/x86.inc deleted file mode 100644 index d46ae90..0000000 --- a/x86/x86.inc +++ /dev/null @@ -1,87 +0,0 @@ -;--------------------------------------- -; SSE -;--------------------------------------- -%define X 0 -%define Y 1 -%define Z 2 -%define W 3 -%define SHUF(_x, _y, _z, _w) (((_x)<<0) | ((_y)<<2) | ((_z)<<4) | ((_w)<<6)) - - -;--------------------------------------- -; CPU -;--------------------------------------- -%define _CPU_HAS_CPUID 32768 -%define _CPU_FEATURE_MMX 1 -%define _CPU_FEATURE_SSE 2 -%define _CPU_FEATURE_SSE2 4 -%define _CPU_FEATURE_3DNOW 8 -%define _CPU_FEATURE_3DNOWPLUS 16 -%define _CPU_FEATURE_MMXPLUS 32 - - -;--------------------------------------- -; OpenGL -;--------------------------------------- -%define GL_TEXTURE0 33984 - - -;--------------------------------------- -; Core -;--------------------------------------- -%define MAT_MAT 0 - -%define TEX_UNIT_OBJECT 8 -%define sizeof_TEX_UNIT 252 -%define TEX_OBJ_DRIVERDATA 1776 - - -;--------------------------------------- -; TNL -;--------------------------------------- -%define TNL_COLOR0_BIT 2 -%define TNL_NORMAL_BIT 8 -%define TNL_TEXCOORD0_BIT 16 - -%define sizeof_TNL_ARRAY 12 - -%define PRIM_COUNT 4 -%define PRIM_ORMASK 12 -%define sizeof_TNL_PRIMITIVE 16 - -%define TNL_VB_NUM 0 -%define TNL_VB_MAX 4 -%define TNL_VB_LEN 8 -%define TNL_VB_FLAGS 12 -%define TNL_VB_CLIPMASK 16 -%define TNL_VB_VERTEX_STRIDE 20 -%define TNL_VB_VERTEX_DATA 24 -%define TNL_VB_VERTEX_PTR 28 -%define TNL_VB_COLOR0_STRIDE 32 -%define TNL_VB_COLOR0_DATA 36 -%define TNL_VB_COLOR0_PTR 40 -%define TNL_VB_COLOR1_STRIDE 44 -%define TNL_VB_COLOR1_DATA 48 -%define TNL_VB_COLOR1_PTR 52 -%define TNL_VB_NORMAL_STRIDE 56 -%define TNL_VB_NORMAL_DATA 60 -%define TNL_VB_NORMAL_PTR 64 -%define TNL_VB_TEXCOORD0_STRIDE 68 -%define TNL_VB_TEXCOORD0_DATA 72 -%define TNL_VB_TEXCOORD0_PTR 76 -%define TNL_VB_FOGCOORD_STRIDE 284 -%define TNL_VB_FOGCOORD_DATA 288 -%define TNL_VB_FOGCOORD_PTR 292 -%define TNL_VB_CLIP 308 -%define TNL_VB_NDC 312 -%define TNL_VB_VEYE 396 -%define TNL_VB_NEYE 400 -%define TNL_VB_VEYN 404 -%define TNL_VB_REFL 408 - -%define qN 1 -%define qF 2 -%define qT 4 -%define qB 8 -%define qL 16 -%define qR 32 diff --git a/x86/x86gen.c b/x86/x86gen.c index fd6be6f..59d540e 100644 --- a/x86/x86gen.c +++ b/x86/x86gen.c @@ -17,6 +17,7 @@ main (int argc, char **argv) const char *myname = argv[0]; char *out = NULL; FILE *f = stdout; + int c_header = 0; while (--argc) { char *p = *++argv; @@ -28,6 +29,9 @@ main (int argc, char **argv) out = *++argv; argc--; } + else if (!strcmp(p, "-c")) { + c_header = 1; + } } if (out != NULL) { @@ -38,6 +42,9 @@ main (int argc, char **argv) } } + if (c_header) + goto c_out; + fprintf(f, ";---------------------------------------\n"); fprintf(f, "; SSE\n"); fprintf(f, ";---------------------------------------\n"); @@ -118,6 +125,60 @@ main (int argc, char **argv) fprintf(f, "%%define qL\t\t\t%d\n", TNL_CLIP_LEFT); fprintf(f, "%%define qR\t\t\t%d\n", TNL_CLIP_RIGHT); + goto done; + +c_out: + fprintf(f, "#define SAGE_COMPILE_TIME_ASSERT(name, x) typedef int _chk_ ## name[(x) * 2 - 1]\n"); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(_CPU_HAS_CPUID_,_CPU_HAS_CPUID==%d);\n", _CPU_HAS_CPUID); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(_CPU_FEATURE_MMX_,_CPU_FEATURE_MMX==%d);\n", _CPU_FEATURE_MMX); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(_CPU_FEATURE_SSE_,_CPU_FEATURE_SSE==%d);\n", _CPU_FEATURE_SSE); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(_CPU_FEATURE_SSE2_,_CPU_FEATURE_SSE2==%d);\n", _CPU_FEATURE_SSE2); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(_CPU_FEATURE_3DNOW_,_CPU_FEATURE_3DNOW==%d);\n", _CPU_FEATURE_3DNOW); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(_CPU_FEATURE_3DNOWPLUS_,_CPU_FEATURE_3DNOWPLUS==%d);\n", _CPU_FEATURE_3DNOWPLUS); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(_CPU_FEATURE_MMXPLUS_,_CPU_FEATURE_MMXPLUS==%d);\n", _CPU_FEATURE_MMXPLUS); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(GL_TEXTURE0_,GL_TEXTURE0==%d);\n", GL_TEXTURE0); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(MAT_MAT,offsetof(MATRIX, mat)==%d);\n", offsetof(MATRIX, mat)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TEX_UNIT_OBJECT,offsetof(TEX_UNIT, object)==%d);\n", offsetof(TEX_UNIT, object)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(sizeof_TEX_UNIT,sizeof(TEX_UNIT)==%d);\n", sizeof(TEX_UNIT)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TEX_OBJ_DRIVERDATA,offsetof(TEX_OBJ, driverData)==%d);\n", offsetof(TEX_OBJ, driverData)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_COLOR0_BIT_,TNL_COLOR0_BIT==%d);\n", TNL_COLOR0_BIT); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_NORMAL_BIT_,TNL_NORMAL_BIT==%d);\n", TNL_NORMAL_BIT); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_TEXCOORD0_BIT_,TNL_TEXCOORD0_BIT==%d);\n", TNL_TEXCOORD0_BIT); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(sizeof_TNL_ARRAY,sizeof(TNL_ARRAY)==%d);\n", sizeof(TNL_ARRAY)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(PRIM_COUNT,offsetof(TNL_PRIMITIVE, count)==%d);\n", offsetof(TNL_PRIMITIVE, count)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(PRIM_ORMASK,offsetof(TNL_PRIMITIVE, ormask)==%d);\n", offsetof(TNL_PRIMITIVE, ormask)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(sizeof_TNL_PRIMITIVE,sizeof(TNL_PRIMITIVE)==%d);\n", sizeof(TNL_PRIMITIVE)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_NUM,offsetof(TNL_VERTEXBUFFER, num)==%d);\n", offsetof(TNL_VERTEXBUFFER, num)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_MAX,offsetof(TNL_VERTEXBUFFER, max)==%d);\n", offsetof(TNL_VERTEXBUFFER, max)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_LEN,offsetof(TNL_VERTEXBUFFER, len)==%d);\n", offsetof(TNL_VERTEXBUFFER, len)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_FLAGS,offsetof(TNL_VERTEXBUFFER, flags)==%d);\n", offsetof(TNL_VERTEXBUFFER, flags)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_CLIPMASK,offsetof(TNL_VERTEXBUFFER, clipmask)==%d);\n", offsetof(TNL_VERTEXBUFFER, clipmask)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_VERTEX_STRIDE,offsetof(TNL_VERTEXBUFFER, attr[TNL_VERTEX].stride)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_VERTEX].stride)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_VERTEX_DATA,offsetof(TNL_VERTEXBUFFER, attr[TNL_VERTEX].data)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_VERTEX].data)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_VERTEX_PTR,offsetof(TNL_VERTEXBUFFER, attr[TNL_VERTEX].ptr)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_VERTEX].ptr)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_COLOR0_STRIDE,offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR0].stride)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR0].stride)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_COLOR0_DATA,offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR0].data)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR0].data)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_COLOR0_PTR,offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR0].ptr)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR0].ptr)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_COLOR1_STRIDE,offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR1].stride)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR1].stride)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_COLOR1_DATA,offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR1].data)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR1].data)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_COLOR1_PTR,offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR1].ptr)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_COLOR1].ptr)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_NORMAL_STRIDE,offsetof(TNL_VERTEXBUFFER, attr[TNL_NORMAL].stride)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_NORMAL].stride)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_NORMAL_DATA,offsetof(TNL_VERTEXBUFFER, attr[TNL_NORMAL].data)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_NORMAL].data)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_NORMAL_PTR,offsetof(TNL_VERTEXBUFFER, attr[TNL_NORMAL].ptr)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_NORMAL].ptr)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_TEXCOORD0_STRIDE,offsetof(TNL_VERTEXBUFFER, attr[TNL_TEXCOORD0].stride)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_TEXCOORD0].stride)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_TEXCOORD0_DATA,offsetof(TNL_VERTEXBUFFER, attr[TNL_TEXCOORD0].data)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_TEXCOORD0].data)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_TEXCOORD0_PTR,offsetof(TNL_VERTEXBUFFER, attr[TNL_TEXCOORD0].ptr)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_TEXCOORD0].ptr)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_FOGCOORD_STRIDE,offsetof(TNL_VERTEXBUFFER, attr[TNL_FOGCOORD].stride)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_FOGCOORD].stride)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_FOGCOORD_DATA,offsetof(TNL_VERTEXBUFFER, attr[TNL_FOGCOORD].data)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_FOGCOORD].data)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_FOGCOORD_PTR,offsetof(TNL_VERTEXBUFFER, attr[TNL_FOGCOORD].ptr)==%d);\n", offsetof(TNL_VERTEXBUFFER, attr[TNL_FOGCOORD].ptr)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_CLIP,offsetof(TNL_VERTEXBUFFER, clip)==%d);\n", offsetof(TNL_VERTEXBUFFER, clip)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_NDC,offsetof(TNL_VERTEXBUFFER, ndc)==%d);\n", offsetof(TNL_VERTEXBUFFER, ndc)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_VEYE,offsetof(TNL_VERTEXBUFFER, veye)==%d);\n", offsetof(TNL_VERTEXBUFFER, veye)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_NEYE,offsetof(TNL_VERTEXBUFFER, neye)==%d);\n", offsetof(TNL_VERTEXBUFFER, neye)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_VEYN,offsetof(TNL_VERTEXBUFFER, veyn)==%d);\n", offsetof(TNL_VERTEXBUFFER, veyn)); + fprintf(f, "SAGE_COMPILE_TIME_ASSERT(TNL_VB_REFL,offsetof(TNL_VERTEXBUFFER, refl)==%d);\n", offsetof(TNL_VERTEXBUFFER, refl)); + +done: if (out != NULL) { fclose(f); } diff --git a/x86/xos.inc b/x86/xos.inc index ffac7a0..7de0af5 100644 --- a/x86/xos.inc +++ b/x86/xos.inc @@ -53,7 +53,7 @@ %macro endp 0 %ifnctx proc - %error Mismatched `endp'/`proc' + %error Mismatched ENDP/PROC %else %$end: %pop @@ -110,3 +110,13 @@ %endmacro %endif + +;--------------------------------------- +; movaps is broken in DJGPP DXE builds - +; possibly an issue in the dxe3gen tool. +;--------------------------------------- +%ifdef BROKEN_MOVAPS +%define MOVUAPS movups +%else +%define MOVUAPS movaps +%endif